You are here

public function SelectTest::testSelectDuplicateAlias in Drupal 9

Same name and namespace in other branches
  1. 8 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 546

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
    ->assertNotSame($alias1, $alias2, 'Duplicate aliases are renamed.');
}