From 65f74f620c8d7d422f9f0993a358099edacffb7b Mon Sep 17 00:00:00 2001 From: Nuno Maduro Date: Thu, 5 Sep 2024 00:10:29 +0100 Subject: [PATCH] feat: adds covers --- composer.json | 2 +- src/Functions.php | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index e7022bf8..94381b80 100644 --- a/composer.json +++ b/composer.json @@ -18,7 +18,7 @@ ], "require": { "php": "^8.2.0", - "brianium/paratest": "^7.5.3", + "brianium/paratest": "^7.5.4", "nunomaduro/collision": "^8.4.0", "nunomaduro/termwind": "^2.0.1", "pestphp/pest-plugin": "^3.0.0", diff --git a/src/Functions.php b/src/Functions.php index bcf4141b..c1fc766e 100644 --- a/src/Functions.php +++ b/src/Functions.php @@ -211,3 +211,16 @@ if (! function_exists('afterAll')) { TestSuite::getInstance()->afterAll->set($closure); } } + +if (! function_exists('covers')) { + /** + * Specifies which classes, or functions, a test method covers. + */ + function covers(string ...$classesOrFunctions): void + { + $filename = Backtrace::file(); + + (new BeforeEachCall(TestSuite::getInstance(), $filename)) + ->covers(...$classesOrFunctions); + } +}