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\FontAwesomeIconInterface; |
15
|
|
|
use WBW\Bundle\CoreBundle\Factory\IconFactory; |
16
|
|
|
use WBW\Bundle\CoreBundle\Renderer\Assets\FontAwesomeIconRenderer; |
17
|
|
|
use WBW\Bundle\CoreBundle\Tests\AbstractTestCase; |
18
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* Font Awesome icon renderer test. |
21
|
|
|
* |
22
|
|
|
* @author webeweb <https://github.com/webeweb> |
23
|
|
|
* @package WBW\Bundle\CoreBundle\Tests\Renderer\Assets |
24
|
|
|
*/ |
25
|
|
|
class FontAwesomeIconRendererTest extends AbstractTestCase { |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* Icon. |
29
|
|
|
* |
30
|
|
|
* @var FontAwesomeIconInterface |
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::parseFontAwesomeIcon([ |
42
|
|
|
"name" => "home", |
43
|
|
|
"style" => "color: #000000;", |
44
|
|
|
"animation" => "spin", |
45
|
|
|
"bordered" => true, |
46
|
|
|
"fixedWidth" => true, |
47
|
|
|
"font" => "s", |
48
|
|
|
"pull" => "left", |
49
|
|
|
"size" => "lg", |
50
|
|
|
]); |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
/** |
54
|
|
|
* Test renderAnimation() |
55
|
|
|
* |
56
|
|
|
* @return void |
57
|
|
|
*/ |
58
|
|
|
public function testRenderAnimation(): void { |
59
|
|
|
|
60
|
|
|
$res = FontAwesomeIconRenderer::renderAnimation($this->icon); |
61
|
|
|
$this->assertEquals("fa-spin", $res); |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
/** |
65
|
|
|
* Test renderBordered() |
66
|
|
|
* |
67
|
|
|
* @return void |
68
|
|
|
*/ |
69
|
|
|
public function testRenderBordered(): void { |
70
|
|
|
|
71
|
|
|
$res = FontAwesomeIconRenderer::renderBordered($this->icon); |
72
|
|
|
$this->assertEquals("fa-border", $res); |
73
|
|
|
} |
74
|
|
|
|
75
|
|
|
/** |
76
|
|
|
* Test renderFixedWidth() |
77
|
|
|
* |
78
|
|
|
* @return void |
79
|
|
|
*/ |
80
|
|
|
public function testRenderFixedWidth(): void { |
81
|
|
|
|
82
|
|
|
$res = FontAwesomeIconRenderer::renderFixedWidth($this->icon); |
83
|
|
|
$this->assertEquals("fa-fw", $res); |
84
|
|
|
} |
85
|
|
|
|
86
|
|
|
/** |
87
|
|
|
* Test renderFont() |
88
|
|
|
* |
89
|
|
|
* @return void |
90
|
|
|
*/ |
91
|
|
|
public function testRenderFont(): void { |
92
|
|
|
|
93
|
|
|
$res = FontAwesomeIconRenderer::renderFont($this->icon); |
94
|
|
|
$this->assertEquals("fas", $res); |
95
|
|
|
} |
96
|
|
|
|
97
|
|
|
/** |
98
|
|
|
* Test renderName() |
99
|
|
|
* |
100
|
|
|
* @return void |
101
|
|
|
*/ |
102
|
|
|
public function testRenderName(): void { |
103
|
|
|
|
104
|
|
|
$res = FontAwesomeIconRenderer::renderName($this->icon); |
105
|
|
|
$this->assertEquals("fa-home", $res); |
106
|
|
|
} |
107
|
|
|
|
108
|
|
|
/** |
109
|
|
|
* Test renderPull() |
110
|
|
|
* |
111
|
|
|
* @return void |
112
|
|
|
*/ |
113
|
|
|
public function testRenderPull(): void { |
114
|
|
|
|
115
|
|
|
$res = FontAwesomeIconRenderer::renderPull($this->icon); |
116
|
|
|
$this->assertEquals("fa-pull-left", $res); |
117
|
|
|
} |
118
|
|
|
|
119
|
|
|
/** |
120
|
|
|
* Test renderSize() |
121
|
|
|
* |
122
|
|
|
* @return void |
123
|
|
|
*/ |
124
|
|
|
public function testRenderSize(): void { |
125
|
|
|
|
126
|
|
|
$res = FontAwesomeIconRenderer::renderSize($this->icon); |
127
|
|
|
$this->assertEquals("fa-lg", $res); |
128
|
|
|
} |
129
|
|
|
} |
130
|
|
|
|