public function SelectTest::testNullCondition in Drupal 9
Same name and namespace in other branches
- 8 core/tests/Drupal/KernelTests/Core/Database/SelectTest.php \Drupal\KernelTests\Core\Database\SelectTest::testNullCondition()
Tests that a comparison with NULL is always FALSE.
File
- core/
tests/ Drupal/ KernelTests/ Core/ Database/ SelectTest.php, line 215
Class
- SelectTest
- Tests the Select query builder.
Namespace
Drupal\KernelTests\Core\DatabaseCode
public function testNullCondition() {
$this
->ensureSampleDataNull();
$names = $this->connection
->select('test_null', 'tn')
->fields('tn', [
'name',
])
->condition('age', NULL)
->execute()
->fetchCol();
$this
->assertCount(0, $names, 'No records found when comparing to NULL.');
}