Fichier
-
tests/
src/ Kernel/ SubPathautoKernelTest.php, line 65
Classe
- SubPathautoKernelTest
- @coversDefaultClass \Drupal\subpathauto\PathProcessor @group subpathauto
Namespace
Drupal\Tests\subpathauto\KernelCode
protected function setUp() : void {
parent::setUp();
$this->installSchema('system', 'sequences');
$this->installEntitySchema('user');
$this->installEntitySchema('node');
$this->installEntitySchema('path_alias');
$this->installEntitySchema('redirect');
$this->installConfig('subpathauto');
$this->installConfig('filter');
$this->installConfig('language');
// Redirect module can create automatically a redirect when the alias
// changes. The old alias redirects back to the internal path and path_alias
// modules resolved this to the new alias.
\Drupal::configFactory()->getEditable('redirect.settings')
->set('auto_redirect', TRUE)
->save();
// Create the node bundles required for testing.
NodeType::create([
'type' => 'page',
'name' => 'page',
])->save();
$this->pathAliasStorage = \Drupal::entityTypeManager()->getStorage('path_alias');
$this->redirectStorage = \Drupal::entityTypeManager()->getStorage('redirect');
$this->pathProcessor = $this->container
->get('path_processor_subpathauto');
$this->container
->get('path_alias.whitelist')
->set('node', TRUE);
User::create([
'uid' => 0,
'name' => 'anonymous user',
])->save();
// Set for default language prefix default_language.
$this->config('language.negotiation')
->set('url.source', LanguageNegotiationUrl::CONFIG_PATH_PREFIX)
->set('url.prefixes', [
'en' => 'default_language',
])
->save();
}