public function setUp() { $this->mockMatcher1 = \Phake::mock(Matcher::class); $this->mockMatcher2 = \Phake::mock(Matcher::class); $this->mockMatcher3 = \Phake::mock(Matcher::class); $this->testSubject = Matchers::listWithAnyOf(array($this->mockMatcher1, $this->mockMatcher2, $this->mockMatcher3)); $this->stubEvent1 = new StubEvent1(); $this->stubEvent2 = new StubEvent2(); \Phake::when($this->mockMatcher1)->matches(\Phake::anyParameters())->thenReturn(true); \Phake::when($this->mockMatcher2)->matches(\Phake::anyParameters())->thenReturn(true); \Phake::when($this->mockMatcher3)->matches(\Phake::anyParameters())->thenReturn(true); }
public function testFixtureApi_WhenEventIsPublishedToEventBus() { $aggregate1 = Uuid::uuid1()->toString(); $aggregate2 = Uuid::uuid1()->toString(); $fixture = new AnnotatedSagaTestFixture(StubSaga::class); $validator = $fixture->givenAggregate($aggregate1)->published(array(new TriggerSagaStartEvent($aggregate1), new TriggerExistingSagaEvent($aggregate1)))->whenAggregate($aggregate1)->publishes(new TriggerExistingSagaEvent($aggregate1)); $validator->expectActiveSagas(1); $validator->expectAssociationWith("identifier", $aggregate1); $validator->expectNoAssociationWith("identifier", $aggregate2); //validator.expectScheduledEventMatching(Duration.standardMinutes(10), // Matchers.messageWithPayload(CoreMatchers.any(Object.class))); $validator->expectDispatchedCommandsEqualTo(array()); $validator->expectPublishedEventsMatching(Matchers::listWithAnyOf(array(Matchers::messageWithPayload(CoreMatchers::any(SagaWasTriggeredEvent::class))))); }