Esempio n. 1
0
 /**
  * @param callable $applicationBuilder
  * @param EventListener[] $listeners
  */
 public function __construct(callable $applicationBuilder, array $listeners = [])
 {
     $this->store = new MemoryEventStore();
     $this->application = $applicationBuilder($this->store);
     foreach ($listeners as $listener) {
         $this->application->addListener($listener);
     }
     $outcome = new Outcome();
     $this->given = new Context($this->store, $listeners);
     $this->when = new Action($this->application, $outcome);
     $this->then = new Expectation($this->application, $this->store, $outcome);
 }
Esempio n. 2
0
 /**
  * @param EventStore $store
  * @param AggregateFactory|null $aggregates
  * @param ProjectionFactory|null $projections
  */
 public function __construct(EventStore $store, AggregateFactory $aggregates = null, ProjectionFactory $projections = null)
 {
     parent::__construct($store, $aggregates ?: GenericAggregateFactory::genericRoot(), $projections ?: GenericProjectionFactory::genericProjection());
 }
Esempio n. 3
0
 public function __invoke($commandOrQuery)
 {
     $this->outcome->reset();
     $this->outcome->returned = $this->application->handle($commandOrQuery);
 }