1 system_test.module | system_test_sleep($seconds, $sleep_at_shutdown = FALSE) |
Menu callback; Delay the return of a response, simulating a heavy page.
Parameters
$seconds: The number of seconds to wait before returning the response.
bool $sleep_at_shutdown: Instead of waiting immediately, return a response and wait at shutdown.
Return value
string: A message indicating the amount of time slept.
File
- core/
modules/ simpletest/ tests/ system_test.module, line 168 - Test module for system functions.
Code
function system_test_sleep($seconds, $sleep_at_shutdown = FALSE) {
$output = '<div id="start">' . microtime(TRUE) . '</div>';
if ($sleep_at_shutdown) {
register_shutdown_function('system_test_sleep', $seconds);
$output .= format_string('@time seconds will be slept at shutdown.', array('@time' => $seconds)) . ' ';
}
else {
sleep($seconds);
$output .= format_string('Slept for @time seconds.', array('@time' => $seconds)) . ' ';
}
$output .= '<div id="end">' . microtime(TRUE) . '</div>';
return $output;
}