public handle ( Dumplie\SharedKernel\Application\Command\Command $command ) | ||
$command | Dumplie\SharedKernel\Application\Command\Command |
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); }
/** * @param Command $command */ public function handle(Command $command) { $this->commandBus->handle($command); }