public static function TestDatabase::testingSchema in Drupal 10
Same name and namespace in other branches
- 8 core/lib/Drupal/Core/Test/TestDatabase.php \Drupal\Core\Test\TestDatabase::testingSchema()
- 9 core/lib/Drupal/Core/Test/TestDatabase.php \Drupal\Core\Test\TestDatabase::testingSchema()
Defines the database schema for run-tests.sh and PHPUnit tests.
@internal
Return value
array Array suitable for use in a hook_schema() implementation.
File
- core/
lib/ Drupal/ Core/ Test/ TestDatabase.php, line 317
Class
- TestDatabase
- Provides helper methods for interacting with the fixture database.
Namespace
Drupal\Core\TestCode
public static function testingSchema() {
$schema['simpletest'] = [
'description' => 'Stores test messages',
'fields' => [
'message_id' => [
'type' => 'serial',
'not null' => TRUE,
'description' => 'Primary Key: Unique test message ID.',
],
'test_id' => [
'type' => 'int',
'not null' => TRUE,
'default' => 0,
'description' => 'Test ID, messages belonging to the same ID are reported together',
],
'test_class' => [
'type' => 'varchar_ascii',
'length' => 255,
'not null' => TRUE,
'default' => '',
'description' => 'The name of the class that created this message.',
],
'status' => [
'type' => 'varchar',
'length' => 9,
'not null' => TRUE,
'default' => '',
'description' => 'Message status. Core understands pass, fail, exception.',
],
'message' => [
'type' => 'text',
'not null' => TRUE,
'description' => 'The message itself.',
],
'message_group' => [
'type' => 'varchar_ascii',
'length' => 255,
'not null' => TRUE,
'default' => '',
'description' => 'The message group this message belongs to. For example: warning, browser, user.',
],
'function' => [
'type' => 'varchar_ascii',
'length' => 255,
'not null' => TRUE,
'default' => '',
'description' => 'Name of the assertion function or method that created this message.',
],
'line' => [
'type' => 'int',
'not null' => TRUE,
'default' => 0,
'description' => 'Line number on which the function is called.',
],
'file' => [
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
'description' => 'Name of the file where the function is called.',
],
],
'primary key' => [
'message_id',
],
'indexes' => [
'reporter' => [
'test_class',
'message_id',
],
],
];
$schema['simpletest_test_id'] = [
'description' => 'Stores test IDs, used to auto-increment the test ID so that a fresh test ID is used.',
'fields' => [
'test_id' => [
'type' => 'serial',
'not null' => TRUE,
'description' => 'Primary Key: Unique test ID used to group test results together. Each time a set of tests
are run a new test ID is used.',
],
'last_prefix' => [
'type' => 'varchar',
'length' => 60,
'not null' => FALSE,
'default' => '',
'description' => 'The last database prefix used during testing.',
],
],
'primary key' => [
'test_id',
],
];
return $schema;
}