Inheritance: implements Dumplie\SharedKernel\Application\CommandBus
Example #1
0
 public function test_command_extension_points()
 {
     $command = new CreateCart((string) CartId::generate(), 'PLN');
     $extension = $this->prophesize(Extension::class);
     $extension->expands($command)->willReturn(true);
     $extension->pre($command, $this->serviceLocator)->shouldBeCalled();
     $extension->post($command, $this->serviceLocator)->shouldBeCalled();
     $this->extensionRegistry->register($extension->reveal());
     $this->commandBus->handle($command);
 }
 public function test_transaction_extension_rollback()
 {
     $transaction = $this->prophesize(Transaction::class);
     $transaction->commit()->shouldNotBeCalled();
     $transaction->rollback()->shouldBeCalled();
     $factory = new FactoryStub($transaction->reveal());
     $transaction = new TransactionExtension($factory);
     $this->extensionRegistry->register($transaction);
     $this->expectException(ProductNotFoundException::class);
     $command = new AddToCart("SKU", 1, (string) CartId::generate());
     $this->commandBus->handle($command);
 }
Example #3
0
 /**
  * @param Command $command
  */
 public function handle(Command $command)
 {
     $this->commandBus->handle($command);
 }