function ConditionTest::testInvalidOperatorThrowsException

Same name and namespace in other branches
  1. 11.x core/modules/pgsql/tests/src/Unit/EntityQuery/ConditionTest.php \Drupal\Tests\pgsql\Unit\EntityQuery\ConditionTest::testInvalidOperatorThrowsException()

Tests that an invalid operator throws an exception.

File

core/modules/pgsql/tests/src/Unit/EntityQuery/ConditionTest.php, line 53

Class

ConditionTest
Tests \Drupal\pgsql\EntityQuery\Condition.

Namespace

Drupal\Tests\pgsql\Unit\EntityQuery

Code

public function testInvalidOperatorThrowsException() : void {
  $sql_query = $this->createStub(SelectInterface::class);
  $condition = [
    'real_field' => 'field',
    'operator' => 'LIKE',
    'value' => [
      'foo',
      'bar',
    ],
  ];
  $this->expectException(\InvalidArgumentException::class);
  $this->expectExceptionMessage('Invalid operator "LIKE"');
  Condition::translateCondition($condition, $sql_query, FALSE);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.