You are here

private function PHPUnit_Framework_MockObject_Matcher_ConsecutiveParameters::verifyInvocation in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/phpunit/phpunit-mock-objects/src/Framework/MockObject/Matcher/ConsecutiveParameters.php \PHPUnit_Framework_MockObject_Matcher_ConsecutiveParameters::verifyInvocation()

Verify a single invocation

Parameters

PHPUnit_Framework_MockObject_Invocation $invocation:

int $callIndex:

Throws

PHPUnit_Framework_ExpectationFailedException

2 calls to PHPUnit_Framework_MockObject_Matcher_ConsecutiveParameters::verifyInvocation()
PHPUnit_Framework_MockObject_Matcher_ConsecutiveParameters::matches in vendor/phpunit/phpunit-mock-objects/src/Framework/MockObject/Matcher/ConsecutiveParameters.php
PHPUnit_Framework_MockObject_Matcher_ConsecutiveParameters::verify in vendor/phpunit/phpunit-mock-objects/src/Framework/MockObject/Matcher/ConsecutiveParameters.php
Checks if the invocation $invocation matches the current rules. If it does the matcher will get the invoked() method called which should check if an expectation is met.

File

vendor/phpunit/phpunit-mock-objects/src/Framework/MockObject/Matcher/ConsecutiveParameters.php, line 85

Class

PHPUnit_Framework_MockObject_Matcher_ConsecutiveParameters
Invocation matcher which looks for sets of specific parameters in the invocations.

Code

private function verifyInvocation(PHPUnit_Framework_MockObject_Invocation $invocation, $callIndex) {
  if (isset($this->_parameterGroups[$callIndex])) {
    $parameters = $this->_parameterGroups[$callIndex];
  }
  else {

    // no parameter assertion for this call index
    return;
  }
  if ($invocation === null) {
    throw new PHPUnit_Framework_ExpectationFailedException('Mocked method does not exist.');
  }
  if (count($invocation->parameters) < count($parameters)) {
    throw new PHPUnit_Framework_ExpectationFailedException(sprintf('Parameter count for invocation %s is too low.', $invocation
      ->toString()));
  }
  foreach ($parameters as $i => $parameter) {
    $parameter
      ->evaluate($invocation->parameters[$i], sprintf('Parameter %s for invocation #%d %s does not match expected ' . 'value.', $i, $callIndex, $invocation
      ->toString()));
  }
}