2019-04-05 19:30:41 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace BeyondCode\LaravelWebSockets\Tests;
|
|
|
|
|
|
|
|
|
|
use React\EventLoop\Factory;
|
2019-07-28 19:29:16 +00:00
|
|
|
use Illuminate\Support\Facades\Config;
|
2019-04-05 19:30:41 +00:00
|
|
|
use BeyondCode\LaravelWebSockets\PubSub\ReplicationInterface;
|
2019-07-28 19:29:16 +00:00
|
|
|
use BeyondCode\LaravelWebSockets\Tests\Mocks\FakeReplicationClient;
|
2019-04-05 19:30:41 +00:00
|
|
|
|
|
|
|
|
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-04-05 19:30:41 +00:00
|
|
|
});
|
|
|
|
|
|
2019-07-28 18:50:10 +00:00
|
|
|
Config::set([
|
2019-04-05 19:30:41 +00:00
|
|
|
'websockets.replication.enabled' => true,
|
2019-07-28 18:50:10 +00:00
|
|
|
'websockets.replication.driver' => 'redis',
|
2019-04-05 19:30:41 +00:00
|
|
|
]);
|
|
|
|
|
}
|
|
|
|
|
}
|