function InvokedCount::invokedDo
Throws
Overrides InvocationOrder::invokedDo
File
-
vendor/
phpunit/ phpunit/ src/ Framework/ MockObject/ Runtime/ Rule/ InvokedCount.php, line 75
Class
- InvokedCount
- @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
Namespace
PHPUnit\Framework\MockObject\RuleCode
protected function invokedDo(BaseInvocation $invocation) : void {
$count = $this->numberOfInvocations();
if ($count > $this->expectedCount) {
$message = $invocation->toString() . ' ';
$message .= match ($this->expectedCount) { 0 => 'was not expected to be called.',
1 => 'was not expected to be called more than once.',
default => sprintf('was not expected to be called more than %d times.', $this->expectedCount),
};
throw new ExpectationFailedException($message);
}
}