You are here

public function SubPathautoFunctionalTest::setUp in Sub-pathauto (Sub-path URL Aliases) 8

Overrides BrowserTestBase::setUp

File

tests/src/Functional/SubPathautoFunctionalTest.php, line 35

Class

SubPathautoFunctionalTest
Class SubPathautoFunctionalTest.

Namespace

Drupal\Tests\subpathauto\Functional

Code

public function setUp() {
  parent::setUp();
  $this
    ->drupalPlaceBlock('local_tasks_block');
  $this
    ->drupalCreateContentType([
    'type' => 'page',
    'name' => 'Basic page',
  ]);
  $this
    ->drupalCreateNode();
  ConfigurableLanguage::create([
    'id' => 'fi',
  ])
    ->save();

  // In order to reflect the changes for a multilingual site in the container
  // we have to rebuild it.
  $this
    ->rebuildContainer();
  $aliasStorage = \Drupal::entityTypeManager()
    ->getStorage('path_alias');
  $path_alias = $aliasStorage
    ->create([
    'path' => '/node/1',
    'alias' => '/kittens',
  ]);
  $path_alias
    ->save();
  $alias_white_list = $this->container
    ->get('path_alias.whitelist');
  $alias_white_list
    ->set('node', TRUE);
  $admin_user = $this
    ->drupalCreateUser([
    'bypass node access',
  ]);
  $this
    ->drupalLogin($admin_user);
}