function KernelTestBase::createStateTable
Same name and namespace in other branches
- 11.x core/tests/Drupal/KernelTests/KernelTestBase.php \Drupal\KernelTests\KernelTestBase::createStateTable()
Creates the table recording the state of the shared database.
File
-
core/
tests/ Drupal/ KernelTests/ KernelTestBase.php, line 1304
Class
- KernelTestBase
- Base class for functional integration tests.
Namespace
Drupal\KernelTestsCode
private function createStateTable(array $tables = []) : void {
$connection = $this->container
->get('database');
$connection->schema()
->createTable(self::STATE_TABLE, [
'description' => 'Records whether the shared database state of a kernel test class is usable.',
'fields' => [
'status' => [
'type' => 'varchar',
'length' => 32,
'not null' => TRUE,
],
'message' => [
'type' => 'text',
'not null' => FALSE,
],
'tables' => [
'type' => 'text',
'not null' => FALSE,
],
],
'primary key' => [
'status',
],
]);
$connection->insert(self::STATE_TABLE)
->fields([
'status' => 'ready',
'message' => NULL,
'tables' => Json::encode($tables),
])
->execute();
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.