Skip to content

Commit 428d4c2

Browse files
committed
Fix tests
1 parent 5112812 commit 428d4c2

5 files changed

Lines changed: 10 additions & 6 deletions

File tree

‎src/Helpers.php‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,8 @@ public static function deleteKey(callable $delete_key): string {
140140
return self::alert('No keys are selected.');
141141
}
142142

143-
public static function import(callable $exists, callable $store): void {
144-
if (!isset($_FILES['import']) || $_FILES['import']['error'] !== UPLOAD_ERR_OK || !is_uploaded_file($_FILES['import']['tmp_name'])) {
143+
public static function import(callable $exists, callable $store, bool $tests = false): void {
144+
if (!isset($_FILES['import']) || $_FILES['import']['error'] !== UPLOAD_ERR_OK || (!$tests && !is_uploaded_file($_FILES['import']['tmp_name']))) {
145145
return;
146146
}
147147

‎tests/Dashboards/APCu/APCuTest.php‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,8 @@ public function testExportAndImport(): void {
263263
static fn (string $key): bool => apcu_exists($key),
264264
static function (string $key, string $value, int $ttl): bool {
265265
return apcu_store($key, unserialize(base64_decode($value), ['allowed_classes' => false]), $ttl);
266-
}
266+
},
267+
true
267268
);
268269

269270
foreach ($keys_to_test as $key => $data) {

‎tests/Dashboards/Memcached/MemcachedTest.php‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -840,7 +840,8 @@ function (string $key): ?string {
840840

841841
Helpers::import(
842842
fn (string $key): bool => $this->memcached->exists($key),
843-
fn (string $key, string $value, int $ttl): bool => $this->memcached->set(urldecode($key), base64_decode($value), $ttl)
843+
fn (string $key, string $value, int $ttl): bool => $this->memcached->set(urldecode($key), base64_decode($value), $ttl),
844+
true
844845
);
845846

846847
foreach ($keys_to_test as $key => $data) {

‎tests/Dashboards/Redis/RedisTestCase.php‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2379,7 +2379,8 @@ function (string $key): bool {
23792379
},
23802380
function (string $key, string $value, int $ttl): bool {
23812381
return $this->redis->restoreKeys($key, $ttl * 1000, hex2bin($value));
2382-
}
2382+
},
2383+
true
23832384
);
23842385

23852386
foreach ($keys_to_test as $key => $data) {

‎tests/HelpersTest.php‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,8 @@ public function testImport(): void {
9595
static fn ($key): false => false,
9696
static function (string $key, string $value, int $ttl) use (&$stored): void {
9797
$stored[] = ['key' => $key, 'value' => $value, 'ttl' => $ttl];
98-
}
98+
},
99+
true
99100
);
100101

101102
unlink($_FILES['import']['tmp_name']);

0 commit comments

Comments
 (0)