You are here

public function PHPUnit_Framework_MockObject_Stub_ConsecutiveCalls::invoke in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/phpunit/phpunit-mock-objects/src/Framework/MockObject/Stub/ConsecutiveCalls.php \PHPUnit_Framework_MockObject_Stub_ConsecutiveCalls::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

vendor/phpunit/phpunit-mock-objects/src/Framework/MockObject/Stub/ConsecutiveCalls.php, line 28

Class

PHPUnit_Framework_MockObject_Stub_ConsecutiveCalls
Stubs a method by returning a user-defined stack of values.

Code

public function invoke(PHPUnit_Framework_MockObject_Invocation $invocation) {
  $this->value = array_shift($this->stack);
  if ($this->value instanceof PHPUnit_Framework_MockObject_Stub) {
    $this->value = $this->value
      ->invoke($invocation);
  }
  return $this->value;
}