You are here

public function SelectTest::testSelectDuplicateAlias in Drupal 8

Same name and namespace in other branches
  1. 9 core/tests/Drupal/KernelTests/Core/Database/SelectTest.php \Drupal\KernelTests\Core\Database\SelectTest::testSelectDuplicateAlias()

Tests that aliases are renamed when they are duplicates.

File

core/tests/Drupal/KernelTests/Core/Database/SelectTest.php, line 547

Class

SelectTest
Tests the Select query builder.

Namespace

Drupal\KernelTests\Core\Database

Code

public function testSelectDuplicateAlias() {
  $query = $this->connection
    ->select('test', 't');
  $alias1 = $query
    ->addField('t', 'name', 'the_alias');
  $alias2 = $query
    ->addField('t', 'age', 'the_alias');
  $this
    ->assertNotIdentical($alias1, $alias2, 'Duplicate aliases are renamed.');
}