You are here

public function SelectTest::testNamespaceConditionAndHavingObjects in Drupal driver for SQL Server and SQL Azure 4.0.x

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

Tests namespace of the condition and having objects.

File

tests/src/Kernel/SelectTest.php, line 17

Class

SelectTest
Tests the Select query builder.

Namespace

Drupal\Tests\sqlsrv\Kernel

Code

public function testNamespaceConditionAndHavingObjects() {
  $namespace = (new \ReflectionObject($this->connection))
    ->getNamespaceName() . "\\Condition";
  $select = $this->connection
    ->select('test');
  $reflection = new \ReflectionObject($select);
  $condition_property = $reflection
    ->getProperty('condition');
  $condition_property
    ->setAccessible(TRUE);
  $this
    ->assertIdentical($namespace, get_class($condition_property
    ->getValue($select)));
  $having_property = $reflection
    ->getProperty('having');
  $having_property
    ->setAccessible(TRUE);
  $this
    ->assertIdentical($namespace, get_class($having_property
    ->getValue($select)));
  $nested_and_condition = $select
    ->andConditionGroup();
  $this
    ->assertIdentical($namespace, get_class($nested_and_condition));
  $nested_or_condition = $select
    ->orConditionGroup();
  $this
    ->assertIdentical($namespace, get_class($nested_or_condition));
}