Skip to content
Snippets Groups Projects
Commit f55ab1af authored by Larry Garfield's avatar Larry Garfield Committed by Alex Bronstein
Browse files

Move more fixture logic to the fixture class.

parent 40e55319
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
......@@ -126,7 +126,7 @@ public function testDump() {
$dumper->addRoutes($collection);
$this->prepareTables($connection);
$this->fixtures->createTables($connection);
$dumper->dump(array('route_set' => 'test'));
......@@ -141,18 +141,4 @@ public function testDump() {
$this->assertTrue($loaded_route instanceof Route, t('Route object retrieved successfully.'));
}
/**
* Creates a test database table just for unit testing purposes.
*/
protected function prepareTables($connection) {
$tables = $this->fixtures->routingTableDefinition();
$schema = $connection->schema();
foreach ($tables as $name => $table) {
$schema->dropTable($name);
$schema->createTable($name, $table);
}
}
}
......@@ -41,6 +41,12 @@ function __construct($test_id = NULL) {
$this->fixtures = new RoutingFixtures();
}
public function tearDown() {
$this->fixtures->dropTables(Database::getConnection());
parent::tearDown();
}
/**
* Confirms that the correct candidate outlines are generated.
*/
......
......@@ -5,11 +5,33 @@
use Symfony\Component\Routing\Route;
use Symfony\Component\Routing\RouteCollection;
use Drupal\Core\Database\Connection;
/**
* Utility methods to generate sample data, database configuration, etc.
*/
class RoutingFixtures {
public function createTables(Connection $connection) {
$tables = $this->routingTableDefinition();
$schema = $connection->schema();
foreach ($tables as $name => $table) {
$schema->dropTable($name);
$schema->createTable($name, $table);
}
}
public function dropTables(Connection $connection) {
$tables = $this->routingTableDefinition();
$schema = $connection->schema();
foreach ($tables as $name => $table) {
$schema->dropTable($name);
}
}
/**
* Returns a standard set of routes for testing.
*
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment