Ejemplo n.º 1
0
 /**
  * Tests that the recorder can be rest to contain no calls.
  */
 public function testRemoveAllCalls()
 {
     $call = new Phake_CallRecorder_Call($this->mock, 'someMethod', array(), new Phake_MockReader());
     $call2 = new Phake_CallRecorder_Call($this->mock, 'someMethod2', array(), new Phake_MockReader());
     $callRecorder = new Phake_CallRecorder_Recorder();
     $callRecorder->recordCall($call);
     $callRecorder->recordCall($call2);
     $callRecorder->removeAllCalls();
     $this->assertSame(array(), $callRecorder->getAllCalls());
 }
Ejemplo n.º 2
0
 public function verifyNoCalls()
 {
     $result = true;
     $reportedCalls = array();
     foreach ($this->recorder->getAllCalls() as $call) {
         $result = false;
         $reportedCalls[] = $call->__toString();
     }
     if ($result) {
         return new Phake_CallRecorder_VerifierResult(true, array());
     } else {
         $desc = 'Expected no interaction with mock' . "\n" . 'Invocations:' . "\n  ";
         return new Phake_CallRecorder_VerifierResult(false, array(), $desc . implode("\n  ", $reportedCalls));
     }
 }