function SelectTest::testSimpleSelect
Same name in other branches
- 9 core/tests/Drupal/KernelTests/Core/Database/SelectTest.php \Drupal\KernelTests\Core\Database\SelectTest::testSimpleSelect()
- 8.9.x core/tests/Drupal/KernelTests/Core/Database/SelectTest.php \Drupal\KernelTests\Core\Database\SelectTest::testSimpleSelect()
- 11.x core/tests/Drupal/KernelTests/Core/Database/SelectTest.php \Drupal\KernelTests\Core\Database\SelectTest::testSimpleSelect()
Tests rudimentary SELECT statements.
File
-
core/
tests/ Drupal/ KernelTests/ Core/ Database/ SelectTest.php, line 22
Class
- SelectTest
- Tests the Select query builder.
Namespace
Drupal\KernelTests\Core\DatabaseCode
public function testSimpleSelect() : void {
$query = $this->connection
->select('test');
$query->addField('test', 'name');
$query->addField('test', 'age', 'age');
$num_records = $query->countQuery()
->execute()
->fetchField();
$this->assertEquals(4, $num_records, 'Returned the correct number of rows.');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.