1 | <?php |
||
11 | use App\HiddenCommands\FakeHiddenCommand; |
||
12 | |||
13 | final class LoadConfigurationsTest extends TestCase |
||
14 | { |
||
15 | public function testThatApplicationConfigurationIsAvailable(): void |
||
16 | { |
||
17 | $this->assertSame('Application', Artisan::getName()); |
||
18 | $this->assertSame('Test version', $this->app->version()); |
||
19 | $this->assertEquals( |
||
20 | $this->app->environment(), |
||
21 | 'development' |
||
22 | ); |
||
23 | } |
||
24 | |||
25 | public function testAddCommands(): void |
||
26 | { |
||
27 | $commands = [ |
||
28 | FakeDefaultCommand::class, |
||
29 | FakeFooCommand::class, |
||
30 | FakeOtherCommand::class, |
||
31 | FakeHiddenCommand::class, |
||
32 | ]; |
||
33 | |||
34 | $appCommands = collect(Artisan::all()) |
||
35 | ->map( |
||
36 | function ($command) { |
||
37 | return get_class($command); |
||
38 | } |
||
39 | ) |
||
40 | ->toArray(); |
||
41 | |||
42 | foreach ($commands as $command) { |
||
43 | $this->assertContains($command, $appCommands); |
||
44 | } |
||
45 | } |
||
46 | |||
47 | public function testHideCommands(): void |
||
48 | { |
||
49 | $this->assertTrue(Artisan::all()['fake:hidden']->isHidden()); |
||
50 | } |
||
51 | |||
52 | public function testRemoveCommands(): void |
||
53 | { |
||
54 | $this->assertArrayNotHasKey('fake:removed', Artisan::all()); |
||
55 | } |
||
56 | } |
||
57 |