Skip to content

Commit

Permalink
test(): checks count of arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
dg committed Mar 10, 2024
1 parent 328d7b6 commit 309dc19
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Framework/functions.php
Expand Up @@ -9,6 +9,10 @@

function test(string $description, Closure $closure): void
{
if (($count = func_num_args()) > 2) {
throw new \Exception(__FUNCTION__ . "() expects 2 parameter, $count given.");
}

if ($fn = (new ReflectionFunction('setUp'))->getStaticVariables()['fn']) {
$fn();
}
Expand Down

0 comments on commit 309dc19

Please sign in to comment.