You are here

public function ReservedWordTest::testSelectReservedWordTableSpecificField in Drupal 9

Same name and namespace in other branches
  1. 8 core/tests/Drupal/KernelTests/Core/Database/ReservedWordTest.php \Drupal\KernelTests\Core\Database\ReservedWordTest::testSelectReservedWordTableSpecificField()

Tests SELECT query with a specific field from a table with a reserved name.

File

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

Class

ReservedWordTest
Tests queries that include reserved words.

Namespace

Drupal\KernelTests\Core\Database

Code

public function testSelectReservedWordTableSpecificField() {
  $query = $this->connection
    ->select('virtual');
  $query
    ->addField('virtual', 'function');
  $rows = $query
    ->execute()
    ->fetchCol();
  $this
    ->assertSame('Function value 1', $rows[0]);
}