1
0
Fork 0
mirror of synced 2024-10-03 02:37:40 +13:00

Merge pull request #5109 from appwrite/feat-slow-tests-hook

Feature slow test
This commit is contained in:
Eldad A. Fux 2023-02-13 13:56:15 +02:00 committed by GitHub
commit 00bad84d48
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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));
}
}
}