function ReservedWordTest::testSelectReservedWordAliasAllFields

Same name and namespace in other branches
  1. 9 core/tests/Drupal/KernelTests/Core/Database/ReservedWordTest.php \Drupal\KernelTests\Core\Database\ReservedWordTest::testSelectReservedWordAliasAllFields()
  2. 8.9.x core/tests/Drupal/KernelTests/Core/Database/ReservedWordTest.php \Drupal\KernelTests\Core\Database\ReservedWordTest::testSelectReservedWordAliasAllFields()
  3. 11.x core/tests/Drupal/KernelTests/Core/Database/ReservedWordTest.php \Drupal\KernelTests\Core\Database\ReservedWordTest::testSelectReservedWordAliasAllFields()

Tests SELECT query with all fields from a table with a reserved alias.

File

core/tests/Drupal/KernelTests/Core/Database/ReservedWordTest.php, line 74

Class

ReservedWordTest
Tests queries that include reserved words.

Namespace

Drupal\KernelTests\Core\Database

Code

public function testSelectReservedWordAliasAllFields() : void {
  $record = $this->connection
    ->select('test', 'signal')
    ->fields('signal')
    ->condition('age', 27)
    ->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.