public function PHPUnit_Framework_MockObject_Stub_ReturnValueMap::invoke

Fakes the processing of the invocation $invocation by returning a specific value.

Parameters

PHPUnit_Framework_MockObject_Invocation $invocation: The invocation which was mocked and matched by the current method and argument matchers.

Return value

mixed

Overrides PHPUnit_Framework_MockObject_Stub::invoke

File

drupal/core/vendor/phpunit/phpunit-mock-objects/PHPUnit/Framework/MockObject/Stub/ReturnValueMap.php, line 65

Class

PHPUnit_Framework_MockObject_Stub_ReturnValueMap
Stubs a method by returning a value from a map.

Code

public function invoke(PHPUnit_Framework_MockObject_Invocation $invocation) {
  $parameterCount = count($invocation->parameters);
  foreach ($this->valueMap as $map) {
    if (!is_array($map) || $parameterCount != count($map) - 1) {
      continue;
    }
    $return = array_pop($map);
    if ($invocation->parameters === $map) {
      return $return;
    }
  }
  return NULL;
}