| @@ 40-55 (lines=16) @@ | ||
| 37 | } |
|
| 38 | ||
| 39 | /** @test */ |
|
| 40 | public function it_allows_success_tasks(): void |
|
| 41 | { |
|
| 42 | $command = $this->makeCommand(); |
|
| 43 | ||
| 44 | $outputMock = $this->createMock(OutputInterface::class); |
|
| 45 | $outputMock->expects($this->once())->method('writeln')->with( |
|
| 46 | 'foo: <info>✔</info>' |
|
| 47 | ); |
|
| 48 | ||
| 49 | $command->setOutput($outputMock); |
|
| 50 | ||
| 51 | $command->task( |
|
| 52 | 'foo', function () { |
|
| 53 | return true; |
|
| 54 | }); |
|
| 55 | } |
|
| 56 | ||
| 57 | /** @test */ |
|
| 58 | public function it_allows_fail_tasks(): void |
|
| @@ 58-73 (lines=16) @@ | ||
| 55 | } |
|
| 56 | ||
| 57 | /** @test */ |
|
| 58 | public function it_allows_fail_tasks(): void |
|
| 59 | { |
|
| 60 | $command = $this->makeCommand(); |
|
| 61 | ||
| 62 | $outputMock = $this->createMock(OutputInterface::class); |
|
| 63 | $outputMock->expects($this->once())->method('writeln')->with( |
|
| 64 | 'bar: <error>failed</error>' |
|
| 65 | ); |
|
| 66 | ||
| 67 | $command->setOutput($outputMock); |
|
| 68 | ||
| 69 | $command->task( |
|
| 70 | 'bar', function () { |
|
| 71 | return false; |
|
| 72 | }); |
|
| 73 | } |
|
| 74 | ||
| 75 | private function makeCommand() |
|
| 76 | { |
|