Esempio n. 1
0
 public function assertMismatchDescription($expected, \Hamcrest\Matcher $matcher, $arg)
 {
     $description = new \Hamcrest\StringDescription();
     $this->assertFalse($matcher->matches($arg), 'Precondtion: Matcher should not match item');
     $matcher->describeMismatch($arg, $description);
     $this->assertEquals($expected, (string) $description, 'Expected mismatch description');
 }
Esempio n. 2
0
 /**
  * Asserts that events have been published matching the given <code>matcher</code>.
  *
  * @param Matcher $matcher The matcher that will validate the actual events
  * @throws GovernorAssertionError
  */
 public function assertPublishedEventsMatching(Matcher $matcher)
 {
     if (!$matcher->matches($this->publishedEvents)) {
         $expectedDescription = new StringDescription();
         $actualDescription = new StringDescription();
         $matcher->describeTo($expectedDescription);
         DescriptionUtils::describe($this->publishedEvents, $actualDescription);
         throw new GovernorAssertionError(sprintf("Published events did not match.\nExpected:\n<%s>\n\nGot:\n<%s>\n", $expectedDescription, $actualDescription));
     }
 }
Esempio n. 3
0
 /**
  * Assert that commands matching the given <code>matcher</code> has been dispatched on the command bus.
  *
  * @param Matcher $matcher The matcher validating the actual commands
  * @throws GovernorAssertionError
  */
 public function assertDispatchedMatching(Matcher $matcher)
 {
     if (!$matcher->matches($this->commandBus->getDispatchedCommands())) {
         $expectedDescription = new StringDescription();
         $actualDescription = new StringDescription();
         $matcher->describeTo($expectedDescription);
         DescriptionUtils::describe($this->commandBus->getDispatchedCommands(), $actualDescription);
         throw new GovernorAssertionError(sprintf("Incorrect dispatched command. Expected <%s>, but got <%s>", $expectedDescription, $actualDescription));
     }
 }
Esempio n. 4
0
 public function describeTo(Description $description)
 {
     $description->appendText('XML or HTML document with XPath "')->appendText($this->_xpath)->appendText('"');
     if ($this->_matcher !== null) {
         $description->appendText(' ');
         $this->_matcher->describeTo($description);
     }
 }
 public function expectStoredEventsMatching(Matcher $matcher)
 {
     if (!$matcher->matches($this->storedEvents)) {
         $this->reporter->reportWrongEventDescription($this->storedEvents, $this->descriptionOf($matcher), $this->actualException);
     }
     return $this;
 }
 private function _describeMismatch(Matcher $matcher, $item)
 {
     $this->_mismatchDescription->appendText('item with key ' . $this->_nextMatchKey . ': ');
     $matcher->describeMismatch($item, $this->_mismatchDescription);
 }
Esempio n. 7
0
 public function describeTo(Description $description)
 {
     $description->appendText("List with EventMessages with Payloads matching <");
     $this->matcher->describeTo($description);
     $description->appendText(">");
 }
Esempio n. 8
0
 public function describeTo(Description $description)
 {
     $description->appendText("Message with payload <");
     $this->payloadMatcher->describeTo($description);
     $description->appendText(">");
 }