function SchemaDefinitionTest::testDuplicateTableInSchema
Tests passing duplicate Table to Schema::$tables.
File
-
core/
tests/ Drupal/ Tests/ Core/ Database/ SchemaDefinitionTest.php, line 106
Class
- SchemaDefinitionTest
- Tests SchemaDefinition Column object validations.
Namespace
Drupal\Tests\Core\DatabaseCode
public function testDuplicateTableInSchema() : void {
$this->expectException(SchemaDefinitionException::class);
$this->expectExceptionMessageIs('Duplicate tables for \'test_foo_bar\' schema: foo, foo');
$schemaDefinition = new Schema(type: SchemaDefinitionType::Test, name: 'test_foo_bar', tables: [
new Table(name: 'foo', description: 'Foo table for the database unit tests.', columns: [
Column::serial(name: 'id'),
], primaryKey: new PrimaryKey([
'id',
])),
new Table(name: 'foo', description: 'Foo table for the database unit tests.', columns: [
Column::serial(name: 'id'),
], primaryKey: new PrimaryKey([
'id',
])),
]);
$this->assertInstanceOf(Schema::class, $schemaDefinition);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.