Merge pull request #5109 from appwrite/feat-slow-tests-hook
Feature slow test
This commit is contained in:
commit
00bad84d48
1 changed files with 6 additions and 0 deletions
|
@ -3,9 +3,11 @@
|
|||
namespace Appwrite\Tests;
|
||||
|
||||
use PHPUnit\Runner\AfterTestHook;
|
||||
use Exception;
|
||||
|
||||
class TestHook implements AfterTestHook
|
||||
{
|
||||
protected const MAX_SECONDS_ALLOWED = 15;
|
||||
public function executeAfterTest(string $test, float $time): void
|
||||
{
|
||||
printf(
|
||||
|
@ -13,5 +15,9 @@ class TestHook implements AfterTestHook
|
|||
$test,
|
||||
$time * 1000
|
||||
);
|
||||
|
||||
if ($time > self::MAX_SECONDS_ALLOWED) {
|
||||
fwrite(STDOUT, sprintf("\e[31mThe %s test is slow, it took %s seconds!\n\e[0m", $test, $time));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue