Test Failed
Pull Request — stable (#79)
by Jorge
02:05
created

ContainerTest::it_has_a_database_path_getter()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 6

Duplication

Lines 11
Ratio 100 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 6
nc 1
nop 0
dl 11
loc 11
rs 9.4285
c 1
b 0
f 0
1
<?php
2
3
namespace Tests\Unit;
4
5
use PHPUnit\Framework\TestCase;
6
use LaravelZero\Framework\Container;
7
8
class ContainerTest extends TestCase
9
{
10
    /** @test */
11
    public function it_has_a_base_path_getter()
12
    {
13
        $container = new Container;
14
15
        $this->assertEquals(BASE_PATH, $container->basePath());
16
        $this->assertEquals(BASE_PATH.'/Unit', $container->basePath('Unit'));
17
    }
18
19
    /** @test */
20
    public function it_has_a_config_path_getter()
21
    {
22
        $container = new Container;
23
24
        $this->assertEquals(BASE_PATH.'/config', $container->configPath());
25
        $this->assertEquals(BASE_PATH.'/config/custom.php', $container->configPath('custom.php'));
26
    }
27
28
    /** @test */
29 View Code Duplication
    public function it_has_a_database_path_getter()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
30
    {
31
        $container = new Container;
32
33
        $this->assertEquals(BASE_PATH.'/database', $container->databasePath());
34
        $this->assertEquals(BASE_PATH.'/database/migrations', $container->databasePath('migrations'));
35
36
        // config settings take precedence
37
        config(['database.path' => 'some/other/path']);
38
        $this->assertEquals('some/other/path', $container->databasePath());
39
    }
40
41
    /** @test */
42
    public function it_has_a_lang_path_getter()
43
    {
44
        $this->assertEquals(BASE_PATH.'/resources/lang', (new Container)->langPath());
45
    }
46
47
    /** @test */
48
    public function it_has_a_storage_path_getter()
49
    {
50
        $this->assertEquals(BASE_PATH.'/storage', (new Container)->storagePath());
51
    }
52
53
    /** @test */
54 View Code Duplication
    public function it_has_a_resource_path_getter()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
55
    {
56
        $container = new Container;
57
58
        $this->assertEquals(BASE_PATH.'/resources', $container->resourcePath());
59
        $this->assertEquals(BASE_PATH.'/resources/assets/js', $container->resourcePath('assets/js'));
60
        $this->assertEquals(BASE_PATH.'/resources/assets/js/app.php', $container->resourcePath('assets/js/app.php'));
61
    }
62
}
63