| @@ 31-42 (lines=12) @@ | ||
| 28 | /** |
|
| 29 | * Test create without command handler middleware. |
|
| 30 | */ |
|
| 31 | public function testCreateWithoutCommandHandlerMiddleware() |
|
| 32 | { |
|
| 33 | $this |
|
| 34 | ->given($middleware = new LockingMiddleware()) |
|
| 35 | ->and($commandBus = new CommandBus([$middleware])) |
|
| 36 | ->then() |
|
| 37 | ->exception(function () use ($commandBus) { |
|
| 38 | $commandBus->dispatch(new EncodePasswordCommand('plainpassword')); |
|
| 39 | }) |
|
| 40 | ->isInstanceOf(NotFoundException::class) |
|
| 41 | ; |
|
| 42 | } |
|
| 43 | ||
| 44 | /** |
|
| 45 | * Test dispatch chained middlewares. |
|
| @@ 33-44 (lines=12) @@ | ||
| 30 | /** |
|
| 31 | * Test create without event dispatcher middleware. |
|
| 32 | */ |
|
| 33 | public function testCreateWithoutEventDispatcherMiddleware() |
|
| 34 | { |
|
| 35 | $this |
|
| 36 | ->given($middleware = new LockingMiddleware()) |
|
| 37 | ->and($eventBus = new EventBus([$middleware])) |
|
| 38 | ->then() |
|
| 39 | ->exception(function () use ($eventBus) { |
|
| 40 | $eventBus->dispatch(new LoginUserEvent('[email protected]')); |
|
| 41 | }) |
|
| 42 | ->isInstanceOf(NotFoundException::class) |
|
| 43 | ; |
|
| 44 | } |
|
| 45 | ||
| 46 | /** |
|
| 47 | * Test dispatch chained middlewares. |
|
| @@ 32-43 (lines=12) @@ | ||
| 29 | /** |
|
| 30 | * Test create without query handler middleware. |
|
| 31 | */ |
|
| 32 | public function testCreateWithoutQueryHandlerMiddleware() |
|
| 33 | { |
|
| 34 | $this |
|
| 35 | ->given($middleware = new LockingMiddleware()) |
|
| 36 | ->and($queryBus = new QueryBus([$middleware])) |
|
| 37 | ->then() |
|
| 38 | ->exception(function () use ($queryBus) { |
|
| 39 | $queryBus->dispatch(new PublishedPostsQuery(new \DateTime())); |
|
| 40 | }) |
|
| 41 | ->isInstanceOf(NotFoundException::class) |
|
| 42 | ; |
|
| 43 | } |
|
| 44 | ||
| 45 | /** |
|
| 46 | * Test dispatch chained middlewares. |
|