You are here

public function ConditionTest::testPdoBugFix in Drupal driver for SQL Server and SQL Azure 8.2

Same name and namespace in other branches
  1. 4.2.x tests/src/Kernel/ConditionTest.php \Drupal\Tests\sqlsrv\Kernel\ConditionTest::testPdoBugFix()
  2. 3.0.x tests/src/Kernel/ConditionTest.php \Drupal\Tests\sqlsrv\Kernel\ConditionTest::testPdoBugFix()
  3. 3.1.x tests/src/Kernel/ConditionTest.php \Drupal\Tests\sqlsrv\Kernel\ConditionTest::testPdoBugFix()
  4. 4.0.x tests/src/Kernel/ConditionTest.php \Drupal\Tests\sqlsrv\Kernel\ConditionTest::testPdoBugFix()
  5. 4.1.x tests/src/Kernel/ConditionTest.php \Drupal\Tests\sqlsrv\Kernel\ConditionTest::testPdoBugFix()

Ensure that the sqlsrv driver can execute queries with multiple escapes.

Core tests already do this, but good to double check.

File

tests/src/Kernel/ConditionTest.php, line 85

Class

ConditionTest
Test the functions of the custom Condition class.

Namespace

Drupal\Tests\sqlsrv\Kernel

Code

public function testPdoBugFix() {
  $connection = $this->connection;
  $query = new Select('test', 't', $connection);

  // Create and execute buggy query.
  $query
    ->addField('t', 'job');
  $query
    ->condition('job', '%i%', 'LIKE');
  $query
    ->condition('name', '%o%', 'LIKE');
  $result = $query
    ->execute();

  // Asserting that no exception is thrown. Is there a better way?
  // Should actually review results.
  $this
    ->assertTrue(TRUE);
}