You've already forked Traefik-Redis-Api
I transformed a bug into a feature. Once you learn how, you'll never forget it
This commit is contained in:
@@ -7,18 +7,13 @@ namespace Siteworxpro\Tests\Traefik;
|
||||
use Mockery;
|
||||
use Predis\Command\FactoryInterface;
|
||||
use Siteworxpro\App\Facades\Redis;
|
||||
use Siteworxpro\App\Facades\RedisClient;
|
||||
use Siteworxpro\App\Traefik\EntityEnum;
|
||||
use Siteworxpro\App\Traefik\ProtocolEnum;
|
||||
use Siteworxpro\App\Traefik\RedisClient;
|
||||
use Siteworxpro\Tests\Unit;
|
||||
|
||||
class RedisClientRoutersTest extends Unit
|
||||
{
|
||||
protected function tearDown(): void
|
||||
{
|
||||
parent::tearDown();
|
||||
Mockery::close();
|
||||
}
|
||||
|
||||
private function createTest(ProtocolEnum $protocol): void
|
||||
{
|
||||
@@ -44,7 +39,7 @@ class RedisClientRoutersTest extends Unit
|
||||
->once()
|
||||
->andReturn(true);
|
||||
|
||||
new RedisClient()->createOrReplace('foo', [
|
||||
RedisClient::createOrReplace('foo', [
|
||||
'rule' => 'Host(`foo.localhost`)',
|
||||
'service' => 'foo',
|
||||
], EntityEnum::ROUTER, $protocol);
|
||||
@@ -108,7 +103,7 @@ class RedisClientRoutersTest extends Unit
|
||||
->with('traefik/' . $protocolEnum->getValue() . '/routers/foo/service')
|
||||
->andReturn('foo');
|
||||
|
||||
$routers = new RedisClient()->getRouter('foo', $protocolEnum);
|
||||
$routers = RedisClient::getRouter('foo', $protocolEnum);
|
||||
|
||||
$this->assertIsArray($routers);
|
||||
|
||||
@@ -138,7 +133,7 @@ class RedisClientRoutersTest extends Unit
|
||||
'traefik/' . $protocol->getValue() . '/routers/bar/url/0',
|
||||
]]);
|
||||
|
||||
$routers = new RedisClient()->getAllRouters($protocol);
|
||||
$routers = RedisClient::getAllRouters($protocol);
|
||||
|
||||
$this->assertIsArray($routers);
|
||||
$this->assertCount(2, $routers);
|
||||
|
||||
@@ -6,8 +6,10 @@ namespace Siteworxpro\Tests;
|
||||
|
||||
use Illuminate\Container\Container;
|
||||
use Illuminate\Support\Facades\Facade;
|
||||
use Illuminate\Support\Facades\Redis;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Siteworxpro\App\Facades\Config;
|
||||
use Siteworxpro\App\Facades\RedisClient;
|
||||
|
||||
abstract class Unit extends TestCase
|
||||
{
|
||||
@@ -19,7 +21,12 @@ abstract class Unit extends TestCase
|
||||
|
||||
protected function tearDown(): void
|
||||
{
|
||||
parent::tearDown();
|
||||
|
||||
Config::clearResolvedInstances();
|
||||
Redis::clearResolvedInstances();
|
||||
RedisClient::clearResolvedInstances();
|
||||
|
||||
Facade::setFacadeApplication(null);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user