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
|
|
|
|