function ReservedWordTest::testSelectReservedWordAliasSpecificFields
Same name in other branches
- 9 core/tests/Drupal/KernelTests/Core/Database/ReservedWordTest.php \Drupal\KernelTests\Core\Database\ReservedWordTest::testSelectReservedWordAliasSpecificFields()
- 8.9.x core/tests/Drupal/KernelTests/Core/Database/ReservedWordTest.php \Drupal\KernelTests\Core\Database\ReservedWordTest::testSelectReservedWordAliasSpecificFields()
- 11.x core/tests/Drupal/KernelTests/Core/Database/ReservedWordTest.php \Drupal\KernelTests\Core\Database\ReservedWordTest::testSelectReservedWordAliasSpecificFields()
Tests SELECT query with specific fields from a table with a reserved alias.
File
-
core/
tests/ Drupal/ KernelTests/ Core/ Database/ ReservedWordTest.php, line 59
Class
- ReservedWordTest
- Tests queries that include reserved words.
Namespace
Drupal\KernelTests\Core\DatabaseCode
public function testSelectReservedWordAliasSpecificFields() : void {
$query = $this->connection
->select('test', 'high_priority');
$query->addField('high_priority', 'name');
$query->addField('high_priority', 'age', 'age');
$query->condition('age', 27);
$record = $query->execute()
->fetchObject();
// Ensure that we got the right record.
$this->assertSame('George', $record->name);
$this->assertSame('27', $record->age);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.