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); } }
/** * 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)); } }
/** * 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)); } }
public function expectReturnValue(Matcher $matcher = null) { if (null === $matcher) { return $this->expectReturnValue(new IsNull()); } $description = new StringDescription(); $matcher->describeTo($description); if (null !== $this->actualException) { $this->reporter->reportUnexpectedException($this->actualException, $description); } else { if (!$matcher->matches($this->actualReturnValue)) { $this->reporter->reportWrongResult($this->actualReturnValue, $description); } } return $this; }
public function describeTo(Description $description) { $description->appendText("List with EventMessages with Payloads matching <"); $this->matcher->describeTo($description); $description->appendText(">"); }
public function describeTo(Description $description) { $description->appendText("Message with payload <"); $this->payloadMatcher->describeTo($description); $description->appendText(">"); }