| Conditions | 1 |
| Paths | 1 |
| Total Lines | 19 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 20 | public function testDeleteSpamAction() |
||
| 21 | { |
||
| 22 | $deletedCount = rand(1, 100); |
||
| 23 | |||
| 24 | // Expect this to be called once |
||
| 25 | $this->commentTableMock->expects($this->once()) |
||
| 26 | ->method('deleteSpam') |
||
| 27 | ->will($this->returnValue($deletedCount)); |
||
| 28 | |||
| 29 | // CommentController Mock |
||
| 30 | $consoleControllerMock = new ConsoleController($this->commentTableMock); |
||
| 31 | |||
| 32 | // Capture output |
||
| 33 | ob_start(); |
||
| 34 | $consoleControllerMock->deleteSpamAction(); |
||
| 35 | $output = ob_get_clean(); |
||
| 36 | |||
| 37 | $this->assertEquals($output, $deletedCount . ' spam comments removed' . PHP_EOL); |
||
| 38 | } |
||
| 39 | } |
||
| 40 |