You are here

public function ConnectionTest::testCondition 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/ConnectionTest.php \Drupal\Tests\sqlsrv\Kernel\ConnectionTest::testCondition()
  2. 3.0.x tests/src/Kernel/ConnectionTest.php \Drupal\Tests\sqlsrv\Kernel\ConnectionTest::testCondition()
  3. 3.1.x tests/src/Kernel/ConnectionTest.php \Drupal\Tests\sqlsrv\Kernel\ConnectionTest::testCondition()
  4. 4.0.x tests/src/Kernel/ConnectionTest.php \Drupal\Tests\sqlsrv\Kernel\ConnectionTest::testCondition()
  5. 4.1.x tests/src/Kernel/ConnectionTest.php \Drupal\Tests\sqlsrv\Kernel\ConnectionTest::testCondition()

Tests ::condition()

Test that the method ::condition() returns a Condition object from the driver directory.

File

tests/src/Kernel/ConnectionTest.php, line 21

Class

ConnectionTest
Tests of the sqlsrv database system.

Namespace

Drupal\Tests\sqlsrv\Kernel

Code

public function testCondition() {
  $db = Database::getConnection('default', 'default');
  $namespace = (new \ReflectionObject($db))
    ->getNamespaceName() . "\\Condition";
  $condition = $db
    ->condition('AND');
  $this
    ->assertIdentical($namespace, get_class($condition));
  $nested_and_condition = $condition
    ->andConditionGroup();
  $this
    ->assertIdentical($namespace, get_class($nested_and_condition));
  $nested_or_condition = $condition
    ->orConditionGroup();
  $this
    ->assertIdentical($namespace, get_class($nested_or_condition));
}