|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
* This file is part of the core-bundle package. |
|
5
|
|
|
* |
|
6
|
|
|
* (c) 2019 WEBEWEB |
|
7
|
|
|
* |
|
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
|
9
|
|
|
* file that was distributed with this source code. |
|
10
|
|
|
*/ |
|
11
|
|
|
|
|
12
|
|
|
namespace WBW\Bundle\CoreBundle\Tests\Renderer\Assets; |
|
13
|
|
|
|
|
14
|
|
|
use WBW\Bundle\CoreBundle\Assets\Icon\MaterialDesignIconicFontIconInterface; |
|
15
|
|
|
use WBW\Bundle\CoreBundle\Factory\IconFactory; |
|
16
|
|
|
use WBW\Bundle\CoreBundle\Renderer\Assets\MaterialDesignIconicFontIconRenderer; |
|
17
|
|
|
use WBW\Bundle\CoreBundle\Tests\AbstractTestCase; |
|
18
|
|
|
|
|
19
|
|
|
/** |
|
20
|
|
|
* Material Design Iconic Font icon renderer test. |
|
21
|
|
|
* |
|
22
|
|
|
* @author webeweb <https://github.com/webeweb> |
|
23
|
|
|
* @package WBW\Bundle\CoreBundle\Tests\Renderer\Assets |
|
24
|
|
|
*/ |
|
25
|
|
|
class MaterialDesignIconicFontIconRendererTest extends AbstractTestCase { |
|
26
|
|
|
|
|
27
|
|
|
/** |
|
28
|
|
|
* Icon. |
|
29
|
|
|
* |
|
30
|
|
|
* @var MaterialDesignIconicFontIconInterface |
|
31
|
|
|
*/ |
|
32
|
|
|
private $icon; |
|
33
|
|
|
|
|
34
|
|
|
/** |
|
35
|
|
|
* {@inheritDoc} |
|
36
|
|
|
*/ |
|
37
|
|
|
protected function setUp(): void { |
|
38
|
|
|
parent::setUp(); |
|
39
|
|
|
|
|
40
|
|
|
// Set a Font Awesome icon mock. |
|
41
|
|
|
$this->icon = IconFactory::parseMaterialDesignIconicFontIcon([ |
|
42
|
|
|
"name" => "home", |
|
43
|
|
|
"style" => "color: #000000;", |
|
44
|
|
|
"border" => "border", |
|
45
|
|
|
"fixedWidth" => true, |
|
46
|
|
|
"flip" => "horizontal", |
|
47
|
|
|
"pull" => "left", |
|
48
|
|
|
"rotate" => "90", |
|
49
|
|
|
"size" => "lg", |
|
50
|
|
|
"spin" => "spin", |
|
51
|
|
|
]); |
|
52
|
|
|
} |
|
53
|
|
|
|
|
54
|
|
|
/** |
|
55
|
|
|
* Test renderBorder() |
|
56
|
|
|
* |
|
57
|
|
|
* @return void |
|
58
|
|
|
*/ |
|
59
|
|
|
public function testRenderBorder(): void { |
|
60
|
|
|
|
|
61
|
|
|
$res = MaterialDesignIconicFontIconRenderer::renderBorder($this->icon); |
|
62
|
|
|
$this->assertEquals("zmdi-hc-border", $res); |
|
63
|
|
|
} |
|
64
|
|
|
|
|
65
|
|
|
/** |
|
66
|
|
|
* Test renderFixedWidth() |
|
67
|
|
|
* |
|
68
|
|
|
* @return void |
|
69
|
|
|
*/ |
|
70
|
|
|
public function testRenderFixedWidth(): void { |
|
71
|
|
|
|
|
72
|
|
|
$res = MaterialDesignIconicFontIconRenderer::renderFixedWidth($this->icon); |
|
73
|
|
|
$this->assertEquals("zmdi-hc-fw", $res); |
|
74
|
|
|
} |
|
75
|
|
|
|
|
76
|
|
|
/** |
|
77
|
|
|
* Test renderFlip() |
|
78
|
|
|
* |
|
79
|
|
|
* @return void |
|
80
|
|
|
*/ |
|
81
|
|
|
public function testRenderFlip(): void { |
|
82
|
|
|
|
|
83
|
|
|
$res = MaterialDesignIconicFontIconRenderer::renderFlip($this->icon); |
|
84
|
|
|
$this->assertEquals("zmdi-hc-flip-horizontal", $res); |
|
85
|
|
|
} |
|
86
|
|
|
|
|
87
|
|
|
/** |
|
88
|
|
|
* Test renderName() |
|
89
|
|
|
* |
|
90
|
|
|
* @return void |
|
91
|
|
|
*/ |
|
92
|
|
|
public function testRenderName(): void { |
|
93
|
|
|
|
|
94
|
|
|
$res = MaterialDesignIconicFontIconRenderer::renderName($this->icon); |
|
95
|
|
|
$this->assertEquals("zmdi-home", $res); |
|
96
|
|
|
} |
|
97
|
|
|
|
|
98
|
|
|
/** |
|
99
|
|
|
* Test renderPull() |
|
100
|
|
|
* |
|
101
|
|
|
* @return void |
|
102
|
|
|
*/ |
|
103
|
|
|
public function testRenderPull(): void { |
|
104
|
|
|
|
|
105
|
|
|
$res = MaterialDesignIconicFontIconRenderer::renderPull($this->icon); |
|
106
|
|
|
$this->assertEquals("pull-left", $res); |
|
107
|
|
|
} |
|
108
|
|
|
|
|
109
|
|
|
/** |
|
110
|
|
|
* Test renderRotate() |
|
111
|
|
|
* |
|
112
|
|
|
* @return void |
|
113
|
|
|
*/ |
|
114
|
|
|
public function testRenderRotate(): void { |
|
115
|
|
|
|
|
116
|
|
|
$res = MaterialDesignIconicFontIconRenderer::renderRotate($this->icon); |
|
117
|
|
|
$this->assertEquals("zmdi-hc-rotate-90", $res); |
|
118
|
|
|
} |
|
119
|
|
|
|
|
120
|
|
|
/** |
|
121
|
|
|
* Test renderSize() |
|
122
|
|
|
* |
|
123
|
|
|
* @return void |
|
124
|
|
|
*/ |
|
125
|
|
|
public function testRenderSize(): void { |
|
126
|
|
|
|
|
127
|
|
|
$res = MaterialDesignIconicFontIconRenderer::renderSize($this->icon); |
|
128
|
|
|
$this->assertEquals("zmdi-hc-lg", $res); |
|
129
|
|
|
} |
|
130
|
|
|
|
|
131
|
|
|
/** |
|
132
|
|
|
* Test renderSpin() |
|
133
|
|
|
* |
|
134
|
|
|
* @return void |
|
135
|
|
|
*/ |
|
136
|
|
|
public function testRenderSpin(): void { |
|
137
|
|
|
|
|
138
|
|
|
$res = MaterialDesignIconicFontIconRenderer::renderSpin($this->icon); |
|
139
|
|
|
$this->assertEquals("zmdi-hc-spin", $res); |
|
140
|
|
|
} |
|
141
|
|
|
} |
|
142
|
|
|
|