function RequestPathTest::setUp

Same name and namespace in other branches
  1. 9 core/tests/Drupal/KernelTests/Core/Plugin/Condition/RequestPathTest.php \Drupal\KernelTests\Core\Plugin\Condition\RequestPathTest::setUp()
  2. 8.9.x core/tests/Drupal/KernelTests/Core/Plugin/Condition/RequestPathTest.php \Drupal\KernelTests\Core\Plugin\Condition\RequestPathTest::setUp()
  3. 10 core/tests/Drupal/KernelTests/Core/Plugin/Condition/RequestPathTest.php \Drupal\KernelTests\Core\Plugin\Condition\RequestPathTest::setUp()

Overrides KernelTestBase::setUp

File

core/tests/Drupal/KernelTests/Core/Plugin/Condition/RequestPathTest.php, line 60

Class

RequestPathTest
Tests system.module's request path condition.

Namespace

Drupal\KernelTests\Core\Plugin\Condition

Code

protected function setUp() : void {
    parent::setUp();
    $this->installConfig('system');
    $this->pluginManager = $this->container
        ->get('plugin.manager.condition');
    // Set a mock alias manager in the container.
    $this->aliasManager = new MockAliasManager();
    $this->container
        ->set('path_alias.manager', $this->aliasManager);
    // Set the test request stack in the container.
    $this->requestStack = new RequestStack();
    $this->container
        ->set('request_stack', $this->requestStack);
    $this->currentPath = new CurrentPathStack($this->requestStack);
    $this->container
        ->set('path.current', $this->currentPath);
}

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