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))))); }
/** * Is the value an instance of a particular type? * @param $class * @return null */ public static function any($class) { return self::getPoserCore()->reportMatcher(hm::any($class))->returnNull(); }