UrlAliasFixtures.php in Zircon Profile 8.0
File
core/modules/system/src/Tests/Path/UrlAliasFixtures.php
View source
<?php
namespace Drupal\system\Tests\Path;
use Drupal\Core\Database\Connection;
class UrlAliasFixtures {
public function createTables(Connection $connection) {
$tables = $this
->tableDefinition();
$schema = $connection
->schema();
foreach ($tables as $name => $table) {
$schema
->dropTable($name);
$schema
->createTable($name, $table);
}
}
public function dropTables(Connection $connection) {
$tables = $this
->tableDefinition();
$schema = $connection
->schema();
foreach ($tables as $name => $table) {
$schema
->dropTable($name);
}
}
public function sampleUrlAliases() {
return array(
array(
'source' => '/node/1',
'alias' => '/alias_for_node_1_en',
'langcode' => 'en',
),
array(
'source' => '/node/2',
'alias' => '/alias_for_node_2_en',
'langcode' => 'en',
),
array(
'source' => '/node/1',
'alias' => '/alias_for_node_1_fr',
'langcode' => 'fr',
),
array(
'source' => '/node/1',
'alias' => '/alias_for_node_1_und',
'langcode' => 'und',
),
);
}
public function tableDefinition() {
$tables = array();
drupal_get_filename('module', 'system', 'core/modules/system/system.info.yml');
module_load_install('system');
$schema = system_schema();
$tables['url_alias'] = $schema['url_alias'];
$tables['key_value'] = $schema['key_value'];
return $tables;
}
}
Classes
Name |
Description |
UrlAliasFixtures |
Utility methods to generate sample data, database configuration, etc. |