You are here

public function ConnectionTest::testCondition in Drupal 10

Same name and namespace in other branches
  1. 8 core/tests/Drupal/KernelTests/Core/Database/ConnectionTest.php \Drupal\KernelTests\Core\Database\ConnectionTest::testCondition()
  2. 9 core/tests/Drupal/KernelTests/Core/Database/ConnectionTest.php \Drupal\KernelTests\Core\Database\ConnectionTest::testCondition()

Tests that the method ::condition() returns a Condition object.

File

core/tests/Drupal/KernelTests/Core/Database/ConnectionTest.php, line 183

Class

ConnectionTest
Tests of the core database system.

Namespace

Drupal\KernelTests\Core\Database

Code

public function testCondition() {
  $connection = Database::getConnection('default', 'default');
  $namespace = (new \ReflectionObject($connection))
    ->getNamespaceName() . "\\Condition";
  if (!class_exists($namespace)) {
    $namespace = Condition::class;
  }
  $condition = $connection
    ->condition('AND');
  $this
    ->assertSame($namespace, get_class($condition));
}