You are here

function SelectTest::testSelectDuplicateAlias in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/system/src/Tests/Database/SelectTest.php \Drupal\system\Tests\Database\SelectTest::testSelectDuplicateAlias()

Tests that aliases are renamed when they are duplicates.

File

core/modules/system/src/Tests/Database/SelectTest.php, line 464
Contains \Drupal\system\Tests\Database\SelectTest.

Class

SelectTest
Tests the Select query builder.

Namespace

Drupal\system\Tests\Database

Code

function testSelectDuplicateAlias() {
  $query = db_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.');
}