Completed
Push — stable ( 86ecc3...3a45ea )
by Nuno
07:34
created

it_allows_hidden_commands()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace Tests;
4
5
use App\Commands\FakeFooCommand;
6
use App\Commands\FakeDefaultCommand;
7
use App\Commands\FakeRemovedCommand;
8
use App\OtherCommands\FakeOtherCommand;
9
use Illuminate\Support\Facades\Artisan;
10
use App\HiddenCommands\FakeHiddenCommand;
11
12
class LoadConfigurationsTest extends TestCase
13
{
14
    /** @test */
15
    public function it_reads_configuration_files()
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
    /** @test */
26
    public function it_reads_commands()
27
    {
28
        $commands = [
29
            FakeDefaultCommand::class,
30
            FakeFooCommand::class,
31
            FakeOtherCommand::class,
32
            FakeHiddenCommand::class
33
        ];
34
35
        $appCommands = collect(Artisan::all())->map(
36
            function ($command) {
37
                return get_class($command);
38
            }
39
        )->toArray();
40
41
        foreach ($commands as $command) {
42
            $this->assertContains($command, $appCommands);
43
        }
44
    }
45
46
    /** @test */
47
    public function it_allows_hidden_commands()
48
    {
49
        $this->assertTrue(Artisan::all()['fake:hidden']->isHidden());
50
    }
51
52
    /** @test */
53
    public function it_allows_remove_commands()
54
    {
55
        $this->assertArrayNotHasKey('fake:removed', Artisan::all());
56
    }
57
}
58