示例#1
0
 public function invoke($mock, $method, array $arguments, array &$argumentReference)
 {
     $stub = null;
     if ($method == '__call' || $method == '__callStatic') {
         $stub = $this->stubMapper->getStubByCall($arguments[0], $argumentReference[1]);
     }
     if ($stub === null) {
         $stub = $this->stubMapper->getStubByCall($method, $argumentReference);
     }
     if ($stub === null) {
         $answer = $this->defaultAnswer;
     } else {
         $answer = $stub->getAnswer();
     }
     return $answer;
 }
示例#2
0
 public function testMappingParameterSetter()
 {
     $matcher = new Phake_Matchers_MethodMatcher('method', new Phake_Matchers_ReferenceSetter(42));
     $stub = $this->getMock('Phake_Stubber_AnswerCollection', array(), array(), '', false);
     $value = 'blah';
     $arguments = array();
     $arguments[0] =& $value;
     $this->mapper->mapStubToMatcher($stub, $matcher);
     $this->assertEquals($stub, $this->mapper->getStubByCall('method', $arguments));
     $this->assertEquals(42, $value);
 }
示例#3
0
 /**
  * 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->stubMapper->mapStubToMatcher($collection, $this->matcher);
     return new Phake_Proxies_AnswerCollectionProxy($collection);
 }