function SchemaDefinitionTest::testInvalidColumnTypeForBinary

Same name and namespace in other branches
  1. 11.x core/tests/Drupal/Tests/Core/Database/SchemaDefinitionTest.php \Drupal\Tests\Core\Database\SchemaDefinitionTest::testInvalidColumnTypeForBinary()

Tests passing binary to a non-textual column.

File

core/tests/Drupal/Tests/Core/Database/SchemaDefinitionTest.php, line 427

Class

SchemaDefinitionTest
Tests SchemaDefinition Column object validations.

Namespace

Drupal\Tests\Core\Database

Code

public function testInvalidColumnTypeForBinary() : void {
  $this->expectException(SchemaDefinitionException::class);
  $this->expectExceptionMessage('Cannot set \'binary\' for int column \'id\'');
  $table = new Table(name: 'test', columns: [
    Column::create(name: 'id', type: ColumnType::Int, 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.