function AliasPathProcessorTest::testProcessOutbound

Same name and namespace in other branches
  1. 9 core/modules/path_alias/tests/src/Unit/PathProcessor/AliasPathProcessorTest.php \Drupal\Tests\path_alias\Unit\PathProcessor\AliasPathProcessorTest::testProcessOutbound()
  2. 8.9.x core/modules/path_alias/tests/src/Unit/PathProcessor/AliasPathProcessorTest.php \Drupal\Tests\path_alias\Unit\PathProcessor\AliasPathProcessorTest::testProcessOutbound()
  3. 10 core/modules/path_alias/tests/src/Unit/PathProcessor/AliasPathProcessorTest.php \Drupal\Tests\path_alias\Unit\PathProcessor\AliasPathProcessorTest::testProcessOutbound()

@covers ::processOutbound

@dataProvider providerTestProcessOutbound

File

core/modules/path_alias/tests/src/Unit/PathProcessor/AliasPathProcessorTest.php, line 68

Class

AliasPathProcessorTest
@coversDefaultClass <a href="/api/drupal/core%21modules%21path_alias%21src%21PathProcessor%21AliasPathProcessor.php/class/AliasPathProcessor/11.x" title="Processes the inbound path using path alias lookups." class="local">\Drupal\path_alias\PathProcessor\AliasPathProcessor</a> @group PathProcessor @group path_alias

Namespace

Drupal\Tests\path_alias\Unit\PathProcessor

Code

public function testProcessOutbound($path, array $options, $expected_path) : void {
    $this->aliasManager
        ->expects($this->any())
        ->method('getAliasByPath')
        ->willReturnMap([
        [
            'internal-url',
            NULL,
            'url-alias',
        ],
        [
            'url',
            NULL,
            'url',
        ],
    ]);
    $bubbleable_metadata = new BubbleableMetadata();
    $this->assertEquals($expected_path, $this->pathProcessor
        ->processOutbound($path, $options, NULL, $bubbleable_metadata));
    // Cacheability of paths replaced with path aliases is permanent.
    // @todo https://www.drupal.org/node/2480077
    $this->assertEquals((new BubbleableMetadata())->setCacheMaxAge(Cache::PERMANENT), $bubbleable_metadata);
}

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