Test Failed
Pull Request — stable (#25)
by Nuno
01:42
created

it_configures_using_configuration()   B

Complexity

Conditions 2
Paths 2

Size

Total Lines 25
Code Lines 14

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 25
rs 8.8571
cc 2
eloc 14
nc 2
nop 0
1
<?php
2
3
namespace Tests\Unit;
4
5
use Tests\TestCase;
6
use Tests\FakeExtraCommand;
7
use Tests\FakeDefaultCommand;
8
use Illuminate\Container\Container;
9
use Illuminate\Contracts\Config\Repository;
10
11
class ApplicationTest extends TestCase
12
{
13
    /** @test */
14
    public function it_binds_core_alias(): void
15
    {
16
        $container = $this->createApplication()
17
            ->getContainer();
18
19
        $this->assertTrue(Container::getInstance() === $container);
20
        $this->assertTrue($container->make('app') === $container);
21
        $this->assertTrue($container->make(Container::class) === $container);
22
        $this->assertInstanceOf(Repository::class, $container->make('config'));
23
    }
24
25
    /** @test */
26
    public function it_configures_using_configuration()
27
    {
28
        // @todo Test production config.
29
        $app = $this->createApplication();
30
31
        $this->assertTrue($app->getName() === 'Test name');
32
        $this->assertTrue($app->getVersion() === 'Test version');
33
34
        $commands = [
35
            FakeDefaultCommand::class,
36
            FakeExtraCommand::class,
37
        ];
38
39
        $appCommands = collect($app->all())
40
            ->map(
41
                function ($command) {
42
                    return get_class($command);
43
                }
44
            )
45
            ->toArray();
46
47
        foreach ($commands as $command) {
48
            $this->assertTrue(in_array($command, $appCommands));
49
        }
50
    }
51
52
    /** @test */
53
    public function it_register_service_providers()
54
    {
55
        $app = $this->createApplication();
56
57
        $this->assertTrue(
58
            $app->getContainer()
59
                ->make('foo') === 'bar'
60
        );
61
    }
62
}
63