function SchemaDefinitionTest::testInvalidPrimaryKeyForPartialLengthColumn
Tests passing limited length columns to primary key.
File
-
core/
tests/ Drupal/ Tests/ Core/ Database/ SchemaDefinitionTest.php, line 505
Class
- SchemaDefinitionTest
- Tests SchemaDefinition Column object validations.
Namespace
Drupal\Tests\Core\DatabaseCode
public function testInvalidPrimaryKeyForPartialLengthColumn() : void {
$this->expectException(SchemaDefinitionException::class);
$this->expectExceptionMessage('Limited length columns not allowed in this context');
$table = new Table(name: 'test', columns: [
Column::text(name: 'id', length: 40, default: new StringValue('foo')),
], primaryKey: new PrimaryKey([
[
'id',
10,
],
]));
$this->assertInstanceOf(Table::class, $table);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.