Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
RobiNN1 committed Feb 9, 2025
1 parent a86cb57 commit b01f82d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
},
"require-dev": {
"phpstan/phpstan": "^2.0",
"phpunit/phpunit": "^11.5",
"phpunit/phpunit": "^11|^12.0",
"robinn/phpcacheadmin": "dev-master"
},
"minimum-stability": "dev",
Expand Down
2 changes: 1 addition & 1 deletion src/FileCacheDashboard.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
class FileCacheDashboard implements DashboardInterface {
use FileCacheTrait;

final public const VERSION = '1.5.0';
final public const VERSION = '2.0.0';

/**
* @var array<int, array<string, int|string>>
Expand Down
13 changes: 11 additions & 2 deletions tests/FileCacheTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

namespace RobiNN\FileCache\Tests;

use JsonException;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use RobiNN\Cache\CacheException;
Expand Down Expand Up @@ -46,12 +47,20 @@ protected function tearDown(): void {
}

/**
* @param string|array<int, string> $keys
* @param array<int, string>|string $keys
*/
private function deleteKeys(array|string $keys): void {
$delete_key = fn (string $key): bool => $this->filecache->delete($key);

try {
$_POST['delete'] = json_encode($keys, JSON_THROW_ON_ERROR);
} catch (JsonException) {
//
}

$this->assertSame(
Helpers::alert($this->template, (is_array($keys) ? 'Keys' : 'Key "'.$keys.'"').' has been deleted.', 'success'),
Helpers::deleteKey($this->template, fn (string $key): bool => $this->filecache->delete($key), false, $keys)
Helpers::deleteKey($this->template, $delete_key)
);
}

Expand Down

0 comments on commit b01f82d

Please sign in to comment.