function SelectTest::testNonArrayOperatorWithArrayValueCondition

Same name in other branches
  1. 10 core/tests/Drupal/KernelTests/Core/Database/SelectTest.php \Drupal\KernelTests\Core\Database\SelectTest::testNonArrayOperatorWithArrayValueCondition()

Tests thrown exception for non array operator conditions with array value.

@dataProvider providerNonArrayOperatorWithArrayValueCondition

File

core/tests/Drupal/KernelTests/Core/Database/SelectTest.php, line 622

Class

SelectTest
Tests the Select query builder.

Namespace

Drupal\KernelTests\Core\Database

Code

public function testNonArrayOperatorWithArrayValueCondition($operator, $operator_in_exception_message) : void {
    $this->expectException(InvalidQueryException::class);
    $this->expectExceptionMessage("Query condition 'age " . $operator_in_exception_message . " 26, 27' must have an array compatible operator.");
    $this->connection
        ->select('test', 't')
        ->fields('t')
        ->condition('age', [
        26,
        27,
    ], $operator)
        ->execute();
}

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