Updated tests

This commit is contained in:
Alex Renoki 2020-09-04 22:26:46 +03:00
parent 1dfe14a517
commit 1e2672d9e0
3 changed files with 9 additions and 7 deletions

View File

@ -55,7 +55,7 @@ class PresenceChannelReplicationTest extends TestCase
->assertCalled('publish');
$this->assertNotNull(
Redis::hget('laravel_database_1234:presence-channel', $connection->socketId)
$this->redis->hget('laravel_database_1234:presence-channel', $connection->socketId)
);
}

View File

@ -47,7 +47,7 @@ class ConnectionTest extends TestCase
{
$this->runOnlyOnRedisReplication();
Redis::hdel('laravel_database_1234', 'connections');
$this->redis->hdel('laravel_database_1234', 'connections');
$this->app['config']->set('websockets.apps.0.capacity', 2);

View File

@ -79,8 +79,6 @@ abstract class TestCase extends BaseTestCase
$this->loadMigrationsFrom(__DIR__.'/../database/migrations');
$this->pusherServer = $this->app->make(config('websockets.handlers.websocket'));
$this->redis = Redis::connection();
}
/**
@ -272,11 +270,11 @@ abstract class TestCase extends BaseTestCase
*/
protected function configurePubSub()
{
$replicationDriver = config('websockets.replication.driver', 'local');
// Replace the publish and subscribe clients with a Mocked
// factory lazy instance on boot.
$this->app->singleton(ReplicationInterface::class, function () {
$driver = config('websockets.replication.driver', 'local');
$this->app->singleton(ReplicationInterface::class, function () use ($replicationDriver) {
$client = config(
"websockets.replication.{$driver}.client",
\BeyondCode\LaravelWebSockets\PubSub\Drivers\LocalClient::class
@ -286,6 +284,10 @@ abstract class TestCase extends BaseTestCase
$this->loop, Mocks\RedisFactory::class
);
});
if ($replicationDriver === 'redis') {
$this->redis = Redis::connection();
}
}
/**