1 | <?php |
||
8 | use LaravelZero\Framework\Contracts\Exceptions\ConsoleExceptionContract; |
||
9 | |||
10 | final class ApplicationTest extends TestCase |
||
11 | { |
||
12 | public function testVersionFromConfig(): void |
||
13 | { |
||
14 | $this->assertSame('Test version', $this->app->version()); |
||
15 | } |
||
16 | |||
17 | public function testRunningInConsole(): void |
||
18 | { |
||
19 | $this->assertTrue($this->app->runningInConsole()); |
||
20 | } |
||
21 | |||
22 | public function testIsDownForMaintenance(): void |
||
23 | { |
||
24 | $this->assertFalse($this->app->isDownForMaintenance()); |
||
25 | } |
||
26 | |||
27 | public function testThatCanAbort(): void |
||
28 | { |
||
29 | try { |
||
30 | $this->app->abort(404, 'Foo'); |
||
31 | } catch (CommandNotFoundException $notFoundException) { |
||
32 | } |
||
33 | |||
34 | $this->assertInstanceOf(CommandNotFoundException::class, $notFoundException); |
||
35 | $this->assertEquals($notFoundException->getMessage(), 'Foo'); |
||
36 | |||
37 | try { |
||
38 | abort(200, 'Bar', ['Foo' => 'Bar']); |
||
39 | } catch (ConsoleExceptionContract $consoleException) { |
||
40 | } |
||
41 | |||
42 | $this->assertInstanceOf(ConsoleExceptionContract::class, $consoleException); |
||
43 | $this->assertEquals($consoleException->getExitCode(), 200); |
||
44 | $this->assertEquals($consoleException->getMessage(), 'Bar'); |
||
45 | $this->assertEquals($consoleException->getHeaders(), ['Foo' => 'Bar']); |
||
46 | } |
||
47 | } |
||
48 |