function SimpletestTestRunResultsStorage::testingResultsSchema

Same name in other branches
  1. 10 core/lib/Drupal/Core/Test/SimpletestTestRunResultsStorage.php \Drupal\Core\Test\SimpletestTestRunResultsStorage::testingResultsSchema()

Defines the database schema for run-tests.sh and simpletest module.

Return value

array Array suitable for use in a hook_schema() implementation.

1 call to SimpletestTestRunResultsStorage::testingResultsSchema()
SimpletestTestRunResultsStorage::buildTestingResultsEnvironment in core/lib/Drupal/Core/Test/SimpletestTestRunResultsStorage.php
Prepares the test run storage.

File

core/lib/Drupal/Core/Test/SimpletestTestRunResultsStorage.php, line 184

Class

SimpletestTestRunResultsStorage
Implements a test run results storage compatible with legacy Simpletest.

Namespace

Drupal\Core\Test

Code

public static function testingResultsSchema() : array {
    $schema['simpletest'] = [
        'description' => 'Stores simpletest messages',
        'fields' => [
            'message_id' => [
                'type' => 'serial',
                'not null' => TRUE,
                'description' => 'Primary Key: Unique simpletest 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 simpletest 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 simpletest 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;
}

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