/**
  * Assert that the given <code>expected</code> events have been published.
  *
  * @param array $expected the events that must have been published.
  * @throws GovernorAssertionError
  */
 public function assertPublishedEvents(array $expected = array())
 {
     if (count($this->publishedEvents) !== count($expected)) {
         throw new GovernorAssertionError(sprintf("Got wrong number of events published. Expected <%s>, got <%s>", count($expected), count($this->publishedEvents)));
     }
     $this->assertPublishedEventsMatching(Matchers::payloadsMatching(Matchers::exactSequenceOf($this->createEqualToMatchers($expected))));
 }
 public function testMatch_ExcessIsRefused()
 {
     $this->testSubject = Matchers::exactSequenceOf(array($this->mockMatcher1, $this->mockMatcher2, $this->mockMatcher3, Matchers::andNoMore()));
     $this->assertFalse($this->testSubject->matches(array($this->stubEvent1, $this->stubEvent2, $this->stubEvent3, new StubEvent())));
     \Phake::verify($this->mockMatcher1, \Phake::times(1))->matches($this->stubEvent1);
     \Phake::verify($this->mockMatcher1, \Phake::never())->matches($this->stubEvent2);
     \Phake::verify($this->mockMatcher1, \Phake::never())->matches($this->stubEvent3);
     \Phake::verify($this->mockMatcher2, \Phake::never())->matches($this->stubEvent1);
     \Phake::verify($this->mockMatcher2, \Phake::times(1))->matches($this->stubEvent2);
     \Phake::verify($this->mockMatcher2, \Phake::never())->matches($this->stubEvent3);
     \Phake::verify($this->mockMatcher3, \Phake::never())->matches($this->stubEvent1);
     \Phake::verify($this->mockMatcher3, \Phake::never())->matches($this->stubEvent2);
     \Phake::verify($this->mockMatcher3, \Phake::times(1))->matches($this->stubEvent3);
 }