You are here

public function RoutingFixtures::routingTableDefinition in Drupal 9

Same name and namespace in other branches
  1. 8 core/tests/Drupal/Tests/Core/Routing/RoutingFixtures.php \Drupal\Tests\Core\Routing\RoutingFixtures::routingTableDefinition()

Returns the table definition for the routing fixtures.

Return value

array Table definitions.

2 calls to RoutingFixtures::routingTableDefinition()
RoutingFixtures::createTables in core/tests/Drupal/Tests/Core/Routing/RoutingFixtures.php
Create the tables required for the sample data.
RoutingFixtures::dropTables in core/tests/Drupal/Tests/Core/Routing/RoutingFixtures.php
Drop the tables used for the sample data.

File

core/tests/Drupal/Tests/Core/Routing/RoutingFixtures.php, line 240

Class

RoutingFixtures
Utility methods to generate sample data, database configuration, etc.

Namespace

Drupal\Tests\Core\Routing

Code

public function routingTableDefinition() {
  $tables['test_routes'] = [
    'description' => 'Maps paths to various callbacks (access, page and title)',
    'fields' => [
      'name' => [
        'description' => 'Primary Key: Machine name of this route',
        'type' => 'varchar_ascii',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ],
      'path' => [
        'description' => 'The path for this URI',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ],
      'pattern_outline' => [
        'description' => 'The pattern',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ],
      'provider' => [
        'description' => 'The provider grouping to which a route belongs.',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ],
      'access_callback' => [
        'description' => 'The callback which determines the access to this router path. Defaults to \\Drupal\\Core\\Session\\AccountInterface::hasPermission.',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ],
      'access_arguments' => [
        'description' => 'A serialized array of arguments for the access callback.',
        'type' => 'blob',
        'not null' => FALSE,
      ],
      'fit' => [
        'description' => 'A numeric representation of how specific the path is.',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ],
      'number_parts' => [
        'description' => 'Number of parts in this router path.',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
        'size' => 'small',
      ],
      'route' => [
        'description' => 'A serialized Route object',
        'type' => 'text',
      ],
    ],
    'indexes' => [
      'fit' => [
        'fit',
      ],
      'pattern_outline' => [
        'pattern_outline',
      ],
      'provider' => [
        'provider',
      ],
    ],
    'primary key' => [
      'name',
    ],
  ];
  return $tables;
}