public function QueryParametersToURLTestCase::testRedirectWithQueryParameters in Query Parameters To URL 7
Tests if a path with query parameters gets redirected to the clean path.
1 method overrides QueryParametersToURLTestCase::testRedirectWithQueryParameters()
- QueryParametersToURLGlobalRedirectTestCase::testRedirectWithQueryParameters in ./
query_parameters_to_url.test - Tests if a path with query parameters gets redirected to the clean path.
File
- ./
query_parameters_to_url.test, line 73 - Query Arguments To URL tests.
Class
- QueryParametersToURLTestCase
- General test cases.
Code
public function testRedirectWithQueryParameters() {
$this
->pass('Test redirecting to clean url when url has query parameters.');
$test_cases = $this
->pathsToTest();
foreach ($test_cases as $test_case) {
list($path, $options, $expected_path) = $this
->unpackTestCase($test_case);
// Make sure they are absolute URLs.
$path = $this
->createRawUrl($path, $options);
$expected_path = $this
->createRawUrl($expected_path, array());
// Make HEAD request and check the headers.
$this
->drupalHeadRawURL($path);
$headers = $this
->drupalGetHeaders(TRUE);
$result = array(
'!initial_path' => $path,
'!expected_status' => '302',
'!expected_path' => $expected_path,
'!actual_path' => isset($headers[0]['location']) ? $headers[0]['location'] : 'N/A',
'!actual_status' => $headers[0][':status'],
);
$this
->assertStatusAndPath($result);
}
}