Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
RobiNN1 committed May 8, 2024
1 parent b8f09c5 commit b3b3b9e
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"require-dev": {
"clue/phar-composer": "^1.4",
"phpstan/phpstan": "^1.10",
"phpunit/phpunit": "^9.6"
"phpunit/phpunit": "^9.6|^10.5|^11.1"
},
"suggest": {
"ext-apcu": "Required for the APCu dashboard.",
Expand Down
2 changes: 2 additions & 0 deletions tests/Clients/PHPMemTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

namespace Tests\Clients;

use PHPUnit\Framework\Attributes\DataProvider;
use RobiNN\Pca\Dashboards\Memcached\Compatibility\PHPMem;
use RobiNN\Pca\Dashboards\Memcached\MemcachedException;
use Tests\TestCase;
Expand All @@ -31,6 +32,7 @@ public function testIsConnected(): void {
*
* @throws MemcachedException
*/
#[DataProvider('keysProvider')]
public function testSetGetKey(string $type, $original, $expected): void {
$key = 'pu-pmem-test-'.$type;
$this->phpmem->set($key, $original);
Expand Down
3 changes: 3 additions & 0 deletions tests/Clients/PredisTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
namespace Tests\Clients;

use Iterator;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use RobiNN\Pca\Dashboards\DashboardException;
use RobiNN\Pca\Dashboards\Redis\Compatibility\Predis;
Expand All @@ -34,6 +35,7 @@ public static function keysProvider(): Iterator {
*
* @throws DashboardException
*/
#[DataProvider('keysProvider')]
public function testGetType(string $key): void {
$this->predis->set('pu-pred-test-string', 'value');
$this->predis->sadd('pu-pred-test-set', ['value1', 'value2', 'value3']);
Expand All @@ -50,6 +52,7 @@ public function testGetType(string $key): void {
/**
* @dataProvider keysProvider
*/
#[DataProvider('keysProvider')]
public function testDelete(string $key): void {
$this->predis->del('pu-pred-test-'.$key);
$this->assertSame(0, $this->predis->exists('pu-pred-test-'.$key));
Expand Down
2 changes: 2 additions & 0 deletions tests/Dashboards/APCuTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

namespace Tests\Dashboards;

use PHPUnit\Framework\Attributes\DataProvider;
use RobiNN\Pca\Dashboards\APCu\APCuDashboard;
use RobiNN\Pca\Helpers;
use RobiNN\Pca\Http;
Expand Down Expand Up @@ -64,6 +65,7 @@ public function testDeleteKeys(): void {
* @param mixed $original
* @param mixed $expected
*/
#[DataProvider('keysProvider')]
public function testSetGetKey(string $type, $original, $expected): void {
apcu_store('pu-test-'.$type, $original);
$this->assertSame($expected, Helpers::mixedToString(apcu_fetch('pu-test-'.$type)));
Expand Down
3 changes: 3 additions & 0 deletions tests/Dashboards/MemcachedTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
namespace Tests\Dashboards;

use Iterator;
use PHPUnit\Framework\Attributes\DataProvider;
use RobiNN\Pca\Dashboards\DashboardException;
use RobiNN\Pca\Dashboards\Memcached\Compatibility\Memcache;
use RobiNN\Pca\Dashboards\Memcached\Compatibility\Memcached;
Expand Down Expand Up @@ -90,6 +91,7 @@ public function testDeleteKeys(): void {
*
* @throws MemcachedException
*/
#[DataProvider('keysProvider')]
public function testSetGetKey(string $type, $original, $expected): void {
$this->memcached->set('pu-test-'.$type, $original);
$this->assertSame($expected, Helpers::mixedToString($this->memcached->getKey('pu-test-'.$type)));
Expand Down Expand Up @@ -149,6 +151,7 @@ public static function commandDataProvider(): Iterator {
*
* @throws MemcachedException
*/
#[DataProvider('commandDataProvider')]
public function testRunCommand(string $expected, string $command): void {
$this->assertSame(strtr($expected, ['\r\n' => "\r\n"]), $this->memcached->runCommand($command));
}
Expand Down
2 changes: 2 additions & 0 deletions tests/Dashboards/RedisTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
namespace Tests\Dashboards;

use Exception;
use PHPUnit\Framework\Attributes\DataProvider;
use RobiNN\Pca\Dashboards\DashboardException;
use RobiNN\Pca\Dashboards\Redis\Compatibility\Predis;
use RobiNN\Pca\Dashboards\Redis\Compatibility\Redis;
Expand Down Expand Up @@ -92,6 +93,7 @@ public function testDeleteKeys(): void {
*
* @throws Exception
*/
#[DataProvider('keysProvider')]
public function testSetGetKey(string $type, $original, $expected): void {
$original = is_array($original) || is_object($original) ? serialize($original) : $original;

Expand Down

0 comments on commit b3b3b9e

Please sign in to comment.