Skip to content

Commit 1dc183c

Browse files
committed
Fixed tests
1 parent 21eac99 commit 1dc183c

1 file changed

Lines changed: 56 additions & 33 deletions

File tree

test/Unit/OpCache/StatusTest.php

Lines changed: 56 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -139,17 +139,20 @@ public function testGetGraphMemoryInfo()
139139
$status = new Status($this->getMock('\\OpCacheGUI\\Format\\Byte'), $this->statusData);
140140

141141
$data = [
142-
[
143-
'value' => $this->statusData['memory_usage']['wasted_memory'],
144-
'color' => '#e0642e',
145-
],
146142
[
147143
'value' => $this->statusData['memory_usage']['used_memory'],
148-
'color' => '#2e97e0',
144+
'color' => '#e74c3c',
145+
'label' => 'Used',
149146
],
150147
[
151148
'value' => $this->statusData['memory_usage']['free_memory'],
152-
'color' => '#bce02e',
149+
'color' => '#2ecc71',
150+
'label' => 'Free',
151+
],
152+
[
153+
'value' => $this->statusData['memory_usage']['wasted_memory'],
154+
'color' => '#16a085',
155+
'label' => 'Wasted',
153156
],
154157
];
155158

@@ -168,19 +171,23 @@ public function testGetStatsInfoWithOpCacheDisabled()
168171
$status = new Status($this->getMock('\\OpCacheGUI\\Format\\Byte'), $statusData);
169172

170173
$data = [
171-
'num_cached_scripts' => 0,
172-
'num_cached_keys' => 0,
173-
'max_cached_keys' => 0,
174-
'hits' => 0,
175-
'misses' => 0,
176-
'blacklist_misses' => 0,
177-
'blacklist_miss_ratio' => 'n/a',
178-
'opcache_hit_rate' => 'n/a',
179-
'start_time' => 'n/a',
180-
'last_restart_time' => 'n/a',
181-
'oom_restarts' => 'n/a',
182-
'hash_restarts' => 'n/a',
183-
'manual_restarts' => 'n/a',
174+
[
175+
'num_cached_scripts' => 0,
176+
'num_cached_keys' => 0,
177+
'max_cached_keys' => 0,
178+
'hits' => 0,
179+
'misses' => 0,
180+
'blacklist_misses' => 0,
181+
'blacklist_miss_ratio' => 'n/a',
182+
],
183+
[
184+
'opcache_hit_rate' => 'n/a',
185+
'start_time' => 'n/a',
186+
'last_restart_time' => 'n/a',
187+
'oom_restarts' => 'n/a',
188+
'hash_restarts' => 'n/a',
189+
'manual_restarts' => 'n/a',
190+
]
184191
];
185192

186193
$this->assertSame($data, $status->getStatsInfo());
@@ -201,7 +208,12 @@ public function testGetStatsInfoWithOpCacheEnabled()
201208
$data['start_time'] = '13:41:33 08-10-2014';
202209
$data['last_restart_time'] = '17:40:00 08-10-2014';
203210

204-
$this->assertSame($data, $status->getStatsInfo());
211+
$formattedData = [
212+
array_slice($data, 0, 7, true),
213+
array_slice($data, 7, null, true),
214+
];
215+
216+
$this->assertSame($formattedData, $status->getStatsInfo());
205217
}
206218

207219
/**
@@ -223,7 +235,12 @@ public function testGetStatsInfoWithOpCacheEnabledWithoutRestart()
223235
$data['start_time'] = '13:41:33 08-10-2014';
224236
$data['last_restart_time'] = null;
225237

226-
$this->assertSame($data, $status->getStatsInfo());
238+
$formattedData = [
239+
array_slice($data, 0, 7, true),
240+
array_slice($data, 7, null, true),
241+
];
242+
243+
$this->assertSame($formattedData, $status->getStatsInfo());
227244
}
228245

229246
/**
@@ -235,17 +252,20 @@ public function testGetGraphKeyStatsInfo()
235252
$status = new Status($this->getMock('\\OpCacheGUI\\Format\\Byte'), $this->statusData);
236253

237254
$data = [
238-
[
239-
'value' => 14,
240-
'color' => '#e0642e',
241-
],
242255
[
243256
'value' => 38,
244-
'color' => '#2e97e0',
257+
'color' => '#e74c3c',
258+
'label' => 'Used',
245259
],
246260
[
247261
'value' => 7911,
248-
'color' => '#bce02e',
262+
'color' => '#2ecc71',
263+
'label' => 'Free',
264+
],
265+
[
266+
'value' => 14,
267+
'color' => '#16a085',
268+
'label' => 'Wasted',
249269
],
250270
];
251271

@@ -262,16 +282,19 @@ public function testGetGraphHitStatsInfo()
262282

263283
$data = [
264284
[
265-
'value' => 59,
266-
'color' => '#e0642e',
285+
'value' => 1160,
286+
'color' => '#e74c3c',
287+
'label' => 'Hits',
267288
],
268289
[
269-
'value' => 0,
270-
'color' => '#2e97e0',
290+
'value' => 59,
291+
'color' => '#2ecc71',
292+
'label' => 'Misses',
271293
],
272294
[
273-
'value' => 1160,
274-
'color' => '#bce02e',
295+
'value' => 0,
296+
'color' => '#16a085',
297+
'label' => 'Blacklisted',
275298
],
276299
];
277300

0 commit comments

Comments
 (0)