1
0
Fork 0
mirror of synced 2024-06-03 03:14:50 +12:00
appwrite/tests/extensions/TestHook.php
2024-03-06 18:34:21 +01:00

23 lines
525 B
PHP

<?php
namespace Appwrite\Tests;
use PHPUnit\Runner\AfterTestHook;
class TestHook implements AfterTestHook
{
protected const MAX_SECONDS_ALLOWED = 15;
public function executeAfterTest(string $test, float $time): void
{
printf(
"%s ended in %s milliseconds\n",
$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));
}
}
}