Skip to content

Commit 6ba58d8

Browse files
committed
Fix tests
1 parent 4c83b3e commit 6ba58d8

File tree

6 files changed

+12
-14
lines changed

6 files changed

+12
-14
lines changed

src/Dashboards/APCu/APCuTrait.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ public function getAllKeys(): array {
217217
*
218218
* @return array<int, array<string, string|int>>
219219
*/
220-
private function keysTableView(array $keys): array {
220+
public function keysTableView(array $keys): array {
221221
$formatted_keys = [];
222222

223223
foreach ($keys as $key_data) {
@@ -243,7 +243,7 @@ private function keysTableView(array $keys): array {
243243
*
244244
* @return array<int, array<string, string|int>>
245245
*/
246-
private function keysTreeView(array $keys): array {
246+
public function keysTreeView(array $keys): array {
247247
$separator = Config::get('apcu-separator', ':');
248248
$this->template->addGlobal('separator', $separator);
249249

@@ -314,8 +314,6 @@ static function (string $key, string $value, int $ttl): bool {
314314
$paginator = new Paginator($this->template, $keys);
315315
$paginated_keys = $paginator->getPaginated();
316316

317-
318-
319317
if (Http::get('view', Config::get('list-view', 'table')) === 'tree') {
320318
$keys_to_display = $this->keysTreeView($paginated_keys);
321319
} else {

src/Dashboards/Memcached/MemcachedTrait.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ public function getAllKeys(): array {
237237
*
238238
* @return array<int, array<string, string|int>>
239239
*/
240-
private function keysTableView(array $keys): array {
240+
public function keysTableView(array $keys): array {
241241
$formatted_keys = [];
242242

243243
foreach ($keys as $key_data) {
@@ -262,7 +262,7 @@ private function keysTableView(array $keys): array {
262262
*
263263
* @throws MemcachedException
264264
*/
265-
private function keysTreeView(array $keys): array {
265+
public function keysTreeView(array $keys): array {
266266
$separator = $this->servers[$this->current_server]['separator'] ?? ':';
267267

268268
if (version_compare($this->memcached->version(), '1.5.19', '>=')) {

src/Dashboards/Redis/RedisTrait.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,7 @@ public function isCommandSupported(string $command): bool {
441441
*
442442
* @throws Exception
443443
*/
444-
private function keysTableView(array $keys): array {
444+
public function keysTableView(array $keys): array {
445445
$formatted_keys = [];
446446
$keys_array = array_column($keys, 'key');
447447
$pipeline = $this->redis->pipelineKeys($keys_array);
@@ -469,7 +469,7 @@ private function keysTableView(array $keys): array {
469469
*
470470
* @throws Exception
471471
*/
472-
private function keysTreeView(array $keys): array {
472+
public function keysTreeView(array $keys): array {
473473
$keys_array = array_column($keys, 'key');
474474
$pipeline = $this->redis->pipelineKeys($keys_array);
475475
$separator = $this->servers[$this->current_server]['separator'] ?? ':';

tests/Dashboards/APCuTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ public function testGetAllKeysTableView(): void {
8888
apcu_store('pu-test-table1', 'value1');
8989
apcu_store('pu-test-table2', 'value2');
9090
$_GET['s'] = 'pu-test-table';
91-
$_GET['view'] = 'table';
9291

9392
$result = $this->dashboard->getAllKeys();
9493

@@ -113,6 +112,7 @@ public function testGetAllKeysTableView(): void {
113112
],
114113
];
115114

115+
$result = $this->dashboard->keysTableView($result);
116116
$result = $this->normalizeInfoFields($result, ['bytes_size', 'number_hits', 'timediff_last_used', 'time_created']);
117117

118118
$this->assertEquals($this->sortKeys($expected), $this->sortKeys($result));
@@ -123,7 +123,6 @@ public function testGetAllKeysTreeView(): void {
123123
apcu_store('pu-test-tree1:sub2', 'value2');
124124
apcu_store('pu-test-tree2', 'value3');
125125
$_GET['s'] = 'pu-test-tree';
126-
$_GET['view'] = 'tree';
127126

128127
$result = $this->dashboard->getAllKeys();
129128

@@ -168,6 +167,7 @@ public function testGetAllKeysTreeView(): void {
168167
],
169168
];
170169

170+
$result = $this->dashboard->keysTreeView($result);
171171
$result = $this->normalizeInfoFields($result, ['bytes_size', 'number_hits', 'timediff_last_used', 'time_created']);
172172

173173
$this->assertEquals($this->sortTreeKeys($expected), $this->sortTreeKeys($result));

tests/Dashboards/MemcachedTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,6 @@ public function testGetAllKeysTableView(): void {
162162
$this->memcached->set('pu-test-table1', 'value1');
163163
$this->memcached->set('pu-test-table2', 'value2');
164164
$_GET['s'] = 'pu-test-table';
165-
$_GET['view'] = 'table';
166165

167166
$result = $this->dashboard->getAllKeys();
168167

@@ -183,6 +182,7 @@ public function testGetAllKeysTableView(): void {
183182
],
184183
];
185184

185+
$result = $this->dashboard->keysTableView($result);
186186
$result = $this->normalizeInfoFields($result, ['bytes_size', 'timediff_last_access']);
187187

188188
$this->assertEquals($this->sortKeys($expected), $this->sortKeys($result));
@@ -198,7 +198,6 @@ public function testGetAllKeysTreeView(): void {
198198
$this->memcached->set('pu-test-tree1:sub2', 'value2');
199199
$this->memcached->set('pu-test-tree2', 'value3');
200200
$_GET['s'] = 'pu-test-tree';
201-
$_GET['view'] = 'tree';
202201

203202
$result = $this->dashboard->getAllKeys();
204203

@@ -238,6 +237,7 @@ public function testGetAllKeysTreeView(): void {
238237
],
239238
];
240239

240+
$result = $this->dashboard->keysTreeView($result);
241241
$result = $this->normalizeInfoFields($result, ['bytes_size', 'timediff_last_access']);
242242

243243
$this->assertEquals($this->sortTreeKeys($expected), $this->sortTreeKeys($result));

tests/Dashboards/Redis/RedisTestCase.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,6 @@ public function testGetAllKeysTableView(): void {
250250
$this->redis->set('pu-test-table1', 'value1');
251251
$this->redis->set('pu-test-table2', 'value2');
252252
$_GET['s'] = 'pu-test-table*';
253-
$_GET['view'] = 'table';
254253

255254
$result = $this->dashboard->getAllKeys();
256255

@@ -273,6 +272,7 @@ public function testGetAllKeysTableView(): void {
273272
],
274273
];
275274

275+
$result = $this->dashboard->keysTableView($result);
276276
$result = $this->normalizeInfoFields($result, ['bytes_size']);
277277

278278
$this->assertEquals($this->sortKeys($expected), $this->sortKeys($result));
@@ -286,7 +286,6 @@ public function testGetAllKeysTreeView(): void {
286286
$this->redis->set('pu-test-tree1:sub2', 'value2');
287287
$this->redis->set('pu-test-tree2', 'value3');
288288
$_GET['s'] = 'pu-test-tree*';
289-
$_GET['view'] = 'tree';
290289

291290
$result = $this->dashboard->getAllKeys();
292291

@@ -329,6 +328,7 @@ public function testGetAllKeysTreeView(): void {
329328
],
330329
];
331330

331+
$result = $this->dashboard->keysTreeView($result);
332332
$result = $this->normalizeInfoFields($result, ['bytes_size']);
333333

334334
$this->assertEquals($this->sortTreeKeys($expected), $this->sortTreeKeys($result));

0 commit comments

Comments
 (0)