You are here

public static function ViewTestData::schemaDefinition in Drupal 9

Same name and namespace in other branches
  1. 8 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,
      ],
      '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;
}