You are here

public function PathProcessorAliasTest::testProcessOutbound in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/tests/Drupal/Tests/Core/PathProcessor/PathProcessorAliasTest.php \Drupal\Tests\Core\PathProcessor\PathProcessorAliasTest::testProcessOutbound()

@covers ::processOutbound

@dataProvider providerTestProcessOutbound

File

core/tests/Drupal/Tests/Core/PathProcessor/PathProcessorAliasTest.php, line 65
Contains \Drupal\Tests\Core\PathProcessor\PathProcessorAliasTest.

Class

PathProcessorAliasTest
@coversDefaultClass \Drupal\Core\PathProcessor\PathProcessorAlias @group PathProcessor

Namespace

Drupal\Tests\Core\PathProcessor

Code

public function testProcessOutbound($path, array $options, $expected_path) {
  $this->aliasManager
    ->expects($this
    ->any())
    ->method('getAliasByPath')
    ->will($this
    ->returnValueMap(array(
    array(
      'internal-url',
      NULL,
      'urlalias',
    ),
    array(
      '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);
}