From bff39aea081e183b85245137764db533ddbcc53d Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Mon, 13 Feb 2023 05:55:11 +0000 Subject: [PATCH 1/4] slow test in stderr --- tests/extensions/TestHook.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/extensions/TestHook.php b/tests/extensions/TestHook.php index c23f258a00..dd67d5134a 100644 --- a/tests/extensions/TestHook.php +++ b/tests/extensions/TestHook.php @@ -3,9 +3,11 @@ namespace Appwrite\Tests; use PHPUnit\Runner\AfterTestHook; +use Exception; class TestHook implements AfterTestHook { + protected const MAX_SECONDS_ALLOWED = 3; 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(STDERR, sprintf("\nThe %s test is slow, it took %s seconds!\n", $test, $time)); + } } } From 0045eefd1eaea25a5cbd8686a9325b02dc895c4f Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Mon, 13 Feb 2023 06:02:20 +0000 Subject: [PATCH 2/4] slow period --- tests/extensions/TestHook.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/extensions/TestHook.php b/tests/extensions/TestHook.php index dd67d5134a..0084cc6aaa 100644 --- a/tests/extensions/TestHook.php +++ b/tests/extensions/TestHook.php @@ -7,7 +7,7 @@ use Exception; class TestHook implements AfterTestHook { - protected const MAX_SECONDS_ALLOWED = 3; + protected const MAX_SECONDS_ALLOWED = 15; public function executeAfterTest(string $test, float $time): void { printf( From da873b287666880e93d456823676c9be5f0884a3 Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Mon, 13 Feb 2023 06:24:22 +0000 Subject: [PATCH 3/4] fix colored output --- tests/extensions/TestHook.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/extensions/TestHook.php b/tests/extensions/TestHook.php index 0084cc6aaa..2c2ba937bd 100644 --- a/tests/extensions/TestHook.php +++ b/tests/extensions/TestHook.php @@ -17,7 +17,7 @@ class TestHook implements AfterTestHook ); if($time > self::MAX_SECONDS_ALLOWED) { - fwrite(STDERR, sprintf("\nThe %s test is slow, it took %s seconds!\n", $test, $time)); + fwrite(STDOUT, sprintf("\e[31mThe %s test is slow, it took %s seconds!\n\e[0m", $test, $time)); } } } From 488d3ec7e8e5e804010b2ad5f06320bf18d4a7f9 Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Mon, 13 Feb 2023 06:26:36 +0000 Subject: [PATCH 4/4] fix lint error --- tests/extensions/TestHook.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/extensions/TestHook.php b/tests/extensions/TestHook.php index 2c2ba937bd..67c1215c4c 100644 --- a/tests/extensions/TestHook.php +++ b/tests/extensions/TestHook.php @@ -16,7 +16,7 @@ class TestHook implements AfterTestHook $time * 1000 ); - if($time > self::MAX_SECONDS_ALLOWED) { + if ($time > self::MAX_SECONDS_ALLOWED) { fwrite(STDOUT, sprintf("\e[31mThe %s test is slow, it took %s seconds!\n\e[0m", $test, $time)); } }