mirror of
https://github.com/pestphp/pest.git
synced 2026-03-07 00:07:22 +01:00
fix failure message
This commit is contained in:
@ -285,12 +285,13 @@ trait Testable
|
||||
$underlyingTest = Reflection::getFunctionVariable($this->__test, 'closure');
|
||||
$testReflection = new ReflectionFunction($underlyingTest);
|
||||
$requiredParametersCount = $testReflection->getNumberOfRequiredParameters();
|
||||
$suppliedParametersCount = count($arguments);
|
||||
|
||||
if (count($arguments) >= $requiredParametersCount) {
|
||||
if ($suppliedParametersCount >= $requiredParametersCount) {
|
||||
return;
|
||||
}
|
||||
|
||||
throw new DatasetArgsCountMismatch($this->dataName());
|
||||
throw new DatasetArgsCountMismatch($this->dataName(), $requiredParametersCount, $suppliedParametersCount);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -8,8 +8,8 @@ use Exception;
|
||||
|
||||
final class DatasetArgsCountMismatch extends Exception
|
||||
{
|
||||
public function __construct(string $dataName)
|
||||
public function __construct(string $dataName, int $requiredCount, int $suppliedCount)
|
||||
{
|
||||
parent::__construct(sprintf('Number of arguments mismatch between test and dataset [%s]', $dataName));
|
||||
parent::__construct(sprintf('Test expects %d arguments but dataset [%s] only provides %d', $requiredCount, $dataName, $suppliedCount));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user