@@ 18-37 (lines=20) @@ | ||
15 | */ |
|
16 | class CreateIndexCommand extends atoum |
|
17 | { |
|
18 | public function testCreateIndexCallsHandler() |
|
19 | { |
|
20 | $this |
|
21 | ->given($this->newTestedInstance) |
|
22 | ->and($handler = $this->newCreateIndexHandler()) |
|
23 | ->and($container = $this->createContainer($handler)) |
|
24 | ->and($this->testedInstance->setContainer($container)) |
|
25 | ->and($input = new ArrayInput([ |
|
26 | 'client_id' => 'my_client', |
|
27 | 'index_id' => 'my_index', |
|
28 | ])) |
|
29 | ->and($output = new OutputInterface()) |
|
30 | ->if($this->testedInstance->run($input, $output)) |
|
31 | ->then |
|
32 | ->mock($handler) |
|
33 | ->call('handle') |
|
34 | ->withArguments('my_client', 'my_index') |
|
35 | ->once() |
|
36 | ; |
|
37 | } |
|
38 | ||
39 | private function newCreateIndexHandler() |
|
40 | { |
@@ 63-81 (lines=19) @@ | ||
60 | return $container; |
|
61 | } |
|
62 | ||
63 | public function testDeleleDoesnotCallHandlerIfNotForced() |
|
64 | { |
|
65 | $this |
|
66 | ->given($this->newTestedInstance) |
|
67 | ->and($handler = $this->newDeleteIndexHandler()) |
|
68 | ->and($container = $this->createContainer($handler)) |
|
69 | ->and($this->testedInstance->setContainer($container)) |
|
70 | ->and($input = new ArrayInput([ |
|
71 | 'client_id' => 'my_client', |
|
72 | 'index_id' => 'my_index', |
|
73 | ])) |
|
74 | ->and($output = new OutputInterface()) |
|
75 | ->if($this->testedInstance->run($input, $output)) |
|
76 | ->then |
|
77 | ->mock($handler) |
|
78 | ->call('handle') |
|
79 | ->never() |
|
80 | ; |
|
81 | } |
|
82 | } |