function system_test_multiple_redirects

Menu callback; sends a redirect header to itself until $count argument is 0.

Emulates the variable number of redirects (given by initial $count argument) to the final destination URL by continuous sending of 301 HTTP redirect headers to itself together with decrementing the $count parameter until the $count parameter reaches 0. After that it returns an empty string to render the final destination page.

@returns The location redirect if the $count > 0, otherwise an empty string.

Parameters

$count: The count of redirects left until the final destination page.

1 string reference to 'system_test_multiple_redirects'
system_test_menu in drupal/modules/simpletest/tests/system_test.module
Implements hook_menu().

File

drupal/modules/simpletest/tests/system_test.module, line 197

Code

function system_test_multiple_redirects($count) {
  $count = (int) $count;
  if ($count > 0) {
    header("location: " . url('system-test/multiple-redirects/' . --$count, array(
      'absolute' => TRUE,
    )), TRUE, 301);
    exit;
  }
  return '';
}