function SchemaTest::testSchemaTableColumnSizeTooLargeException

Same name in other branches
  1. 10 core/modules/mysql/tests/src/Kernel/mysql/SchemaTest.php \Drupal\Tests\mysql\Kernel\mysql\SchemaTest::testSchemaTableColumnSizeTooLargeException()

Tests SchemaTableColumnSizeTooLargeException.

File

core/modules/mysql/tests/src/Kernel/mysql/SchemaTest.php, line 300

Class

SchemaTest
Tests schema API for the MySQL driver.

Namespace

Drupal\Tests\mysql\Kernel\mysql

Code

public function testSchemaTableColumnSizeTooLargeException() : void {
    $this->expectException(SchemaTableColumnSizeTooLargeException::class);
    $this->expectExceptionMessage("Column length too big for column 'too_large' (max = 16383); use BLOB or TEXT instead");
    $this->schema
        ->createTable('test_schema', [
        'description' => 'Tests SchemaTableColumnSizeTooLargeException.',
        'fields' => [
            'too_large' => [
                'type' => 'varchar',
                'length' => 65536,
                'not null' => TRUE,
            ],
        ],
    ]);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.