@@ -94,7 +94,11 @@ protected function setUp()
94
94
*/
95
95
public function testGetStatusInfo ()
96
96
{
97
- $ status = new Status ($ this ->getMock ('\\OpCacheGUI \\Format \\Byte ' ), $ this ->statusData );
97
+ $ status = new Status (
98
+ $ this ->getMock ('\\OpCacheGUI \\Format \\Byte ' ),
99
+ $ this ->getMock ('\\OpCacheGUI \\I18n \\Translator ' ),
100
+ $ this ->statusData
101
+ );
98
102
99
103
$ data = [];
100
104
@@ -118,7 +122,7 @@ public function testGetMemoryInfo()
118
122
$ formatter = $ this ->getMock ('\\OpCacheGUI \\Format \\Byte ' );
119
123
$ formatter ->method ('format ' )->will ($ this ->onConsecutiveCalls ('1KB ' , '2KB ' , '3KB ' ));
120
124
121
- $ status = new Status ($ formatter , $ this ->statusData );
125
+ $ status = new Status ($ formatter , $ this ->getMock ( '\\ OpCacheGUI \\ I18n \\ Translator ' ), $ this -> statusData );
122
126
123
127
$ data = $ this ->statusData ;
124
128
@@ -136,7 +140,14 @@ public function testGetMemoryInfo()
136
140
*/
137
141
public function testGetGraphMemoryInfo ()
138
142
{
139
- $ status = new Status ($ this ->getMock ('\\OpCacheGUI \\Format \\Byte ' ), $ this ->statusData );
143
+ $ translator = $ this ->getMock ('\\OpCacheGUI \\I18n \\Translator ' );
144
+ $ translator ->method ('translate ' )->will ($ this ->onConsecutiveCalls ('Used ' , 'Free ' , 'Wasted ' ));
145
+
146
+ $ status = new Status (
147
+ $ this ->getMock ('\\OpCacheGUI \\Format \\Byte ' ),
148
+ $ translator ,
149
+ $ this ->statusData
150
+ );
140
151
141
152
$ data = [
142
153
[
@@ -168,7 +179,11 @@ public function testGetStatsInfoWithOpCacheDisabled()
168
179
$ statusData = $ this ->statusData ;
169
180
$ statusData ['opcache_enabled ' ] = false ;
170
181
171
- $ status = new Status ($ this ->getMock ('\\OpCacheGUI \\Format \\Byte ' ), $ statusData );
182
+ $ status = new Status (
183
+ $ this ->getMock ('\\OpCacheGUI \\Format \\Byte ' ),
184
+ $ this ->getMock ('\\OpCacheGUI \\I18n \\Translator ' ),
185
+ $ statusData
186
+ );
172
187
173
188
$ data = [
174
189
[
@@ -199,7 +214,11 @@ public function testGetStatsInfoWithOpCacheDisabled()
199
214
*/
200
215
public function testGetStatsInfoWithOpCacheEnabled ()
201
216
{
202
- $ status = new Status ($ this ->getMock ('\\OpCacheGUI \\Format \\Byte ' ), $ this ->statusData );
217
+ $ status = new Status (
218
+ $ this ->getMock ('\\OpCacheGUI \\Format \\Byte ' ),
219
+ $ this ->getMock ('\\OpCacheGUI \\I18n \\Translator ' ),
220
+ $ this ->statusData
221
+ );
203
222
204
223
$ data = $ this ->statusData ['opcache_statistics ' ];
205
224
@@ -226,7 +245,11 @@ public function testGetStatsInfoWithOpCacheEnabledWithoutRestart()
226
245
227
246
$ statusData ['opcache_statistics ' ]['last_restart_time ' ] = 0 ;
228
247
229
- $ status = new Status ($ this ->getMock ('\\OpCacheGUI \\Format \\Byte ' ), $ statusData );
248
+ $ status = new Status (
249
+ $ this ->getMock ('\\OpCacheGUI \\Format \\Byte ' ),
250
+ $ this ->getMock ('\\OpCacheGUI \\I18n \\Translator ' ),
251
+ $ statusData
252
+ );
230
253
231
254
$ data = $ this ->statusData ['opcache_statistics ' ];
232
255
@@ -249,7 +272,10 @@ public function testGetStatsInfoWithOpCacheEnabledWithoutRestart()
249
272
*/
250
273
public function testGetGraphKeyStatsInfo ()
251
274
{
252
- $ status = new Status ($ this ->getMock ('\\OpCacheGUI \\Format \\Byte ' ), $ this ->statusData );
275
+ $ translator = $ this ->getMock ('\\OpCacheGUI \\I18n \\Translator ' );
276
+ $ translator ->method ('translate ' )->will ($ this ->onConsecutiveCalls ('Used ' , 'Free ' , 'Wasted ' ));
277
+
278
+ $ status = new Status ($ this ->getMock ('\\OpCacheGUI \\Format \\Byte ' ), $ translator , $ this ->statusData );
253
279
254
280
$ data = [
255
281
[
@@ -278,7 +304,10 @@ public function testGetGraphKeyStatsInfo()
278
304
*/
279
305
public function testGetGraphHitStatsInfo ()
280
306
{
281
- $ status = new Status ($ this ->getMock ('\\OpCacheGUI \\Format \\Byte ' ), $ this ->statusData );
307
+ $ translator = $ this ->getMock ('\\OpCacheGUI \\I18n \\Translator ' );
308
+ $ translator ->method ('translate ' )->will ($ this ->onConsecutiveCalls ('Hits ' , 'Misses ' , 'Blacklisted ' ));
309
+
310
+ $ status = new Status ($ this ->getMock ('\\OpCacheGUI \\Format \\Byte ' ), $ translator , $ this ->statusData );
282
311
283
312
$ data = [
284
313
[
@@ -311,7 +340,11 @@ public function testGetCachedScriptsEmpty()
311
340
312
341
unset($ statusData ['scripts ' ]);
313
342
314
- $ status = new Status ($ this ->getMock ('\\OpCacheGUI \\Format \\Byte ' ), $ statusData );
343
+ $ status = new Status (
344
+ $ this ->getMock ('\\OpCacheGUI \\Format \\Byte ' ),
345
+ $ this ->getMock ('\\OpCacheGUI \\I18n \\Translator ' ),
346
+ $ statusData
347
+ );
315
348
316
349
$ this ->assertSame ([], $ status ->getCachedScripts ());
317
350
}
@@ -326,7 +359,7 @@ public function testGetCachedScriptsFilled()
326
359
$ formatter = $ this ->getMock ('\\OpCacheGUI \\Format \\Byte ' );
327
360
$ formatter ->method ('format ' )->will ($ this ->onConsecutiveCalls ('1KB ' , '2KB ' , '3KB ' , '4KB ' , '5KB ' , '6KB ' ));
328
361
329
- $ status = new Status ($ formatter , $ this ->statusData );
362
+ $ status = new Status ($ formatter , $ this ->getMock ( '\\ OpCacheGUI \\ I18n \\ Translator ' ), $ this -> statusData );
330
363
331
364
$ data = [
332
365
[
@@ -395,7 +428,11 @@ public function testGetCachedScriptsZeroedTimestamp()
395
428
],
396
429
];
397
430
398
- $ status = new Status ($ this ->getMock ('\\OpCacheGUI \\Format \\Byte ' ), $ statusData );
431
+ $ status = new Status (
432
+ $ this ->getMock ('\\OpCacheGUI \\Format \\Byte ' ),
433
+ $ this ->getMock ('\\OpCacheGUI \\I18n \\Translator ' ),
434
+ $ statusData
435
+ );
399
436
400
437
$ this ->assertSame ([], $ status ->getCachedScripts ());
401
438
}
0 commit comments