Test Failed
Push — stable ( 994ca0...7d5c83 )
by Nuno
04:30
created

LoadConfigurationsTest::it_reads_commands()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 19

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 19
rs 9.6333
c 0
b 0
f 0
cc 2
nc 2
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Tests;
6
7
use App\Commands\FakeFooCommand;
8
use App\Commands\FakeDefaultCommand;
9
use App\OtherCommands\FakeOtherCommand;
10
use Illuminate\Support\Facades\Artisan;
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