| 1 | <?php |
||
| 9 | class TerminalIntegration extends TestCase { |
||
| 10 | |||
| 11 | /** @test */ |
||
| 12 | public function success() |
||
| 13 | { |
||
| 14 | $terminal = $this->makeTerminal(); |
||
| 15 | |||
| 16 | $result = $terminal->execute('/clear'); |
||
| 17 | |||
| 18 | $expectedArray = [ |
||
| 19 | [ |
||
| 20 | 'type' => 'info', |
||
| 21 | 'content' => 'Output text...', |
||
| 22 | ] |
||
| 23 | ]; |
||
| 24 | |||
| 25 | $this->assertNotNull($result['timestamp']); |
||
| 26 | $this->assertEquals($expectedArray, $result['lines']); |
||
| 27 | } |
||
| 28 | |||
| 29 | /** @test */ |
||
| 30 | public function unknow() |
||
| 31 | { |
||
| 32 | $terminal = $this->makeTerminal(); |
||
| 33 | |||
| 34 | $this->expectException(UnknowCommand::class); |
||
| 35 | $this->expectExceptionMessage(''); |
||
| 36 | |||
| 37 | $terminal->execute('/unknow_command'); |
||
| 38 | } |
||
| 39 | |||
| 40 | /** @test */ |
||
| 41 | public function getAvailableCommands() |
||
| 56 | |||
| 57 | /** |
||
| 58 | * @return \DeGraciaMathieu\Clike\Terminal |
||
| 59 | */ |
||
| 60 | protected function makeTerminal() |
||
| 68 | } |
||
| 69 |