function ReservedWordTest::testSelectReservedWordTableSpecificField

Same name in other branches
  1. 8.9.x core/tests/Drupal/KernelTests/Core/Database/ReservedWordTest.php \Drupal\KernelTests\Core\Database\ReservedWordTest::testSelectReservedWordTableSpecificField()
  2. 10 core/tests/Drupal/KernelTests/Core/Database/ReservedWordTest.php \Drupal\KernelTests\Core\Database\ReservedWordTest::testSelectReservedWordTableSpecificField()
  3. 11.x 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]);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.