Completed
Push — master ( 3cc055...006e5b )
by hu
02:38
created

ThemeTest   A

Complexity

Total Complexity 9

Size/Duplication

Total Lines 85
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 9
lcom 1
cbo 2
dl 0
loc 85
rs 10
c 0
b 0
f 0

9 Methods

Rating   Name   Duplication   Size   Complexity  
A testGetAllThemes() 0 5 1
A testCurrent() 0 5 1
A testCurrentTheme() 0 5 1
A testIsCurrent() 0 5 1
A testAsset() 0 5 1
A testAbsolutePath() 0 5 1
A testPath() 0 5 1
A testSetConfig() 0 7 1
A testLoadThemes() 0 5 1
1
<?php
2
3
/*
4
 * This file is part of the trendsoft/themes.
5
 * (c) jabber <[email protected]>
6
 * This source file is subject to the MIT license that is bundled
7
 * with this source code in the file LICENSE.
8
 */
9
10
namespace Tests\Unit;
11
12
use Tests\TestCase;
13
use Themes\Theme;
14
15
class ThemeTest extends TestCase
16
{
17
    /**
18
     * @dataProvider configProvider
19
     */
20
    public function testGetAllThemes($config)
21
    {
22
        $theme = new Theme($config);
23
        $this->assertArrayHasKey('default', $theme->all());
24
    }
25
26
    /**
27
     * @dataProvider configProvider
28
     */
29
    public function testCurrent($config)
30
    {
31
        $theme = new Theme($config);
32
        $this->assertSame('default', $theme->getCurrent());
33
    }
34
35
    /**
36
     * @dataProvider configProvider
37
     */
38
    public function testCurrentTheme($config)
39
    {
40
        $theme = new Theme($config);
41
        $this->assertSame('default', $theme->getCurrentTheme()['slug']);
42
    }
43
44
    /**
45
     * @dataProvider configProvider
46
     */
47
    public function testIsCurrent($config)
48
    {
49
        $theme = new Theme($config);
50
        $this->assertTrue($theme->isCurrent('default'));
51
    }
52
53
    /**
54
     * @dataProvider configProvider
55
     */
56
    public function testAsset($config)
57
    {
58
        $theme = new Theme($config);
59
        $this->assertSame('themes/default/assets/bs', $theme->asset('bs'));
60
    }
61
62
    /**
63
     * @dataProvider configProvider
64
     */
65
    public function testAbsolutePath($config)
66
    {
67
        $theme = new Theme($config);
68
        $this->assertSame($this->getAbsolute().'/default', $theme->absolutePath());
69
    }
70
71
    /**
72
     * @dataProvider configProvider
73
     */
74
    public function testPath($config)
75
    {
76
        $theme = new Theme($config);
77
        $this->assertSame('themes/vue/assets/app.js', $theme->path('assets/app.js', 'vue'));
78
    }
79
80
    /**
81
     * @dataProvider configProvider
82
     */
83
    public function testSetConfig($config)
84
    {
85
        $theme = new Theme($config);
86
        $config['active'] = 'vue';
87
        $theme->setConfig($config);
88
        $this->assertSame('vue', $theme->getCurrent());
89
    }
90
91
    /**
92
     * @dataProvider configProvider
93
     */
94
    public function testLoadThemes($config)
95
    {
96
        $theme = new Theme($config);
97
        $this->assertSame(3, count($theme->all()));
98
    }
99
}
100