From 5838acad304ef70bf711e292a18d6abe9098ec8b Mon Sep 17 00:00:00 2001 From: Alex Renoki Date: Thu, 13 Aug 2020 22:52:12 +0300 Subject: [PATCH] Set up config for broadcasting --- tests/TestCase.php | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/tests/TestCase.php b/tests/TestCase.php index e1a19ab..8e32578 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -66,10 +66,31 @@ abstract class TestCase extends \Orchestra\Testbench\TestCase 'database' => env('REDIS_DB', '0'), ]); + $replicationDriver = getenv('REPLICATION_DRIVER') ?: 'local'; + $app['config']->set( - 'websockets.replication.driver', - getenv('REPLICATION_DRIVER') ?: 'local' + 'websockets.replication.driver', $replicationDriver ); + + $app['config']->set( + 'broadcasting.connections.websockets', [ + 'driver' => 'websockets', + 'key' => 'TestKey', + 'secret' => 'TestSecret', + 'app_id' => '1234', + 'options' => [ + 'cluster' => 'mt1', + 'encrypted' => true, + 'host' => '127.0.0.1', + 'port' => 6001, + 'scheme' => 'http', + ], + ] + ); + + if (in_array($replicationDriver, ['redis'])) { + $app['config']->set('broadcasting.default', 'websockets'); + } } protected function getWebSocketConnection(string $url = '/?appKey=TestKey'): Connection