@@ -32,6 +32,9 @@ class WidgetTest extends \PHPUnit\Framework\TestCase
32
32
*/
33
33
private $ conditionsHelper ;
34
34
35
+ /**
36
+ * @inheritdoc
37
+ */
35
38
protected function setUp ()
36
39
{
37
40
$ this ->dataStorageMock = $ this ->getMockBuilder (\Magento \Widget \Model \Config \Data::class)
@@ -55,6 +58,9 @@ protected function setUp()
55
58
);
56
59
}
57
60
61
+ /**
62
+ * Unit test for getWidget
63
+ */
58
64
public function testGetWidgets ()
59
65
{
60
66
$ expected = ['val1 ' , 'val2 ' ];
@@ -65,6 +71,9 @@ public function testGetWidgets()
65
71
$ this ->assertEquals ($ expected , $ result );
66
72
}
67
73
74
+ /**
75
+ * Unit test for getWidgetsWithFilter
76
+ */
68
77
public function testGetWidgetsWithFilter ()
69
78
{
70
79
$ configFile = __DIR__ . '/_files/mappedConfigArrayAll.php ' ;
@@ -78,6 +87,9 @@ public function testGetWidgetsWithFilter()
78
87
$ this ->assertEquals ($ expected , $ result );
79
88
}
80
89
90
+ /**
91
+ * Unit test for getWidgetsWithUnknownFilter
92
+ */
81
93
public function testGetWidgetsWithUnknownFilter ()
82
94
{
83
95
$ configFile = __DIR__ . '/_files/mappedConfigArrayAll.php ' ;
@@ -90,6 +102,9 @@ public function testGetWidgetsWithUnknownFilter()
90
102
$ this ->assertEquals ($ expected , $ result );
91
103
}
92
104
105
+ /**
106
+ * Unit test for getWidgetByClassType
107
+ */
93
108
public function testGetWidgetByClassType ()
94
109
{
95
110
$ widgetOne = ['@ ' => ['type ' => 'type1 ' ]];
@@ -101,6 +116,9 @@ public function testGetWidgetByClassType()
101
116
$ this ->assertNull ($ this ->widget ->getWidgetByClassType ('type2 ' ));
102
117
}
103
118
119
+ /**
120
+ * Unit test for getConfigAsObject
121
+ */
104
122
public function testGetConfigAsObject ()
105
123
{
106
124
$ configFile = __DIR__ . '/_files/mappedConfigArrayAll.php ' ;
@@ -135,6 +153,9 @@ public function testGetConfigAsObject()
135
153
$ this ->assertSame ($ supportedContainersExpected , $ resultObject ->getSupportedContainers ());
136
154
}
137
155
156
+ /**
157
+ * Unit test for getConfigAsObjectWidgetNoFound
158
+ */
138
159
public function testGetConfigAsObjectWidgetNoFound ()
139
160
{
140
161
$ this ->dataStorageMock ->expects ($ this ->once ())
@@ -146,6 +167,9 @@ public function testGetConfigAsObjectWidgetNoFound()
146
167
$ this ->assertSame ([], $ resultObject ->getData ());
147
168
}
148
169
170
+ /**
171
+ * Unit test for getWidgetDeclaration
172
+ */
149
173
public function testGetWidgetDeclaration ()
150
174
{
151
175
$ mathRandomMock = $ this ->createPartialMock (\Magento \Framework \Math \Random::class, ['getRandomString ' ]);
@@ -175,7 +199,7 @@ public function testGetWidgetDeclaration()
175
199
$ this ->conditionsHelper ->expects ($ this ->once ())->method ('encode ' )->with ($ conditions )
176
200
->willReturn ('encoded-conditions-string ' );
177
201
$ this ->escaperMock ->expects ($ this ->atLeastOnce ())
178
- ->method ('escapeQuote ' )
202
+ ->method ('escapeHtmlAttr ' )
179
203
->willReturnMap ([
180
204
['my "widget" ' , false , 'my "widget" ' ],
181
205
['1 ' , false , '1 ' ],
@@ -203,6 +227,9 @@ public function testGetWidgetDeclaration()
203
227
$ this ->assertContains ('type_name=""}} ' , $ result );
204
228
}
205
229
230
+ /**
231
+ * Unit test for getWidgetDeclarationWithZeroValueParam
232
+ */
206
233
public function testGetWidgetDeclarationWithZeroValueParam ()
207
234
{
208
235
$ mathRandomMock = $ this ->createPartialMock (\Magento \Framework \Math \Random::class, ['getRandomString ' ]);
0 commit comments