function testNoMoreInteractionsFailureMessageIncludesHelpfulErrorMessageWithStackTrace()
 {
     $this->_setAllInvocationsTo(2);
     $this->_setMatchingInvocationsTo(1);
     $noMoreInteractions = new NoMoreInteractions();
     $result = $noMoreInteractions->verify($this->_mockContext);
     $failureMessage = $result->describeConstraintFailure();
     $this->assertThat($failureMessage, $this->stringContains("No more interactions wanted"));
     $this->assertThat($failureMessage, $this->stringContains("found this interaction"));
     $this->assertThat($failureMessage, $this->stringContains('#0 someFile.php(123): SomeClass->someMethod()'));
 }
Example #2
0
 /**
  * @param MockMarker|Object|array $mocks
  */
 static function verifyNoMoreInteractions($mocks)
 {
     if (!is_array($mocks)) {
         $mocks = array($mocks);
     }
     $noMoreInteractionsVerificationMode = new NoMoreInteractions();
     /** @var MockMarker $mock */
     foreach ($mocks as $mock) {
         $verificationContext = new VerificationContext($mock->__phockito_instanceid, null, array());
         $verificationResult = $noMoreInteractionsVerificationMode->verify($verificationContext);
         if ($verificationResult instanceof UnsuccessfulVerificationResult) {
             (new UnsuccessfulVerificationReporter())->reportUnsuccessfulVerification($verificationResult);
         }
     }
 }