1 <?php declare(strict_types=1);
45 $this->expectException(\RuntimeException::class);
46 $this->expectExceptionMessage(
"Execution of callback exceeded the given duration and could not be stretched.");
47 $duration->stretch($callback);
55 $start_time = microtime(
true);
56 $duration->stretch($callback);
57 $end_time = microtime(
true);
59 $elapsed_time = ($end_time - $start_time);
60 $expected_duration_in_us = (0.002);
62 $this->assertGreaterThanOrEqual($expected_duration_in_us, ($end_time - $start_time));
67 return static function () use ($duration_in_ms, $should_halt) {
68 usleep(1_000 * $duration_in_ms);
testCallbackStretchingWithTooLongExecutionTime()
getTestCallbackWithLength(int $duration_in_ms, bool $should_halt=false)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...