function SchemaDefinitionTest::testInvalidUniqueKeyForPartialLengthColumn
Tests passing limited length columns to an unique key.
File
-
core/
tests/ Drupal/ Tests/ Core/ Database/ SchemaDefinitionTest.php, line 525
Class
- SchemaDefinitionTest
- Tests SchemaDefinition Column object validations.
Namespace
Drupal\Tests\Core\DatabaseCode
public function testInvalidUniqueKeyForPartialLengthColumn() : 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',
]), uniqueKeys: [
new UniqueKey(name: 'invalid', columns: [
[
'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.