protected function PathRedirectTestHelper::assertRedirect in Path redirect 6
2 calls to PathRedirectTestHelper::assertRedirect()
- PathRedirectUnitTest::testRedirectQuerySorting in ./
path_redirect.test - Test the _path_redirect_uasort() callback used in path_redirect_load_by_source().
- PathRedirectUnitTest::testRedirects in ./
path_redirect.test
File
- ./
path_redirect.test, line 30 - Tests for the path_redirect module.
Class
- PathRedirectTestHelper
- @file Tests for the path_redirect module.
Code
protected function assertRedirect(array $redirect) {
$redirect += array(
'source_query' => array(),
'query' => array(),
'fragment' => NULL,
);
$this
->drupalHead($redirect['source'], array(
'query' => $redirect['source_query'],
));
$expected_url = url($redirect['redirect'], array(
'query' => $redirect['query'],
'fragment' => $redirect['fragment'],
'absolute' => TRUE,
));
$value = $this
->drupalGetHeader('location');
$this
->assertEqual($value, $expected_url, t('Redirected from !request to !redirect, expected !expected.', array(
'!request' => $this
->getUrl(),
'!redirect' => $value,
'!expected' => $expected_url,
)));
// Reload the redirect.
if (!empty($redirect['rid'])) {
return path_redirect_load($redirect['rid']);
}
}