function RoutingFixtures::createTables

Same name in other branches
  1. 8.9.x core/tests/Drupal/Tests/Core/Routing/RoutingFixtures.php \Drupal\Tests\Core\Routing\RoutingFixtures::createTables()
  2. 10 core/tests/Drupal/Tests/Core/Routing/RoutingFixtures.php \Drupal\Tests\Core\Routing\RoutingFixtures::createTables()
  3. 11.x core/tests/Drupal/Tests/Core/Routing/RoutingFixtures.php \Drupal\Tests\Core\Routing\RoutingFixtures::createTables()

Create the tables required for the sample data.

Parameters

\Drupal\Core\Database\Connection $connection: The connection to use to create the tables.

File

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

Class

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

Namespace

Drupal\Tests\Core\Routing

Code

public function createTables(Connection $connection) {
    $tables = $this->routingTableDefinition();
    $schema = $connection->schema();
    foreach ($tables as $name => $table) {
        $schema->dropTable($name);
        $schema->createTable($name, $table);
    }
}

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