function ViewTestData::schemaDefinition

Same name in other branches
  1. 9 core/modules/views/src/Tests/ViewTestData.php \Drupal\views\Tests\ViewTestData::schemaDefinition()
  2. 8.9.x core/modules/views/src/Tests/ViewTestData.php \Drupal\views\Tests\ViewTestData::schemaDefinition()
  3. 11.x core/modules/views/src/Tests/ViewTestData.php \Drupal\views\Tests\ViewTestData::schemaDefinition()

Returns the schema definition.

@internal

3 calls to ViewTestData::schemaDefinition()
PreviewTest::schemaDefinition in core/modules/views_ui/tests/src/FunctionalJavascript/PreviewTest.php
Returns the schema definition.
ViewsKernelTestBase::schemaDefinition in core/modules/views/tests/src/Kernel/ViewsKernelTestBase.php
Returns the schema definition.
ViewTestBase::schemaDefinition in core/modules/views/tests/src/Functional/ViewTestBase.php
Returns the schema definition.

File

core/modules/views/src/Tests/ViewTestData.php, line 64

Class

ViewTestData
Provides tests view data and the base test schema with sample data records.

Namespace

Drupal\views\Tests

Code

public static function schemaDefinition() {
    $schema['views_test_data'] = [
        'description' => 'Basic test table for Views tests.',
        'fields' => [
            'id' => [
                'type' => 'serial',
                'unsigned' => TRUE,
                'not null' => TRUE,
            ],
            'name' => [
                'description' => "A person's name",
                'type' => 'varchar_ascii',
                'length' => 255,
                'not null' => TRUE,
                'default' => '',
            ],
            'age' => [
                'description' => "The person's age",
                'type' => 'int',
                'unsigned' => TRUE,
                'not null' => TRUE,
                'default' => 0,
            ],
            'job' => [
                'description' => "The person's job",
                'type' => 'varchar',
                'length' => 255,
                'not null' => TRUE,
                'default' => 'Undefined',
            ],
            'created' => [
                'description' => "The creation date of this record",
                'type' => 'int',
                'unsigned' => TRUE,
                'not null' => TRUE,
                'default' => 0,
                'size' => 'big',
            ],
            'status' => [
                'description' => "The status of this record",
                'type' => 'int',
                'unsigned' => TRUE,
                'not null' => TRUE,
                'default' => 0,
            ],
        ],
        'primary key' => [
            'id',
        ],
        'unique keys' => [
            'name' => [
                'name',
            ],
        ],
        'indexes' => [
            'ages' => [
                'age',
            ],
        ],
    ];
    return $schema;
}

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