laravel-websockets/tests/TestsReplication.php

24 lines
631 B
PHP
Raw Normal View History

<?php
namespace BeyondCode\LaravelWebSockets\Tests;
2019-07-28 18:50:10 +00:00
use BeyondCode\LaravelWebSockets\Tests\Mocks\FakeReplicationClient;
use Illuminate\Support\Facades\Config;
use React\EventLoop\Factory;
use BeyondCode\LaravelWebSockets\PubSub\ReplicationInterface;
trait TestsReplication
{
public function setupReplication()
{
app()->singleton(ReplicationInterface::class, function () {
2019-07-28 18:50:10 +00:00
return (new FakeReplicationClient())->boot(Factory::create());
});
2019-07-28 18:50:10 +00:00
Config::set([
'websockets.replication.enabled' => true,
2019-07-28 18:50:10 +00:00
'websockets.replication.driver' => 'redis',
]);
}
}