1 path.test protected UrlAlterFunctionalTest::assertUrlOutboundAlter($original, $final)

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.:

File

core/modules/simpletest/tests/path.test, line 194
Tests for path.inc.

Class

UrlAlterFunctionalTest
Tests hook_url_alter functions.

Code

protected function assertUrlOutboundAlter($original, $final) {
  // Test outbound altering.
  $result = url($original);
  $base_path = base_path() . (config_get('system.core', 'clean_url') ? '' : '?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)));
}