Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
RobiNN1 committed Oct 5, 2024
1 parent c6a0c59 commit 4a39cc8
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 4 deletions.
6 changes: 5 additions & 1 deletion tests/Clients/PHPMemTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
namespace Tests\Clients;

use PHPUnit\Framework\Attributes\DataProvider;
use RobiNN\Pca\Config;
use RobiNN\Pca\Dashboards\Memcached\Compatibility\PHPMem;
use RobiNN\Pca\Dashboards\Memcached\MemcachedException;
use Tests\TestCase;
Expand All @@ -17,7 +18,10 @@ final class PHPMemTest extends TestCase {
private PHPMem $phpmem;

protected function setUp(): void {
$this->phpmem = new PHPMem(['host' => '127.0.0.1', 'port' => 11211]);
$this->phpmem = new PHPMem([
'host' => Config::get('memcached')[0]['host'],
'port' => Config::get('memcached')[0]['port'],
]);
}

public function testIsConnected(): void {
Expand Down
7 changes: 6 additions & 1 deletion tests/Clients/PredisTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,19 @@
use Iterator;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use RobiNN\Pca\Config;
use RobiNN\Pca\Dashboards\DashboardException;
use RobiNN\Pca\Dashboards\Redis\Compatibility\Predis;

final class PredisTest extends TestCase {
private Predis $predis;

protected function setUp(): void {
$this->predis = new Predis(['host' => '127.0.0.1']);
$this->predis = new Predis([
'host' => Config::get('redis')[0]['host'],
'port' => Config::get('redis')[0]['port'],
'database' => 10,
]);
}

public static function keysProvider(): Iterator {
Expand Down
6 changes: 5 additions & 1 deletion tests/Dashboards/MemcachedTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

use Iterator;
use PHPUnit\Framework\Attributes\DataProvider;
use RobiNN\Pca\Config;
use RobiNN\Pca\Dashboards\DashboardException;
use RobiNN\Pca\Dashboards\Memcached\Compatibility\Memcache;
use RobiNN\Pca\Dashboards\Memcached\Compatibility\Memcached;
Expand All @@ -34,7 +35,10 @@ final class MemcachedTest extends TestCase {
protected function setUp(): void {
$this->template = new Template();
$this->dashboard = new MemcachedDashboard($this->template);
$this->memcached = $this->dashboard->connect(['host' => '127.0.0.1']);
$this->memcached = $this->dashboard->connect([
'host' => Config::get('memcached')[0]['host'],
'port' => Config::get('memcached')[0]['port'],
]);
$this->dashboard->memcached = $this->memcached;
}

Expand Down
7 changes: 6 additions & 1 deletion tests/Dashboards/RedisTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

use Exception;
use PHPUnit\Framework\Attributes\DataProvider;
use RobiNN\Pca\Config;
use RobiNN\Pca\Dashboards\DashboardException;
use RobiNN\Pca\Dashboards\Redis\Compatibility\Predis;
use RobiNN\Pca\Dashboards\Redis\Compatibility\Redis;
Expand All @@ -32,7 +33,11 @@ final class RedisTest extends TestCase {
protected function setUp(): void {
$this->template = new Template();
$this->dashboard = new RedisDashboard($this->template);
$this->redis = $this->dashboard->connect(['host' => '127.0.0.1', 'database' => 10]);
$this->redis = $this->dashboard->connect([
'host' => Config::get('redis')[0]['host'],
'port' => Config::get('redis')[0]['port'],
'database' => 10,
]);
$this->dashboard->redis = $this->redis;
}

Expand Down

0 comments on commit 4a39cc8

Please sign in to comment.