3 * This file is part of the PHPUnit_MockObject package.
5 * (c) Sebastian Bergmann <sebastian@phpunit.de>
7 * For the full copyright and license information, please view the LICENSE
8 * file that was distributed with this source code.
11 use SebastianBergmann\Exporter\Exporter;
14 * Stubs a method by returning a user-defined stack of values.
16 * @since Class available since Release 1.0.0
18 class PHPUnit_Framework_MockObject_Stub_ConsecutiveCalls implements PHPUnit_Framework_MockObject_Stub
23 public function __construct($stack)
25 $this->stack = $stack;
28 public function invoke(PHPUnit_Framework_MockObject_Invocation $invocation)
30 $this->value = array_shift($this->stack);
32 if ($this->value instanceof PHPUnit_Framework_MockObject_Stub) {
33 $this->value = $this->value->invoke($invocation);
39 public function toString()
41 $exporter = new Exporter;
44 'return user-specified value %s',
45 $exporter->export($this->value)