function SelectTest::testIsNotNullCondition
Same name in other branches
- 9 core/tests/Drupal/KernelTests/Core/Database/SelectTest.php \Drupal\KernelTests\Core\Database\SelectTest::testIsNotNullCondition()
- 10 core/tests/Drupal/KernelTests/Core/Database/SelectTest.php \Drupal\KernelTests\Core\Database\SelectTest::testIsNotNullCondition()
- 11.x core/tests/Drupal/KernelTests/Core/Database/SelectTest.php \Drupal\KernelTests\Core\Database\SelectTest::testIsNotNullCondition()
Tests that we can find a record without a NULL value.
File
-
core/
tests/ Drupal/ KernelTests/ Core/ Database/ SelectTest.php, line 243
Class
- SelectTest
- Tests the Select query builder.
Namespace
Drupal\KernelTests\Core\DatabaseCode
public function testIsNotNullCondition() {
$this->ensureSampleDataNull();
$names = $this->connection
->select('test_null', 'tn')
->fields('tn', [
'name',
])
->isNotNull('tn.age')
->orderBy('name')
->execute()
->fetchCol();
$this->assertCount(2, $names, 'Correct number of records found withNOT NULL age.');
$this->assertEqual($names[0], 'Gonzo', 'Correct record returned for NOT NULL age.');
$this->assertEqual($names[1], 'Kermit', 'Correct record returned for NOT NULL age.');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.