function SchemaDefinitionTest::testDuplicateColumnInTable

Tests passing duplicate Column to Table::$columns.

File

core/tests/Drupal/Tests/Core/Database/SchemaDefinitionTest.php, line 165

Class

SchemaDefinitionTest
Tests SchemaDefinition Column object validations.

Namespace

Drupal\Tests\Core\Database

Code

public function testDuplicateColumnInTable() : void {
  $this->expectException(SchemaDefinitionException::class);
  $this->expectExceptionMessage('Duplicate columns for \'test\' table: id, id');
  $table = new Table(name: 'test', columns: [
    Column::serial(name: 'id'),
    Column::int(name: 'id'),
  ], primaryKey: new PrimaryKey([
    'id',
  ]));
  $this->assertInstanceOf(Table::class, $table);
}

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