function SelectTest::testSimpleComment
Same name in other branches
- 8.9.x core/tests/Drupal/KernelTests/Core/Database/SelectTest.php \Drupal\KernelTests\Core\Database\SelectTest::testSimpleComment()
- 10 core/tests/Drupal/KernelTests/Core/Database/SelectTest.php \Drupal\KernelTests\Core\Database\SelectTest::testSimpleComment()
- 11.x core/tests/Drupal/KernelTests/Core/Database/SelectTest.php \Drupal\KernelTests\Core\Database\SelectTest::testSimpleComment()
Tests rudimentary SELECT statement with a COMMENT.
File
-
core/
tests/ Drupal/ KernelTests/ Core/ Database/ SelectTest.php, line 32
Class
- SelectTest
- Tests the Select query builder.
Namespace
Drupal\KernelTests\Core\DatabaseCode
public function testSimpleComment() {
$query = $this->connection
->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->assertCount(4, $records, 'Returned the correct number of rows.');
$this->assertStringContainsString($expected, $query, 'The flattened query contains the comment string.');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.