コード例 #1
0
 public function testSubscribe()
 {
     $listener = new AnnotatedListener();
     AnnotatedEventListenerAdapter::subscribe($listener, $this->eventBus, new SimpleAnnotationReaderFactory());
     $event1 = new MyEvent("a", "b");
     $event2 = new MyOtherEvent();
     $this->eventBus->publish(array(GenericEventMessage::asEventMessage($event1)));
     $this->assertCount(1, $this->publishedEvents);
     $this->assertSame($listener->event, $event1);
     $this->eventBus->publish(array(GenericEventMessage::asEventMessage($event2)));
     $this->assertCount(2, $this->publishedEvents);
     $this->assertSame($listener->event, $event2);
 }
コード例 #2
0
 /**
  * Use this method to indicate an application is published, <em>while recording the outcome</em>.
  * <p/>
  * Note that if you inject resources using {@link FixtureConfiguration#registerResource(Object)}, you may need to
  * reset them yourself if they are manipulated by the Saga in the "given" stage of the test.
  *
  * @param mixed $event the event to publish
  * @return FixtureExecutionResultInterface an object allowing you to verify the test results
  */
 public function whenPublishingA($event)
 {
     try {
         $this->fixtureExecutionResult->startRecording();
         $this->sagaManager->handle(GenericEventMessage::asEventMessage($event));
     } finally {
         //FixtureResourceParameterResolverFactory.clear();
     }
     return $this->fixtureExecutionResult;
 }
コード例 #3
0
 private function newEvent()
 {
     return [GenericEventMessage::asEventMessage(new StubEventMessage())];
 }