function SelectTest::testSimpleSelect in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/system/src/Tests/Database/SelectTest.php \Drupal\system\Tests\Database\SelectTest::testSimpleSelect()
Tests rudimentary SELECT statements.
File
- core/
modules/ system/ src/ Tests/ Database/ SelectTest.php, line 22 - Contains \Drupal\system\Tests\Database\SelectTest.
Class
- SelectTest
- Tests the Select query builder.
Namespace
Drupal\system\Tests\DatabaseCode
function testSimpleSelect() {
$query = db_select('test');
$query
->addField('test', 'name');
$query
->addField('test', 'age', 'age');
$num_records = $query
->countQuery()
->execute()
->fetchField();
$this
->assertEqual($num_records, 4, 'Returned the correct number of rows.');
}