mirror of
https://github.com/pestphp/pest.git
synced 2026-03-06 07:47:22 +01:00
feat: adds covers
This commit is contained in:
@ -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",
|
||||
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user