Example #1
0
 /**
  * Tests calling through a chain of calls
  */
 public function testStubbingChainedMethodsToCallParent()
 {
     $mock = Phake::mock('PhakeTest_MockedClass', Phake::ifUnstubbed()->thenCallParent());
     $this->assertEquals('test', $mock->callInnerFunc());
 }
Example #2
0
 public function testMagicCallChecksFallbackStub()
 {
     $newClassName = __CLASS__ . '_TestClass22';
     $mockedClass = 'PhakeTest_MagicClass';
     $this->classGen->generate($newClassName, $mockedClass, $this->infoRegistry);
     $callRecorder = Phake::mock('Phake_CallRecorder_Recorder');
     $stubMapper = Phake::mock('Phake_Stubber_StubMapper');
     $answer = Phake::mock('Phake_Stubber_Answers_NoAnswer', Phake::ifUnstubbed()->thenCallParent());
     $mock = $this->classGen->instantiate($newClassName, $callRecorder, $stubMapper, $answer);
     $mock->foo('blah');
     Phake::verify($stubMapper)->getStubByCall('foo', array('blah'));
     Phake::verify($stubMapper)->getStubByCall('__call', array('foo', array('blah')));
 }