public function invoke(Phake_IMock $mock, $method, array $arguments, array &$argumentReference) { $stub = null; if ($method == '__call') { $stub = $this->mockReader->getStubMapper($mock)->getStubByCall($arguments[0], $argumentReference[1]); } if ($stub === null) { $stub = $this->mockReader->getStubMapper($mock)->getStubByCall($method, $argumentReference); } if ($stub === null) { $answer = $this->mockReader->getDefaultAnswer($mock); } else { $answer = $stub->getAnswer(); } return $answer; }
public function testGetStubMapper() { $this->mock->__PHAKE_stubMapper = Phake::mock('Phake_Stubber_StubMapper'); $this->assertSame($this->mock->__PHAKE_stubMapper, $this->reader->getStubMapper($this->mock)); }
/** * Binds an answer to the the classes * * @param Phake_Stubber_IAnswer $answer * * @return Phake_Proxies_AnswerCollectionProxy */ public function bindAnswer(Phake_Stubber_IAnswer $answer) { $collection = new Phake_Stubber_AnswerCollection($answer); $this->mockReader->getStubMapper($this->obj)->mapStubToMatcher($collection, $this->matcher); return new Phake_Proxies_AnswerCollectionProxy($collection); }
/** * Resets the given $mock * * @param Phake_IMock $mock */ public function reset(Phake_IMock $mock) { $this->mockReader->setIsObjectFrozen($mock, false); $this->mockReader->getStubMapper($mock)->removeAllAnswers(); $this->mockReader->getCallRecorder($mock)->removeAllCalls(); }