function SchemaDefinitionTest::testIntDefaultForTextColumn
Tests passing a int default to a text column.
File
-
core/
tests/ Drupal/ Tests/ Core/ Database/ SchemaDefinitionTest.php, line 331
Class
- SchemaDefinitionTest
- Tests SchemaDefinition Column object validations.
Namespace
Drupal\Tests\Core\DatabaseCode
public function testIntDefaultForTextColumn() : void {
$this->expectException(SchemaDefinitionException::class);
$this->expectExceptionMessageIs('Cannot set a int default for column \'id\'');
$table = new Table(name: 'test', columns: [
Column::create(name: 'id', type: ColumnType::Text, default: new IntValue(10)),
], 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.