function Matcher::verify
Throws
MethodNameNotConfiguredException
File
-
vendor/
phpunit/ phpunit/ src/ Framework/ MockObject/ Runtime/ Matcher.php, line 181
Class
- Matcher
- @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
Namespace
PHPUnit\Framework\MockObjectCode
public function verify() : void {
if ($this->methodNameRule === null) {
throw new MethodNameNotConfiguredException();
}
try {
$this->invocationRule
->verify();
if ($this->parametersRule === null) {
$this->parametersRule = new AnyParameters();
}
$invocationIsAny = $this->invocationRule instanceof AnyInvokedCount;
$invocationIsNever = $this->invocationRule instanceof InvokedCount && $this->invocationRule
->isNever();
$invocationIsAtMost = $this->invocationRule instanceof InvokedAtMostCount;
if (!$invocationIsAny && !$invocationIsNever && !$invocationIsAtMost) {
$this->parametersRule
->verify();
}
} catch (ExpectationFailedException $e) {
throw new ExpectationFailedException(sprintf("Expectation failed for %s when %s.\n%s", $this->methodNameRule
->toString(), $this->invocationRule
->toString(), ThrowableToStringMapper::map($e)));
}
}