function SchemaDefinitionTest::testInvalidColumnInTable
Tests passing a non Column array member to Table::$columns.
File
-
core/
tests/ Drupal/ Tests/ Core/ Database/ SchemaDefinitionTest.php, line 103
Class
- SchemaDefinitionTest
- Tests SchemaDefinition Column object validations.
Namespace
Drupal\Tests\Core\DatabaseCode
public function testInvalidColumnInTable() : void {
$this->expectException(SchemaDefinitionException::class);
$this->expectExceptionMessage('All members of the \'columns\' argument of the \'test\' Table must be Column objects');
$table = new Table(name: 'test', columns: [
'name' => [
'description' => "A person's name",
'type' => 'varchar_ascii',
'length' => 255,
'not null' => TRUE,
'default' => '',
'binary' => TRUE,
],
], 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.