@@ 49-60 (lines=12) @@ | ||
46 | /** |
|
47 | * Test dispatch chained middlewares. |
|
48 | */ |
|
49 | public function testDispatchChainedMiddlewares() |
|
50 | { |
|
51 | $this |
|
52 | ->given($commandBus = CommandBus::create()) |
|
53 | ->and($command = new EncodePasswordCommand('plainpassword')) |
|
54 | ->and($commandBus->addHandler(EncodePasswordCommand::class, new EncodePasswordHandler('md5'))) |
|
55 | ->and($commandBus->dispatch($command)) |
|
56 | ->then() |
|
57 | ->string($command->password()) |
|
58 | ->isEqualTo(md5('plainpassword')) |
|
59 | ; |
|
60 | } |
|
61 | ||
62 | /** |
|
63 | * Test getHandlerFor. |
|
@@ 65-76 (lines=12) @@ | ||
62 | /** |
|
63 | * Test getHandlerFor. |
|
64 | */ |
|
65 | public function testGetHandlerFor() |
|
66 | { |
|
67 | $this |
|
68 | ->given($commandBus = CommandBus::create()) |
|
69 | ->and($command = new EncodePasswordCommand('plainpassword')) |
|
70 | ->and($commandHandler = new EncodePasswordHandler('md5')) |
|
71 | ->and($commandBus->addHandler(EncodePasswordCommand::class, $commandHandler)) |
|
72 | ->then() |
|
73 | ->object($commandBus->getHandlerFor(EncodePasswordCommand::class)) |
|
74 | ->isEqualTo($commandHandler) |
|
75 | ; |
|
76 | } |
|
77 | ||
78 | /** |
|
79 | * Test dispatch with invalid command. |