function UrlAlterFunctionalTest::assertUrlOutboundAlter

Same name in other branches
  1. 7.x modules/simpletest/tests/path.test \UrlAlterFunctionalTest::assertUrlOutboundAlter()
  2. 9 core/modules/path_alias/tests/src/Functional/UrlAlterFunctionalTest.php \Drupal\Tests\path_alias\Functional\UrlAlterFunctionalTest::assertUrlOutboundAlter()
  3. 10 core/modules/path_alias/tests/src/Functional/UrlAlterFunctionalTest.php \Drupal\Tests\path_alias\Functional\UrlAlterFunctionalTest::assertUrlOutboundAlter()
  4. 10 core/modules/forum/tests/src/Functional/UrlAlterFunctionalTest.php \Drupal\Tests\forum\Functional\UrlAlterFunctionalTest::assertUrlOutboundAlter()
  5. 11.x core/modules/path_alias/tests/src/Functional/UrlAlterFunctionalTest.php \Drupal\Tests\path_alias\Functional\UrlAlterFunctionalTest::assertUrlOutboundAlter()
  6. 11.x core/modules/forum/tests/src/Functional/UrlAlterFunctionalTest.php \Drupal\Tests\forum\Functional\UrlAlterFunctionalTest::assertUrlOutboundAlter()

Assert that an outbound path is altered to an expected value.

Parameters

$original: A string with the original path that is run through generateFrommPath().

$final: A string with the expected result after generateFrommPath().

Return value

TRUE if $original was correctly altered to $final, FALSE otherwise.

1 call to UrlAlterFunctionalTest::assertUrlOutboundAlter()
UrlAlterFunctionalTest::testUrlAlter in core/modules/path_alias/tests/src/Functional/UrlAlterFunctionalTest.php
Test that URL altering works and that it occurs in the correct order.

File

core/modules/path_alias/tests/src/Functional/UrlAlterFunctionalTest.php, line 103

Class

UrlAlterFunctionalTest
Tests altering the inbound path and the outbound path.

Namespace

Drupal\Tests\path_alias\Functional

Code

protected function assertUrlOutboundAlter($original, $final) {
    // Test outbound altering.
    $result = $this->container
        ->get('path_processor_manager')
        ->processOutbound($original);
    return $this->assertIdentical($result, $final, new FormattableMarkup('Altered outbound URL %original, expected %final, and got %result.', [
        '%original' => $original,
        '%final' => $final,
        '%result' => $result,
    ]));
}

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