function SelectTest::testSimpleComment 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::testSimpleComment()
Tests rudimentary SELECT statement with a COMMENT.
File
- core/
modules/ system/ src/ Tests/ Database/ SelectTest.php, line 34 - Contains \Drupal\system\Tests\Database\SelectTest.
Class
- SelectTest
- Tests the Select query builder.
Namespace
Drupal\system\Tests\DatabaseCode
function testSimpleComment() {
$query = db_select('test')
->comment('Testing query comments');
$query
->addField('test', 'name');
$query
->addField('test', 'age', 'age');
$result = $query
->execute();
$records = $result
->fetchAll();
$query = (string) $query;
$expected = "/* Testing query comments */";
$this
->assertEqual(count($records), 4, 'Returned the correct number of rows.');
$this
->assertNotIdentical(FALSE, strpos($query, $expected), 'The flattened query contains the comment string.');
}