You are here

public static function ViewTestData::schemaDefinition in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/views/src/Tests/ViewTestData.php \Drupal\views\Tests\ViewTestData::schemaDefinition()

Returns the schema definition.

@internal

6 calls to ViewTestData::schemaDefinition()
PreviewTest::schemaDefinition in core/modules/views_ui/tests/src/FunctionalJavascript/PreviewTest.php
Returns the schema definition.
ViewKernelTestBase::schemaDefinition in core/modules/views/src/Tests/ViewKernelTestBase.php
Returns the schema definition.
views-data-table-dependency.php in core/modules/views/tests/fixtures/update/views-data-table-dependency.php
Contains database additions to drupal-8.bare.standard.php.gz for testing views_post_update_views_data_table_dependencies().
ViewsKernelTestBase::schemaDefinition in core/modules/views/tests/src/Kernel/ViewsKernelTestBase.php
Returns the schema definition.
ViewTestBase::schemaDefinition in core/modules/views/src/Tests/ViewTestBase.php
Returns the schema definition.

... See full list

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;
}