function UrlAlterFunctionalTest::assertUrlOutboundAlter
Same name in other branches
- 9 core/modules/path_alias/tests/src/Functional/UrlAlterFunctionalTest.php \Drupal\Tests\path_alias\Functional\UrlAlterFunctionalTest::assertUrlOutboundAlter()
- 8.9.x core/modules/path_alias/tests/src/Functional/UrlAlterFunctionalTest.php \Drupal\Tests\path_alias\Functional\UrlAlterFunctionalTest::assertUrlOutboundAlter()
- 10 core/modules/path_alias/tests/src/Functional/UrlAlterFunctionalTest.php \Drupal\Tests\path_alias\Functional\UrlAlterFunctionalTest::assertUrlOutboundAlter()
- 10 core/modules/forum/tests/src/Functional/UrlAlterFunctionalTest.php \Drupal\Tests\forum\Functional\UrlAlterFunctionalTest::assertUrlOutboundAlter()
- 11.x core/modules/path_alias/tests/src/Functional/UrlAlterFunctionalTest.php \Drupal\Tests\path_alias\Functional\UrlAlterFunctionalTest::assertUrlOutboundAlter()
- 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 url().
$final: A string with the expected result after url().
Return value
TRUE if $original was correctly altered to $final, FALSE otherwise.
1 call to UrlAlterFunctionalTest::assertUrlOutboundAlter()
- UrlAlterFunctionalTest::testUrlAlter in modules/
simpletest/ tests/ path.test - Test that URL altering works and that it occurs in the correct order.
File
-
modules/
simpletest/ tests/ path.test, line 221
Class
- UrlAlterFunctionalTest
- Tests hook_url_alter functions.
Code
protected function assertUrlOutboundAlter($original, $final) {
// Test outbound altering.
$result = url($original);
$base_path = base_path() . (variable_get('clean_url', '0') ? '' : '?q=');
$result = substr($result, strlen($base_path));
$this->assertIdentical($result, $final, format_string('Altered outbound URL %original, expected %final, and got %result.', array(
'%original' => $original,
'%final' => $final,
'%result' => $result,
)));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.