function AliasPathProcessorTest::testProcessInbound

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::testProcessInbound()
  2. 8.9.x core/modules/path_alias/tests/src/Unit/PathProcessor/AliasPathProcessorTest.php \Drupal\Tests\path_alias\Unit\PathProcessor\AliasPathProcessorTest::testProcessInbound()
  3. 10 core/modules/path_alias/tests/src/Unit/PathProcessor/AliasPathProcessorTest.php \Drupal\Tests\path_alias\Unit\PathProcessor\AliasPathProcessorTest::testProcessInbound()

Tests the processInbound method.

See also

\Drupal\path_alias\PathProcessor\AliasPathProcessor::processInbound

File

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

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 testProcessInbound() : void {
    $this->aliasManager
        ->expects($this->exactly(2))
        ->method('getPathByAlias')
        ->willReturnMap([
        [
            'url-alias',
            NULL,
            'internal-url',
        ],
        [
            'url',
            NULL,
            'url',
        ],
    ]);
    $request = Request::create('/url-alias');
    $this->assertEquals('internal-url', $this->pathProcessor
        ->processInbound('url-alias', $request));
    $request = Request::create('/url');
    $this->assertEquals('url', $this->pathProcessor
        ->processInbound('url', $request));
}

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