diff --git a/tests/Channels/PresenceChannelTest.php b/tests/Channels/PresenceChannelTest.php index e2d4de1..a72d94f 100644 --- a/tests/Channels/PresenceChannelTest.php +++ b/tests/Channels/PresenceChannelTest.php @@ -31,6 +31,8 @@ class PresenceChannelTest extends TestCase /** @test */ public function clients_with_valid_auth_signatures_can_join_presence_channels() { + $this->skipOnRedisReplication(); + $connection = $this->getWebSocketConnection(); $this->pusherServer->onOpen($connection); @@ -63,6 +65,8 @@ class PresenceChannelTest extends TestCase /** @test */ public function clients_with_valid_auth_signatures_can_leave_presence_channels() { + $this->skipOnRedisReplication(); + $connection = $this->getWebSocketConnection(); $this->pusherServer->onOpen($connection); @@ -102,6 +106,8 @@ class PresenceChannelTest extends TestCase /** @test */ public function clients_with_no_user_info_can_join_presence_channels() { + $this->skipOnRedisReplication(); + $connection = $this->getWebSocketConnection(); $this->pusherServer->onOpen($connection); diff --git a/tests/HttpApi/FetchChannelReplicationTest.php b/tests/HttpApi/FetchChannelReplicationTest.php index 6d0a3d4..92d265b 100644 --- a/tests/HttpApi/FetchChannelReplicationTest.php +++ b/tests/HttpApi/FetchChannelReplicationTest.php @@ -79,6 +79,8 @@ class FetchChannelReplicationTest extends TestCase /** @test */ public function replication_it_returns_presence_channel_information() { + $this->skipOnRedisReplication(); + $this->joinPresenceChannel('presence-channel'); $this->joinPresenceChannel('presence-channel'); diff --git a/tests/HttpApi/FetchChannelsTest.php b/tests/HttpApi/FetchChannelsTest.php index 8dcc1fe..05e7fe5 100644 --- a/tests/HttpApi/FetchChannelsTest.php +++ b/tests/HttpApi/FetchChannelsTest.php @@ -37,6 +37,8 @@ class FetchChannelsTest extends TestCase /** @test */ public function it_returns_the_channel_information() { + $this->skipOnRedisReplication(); + $this->joinPresenceChannel('presence-channel'); $connection = new Connection(); @@ -67,6 +69,8 @@ class FetchChannelsTest extends TestCase /** @test */ public function it_returns_the_channel_information_for_prefix() { + $this->skipOnRedisReplication(); + $this->joinPresenceChannel('presence-global.1'); $this->joinPresenceChannel('presence-global.1'); $this->joinPresenceChannel('presence-global.2'); @@ -103,6 +107,8 @@ class FetchChannelsTest extends TestCase /** @test */ public function it_returns_the_channel_information_for_prefix_with_user_count() { + $this->skipOnRedisReplication(); + $this->joinPresenceChannel('presence-global.1'); $this->joinPresenceChannel('presence-global.1'); $this->joinPresenceChannel('presence-global.2'); @@ -171,6 +177,8 @@ class FetchChannelsTest extends TestCase /** @test */ public function it_returns_empty_object_for_no_channels_found() { + $this->skipOnRedisReplication(); + $connection = new Connection(); $requestPath = '/apps/1234/channels'; diff --git a/tests/HttpApi/FetchUsersTest.php b/tests/HttpApi/FetchUsersTest.php index 43bc858..f68af14 100644 --- a/tests/HttpApi/FetchUsersTest.php +++ b/tests/HttpApi/FetchUsersTest.php @@ -87,6 +87,8 @@ class FetchUsersTest extends TestCase /** @test */ public function it_returns_connected_user_information() { + $this->skipOnRedisReplication(); + $this->joinPresenceChannel('presence-channel'); $connection = new Connection(); diff --git a/tests/TestCase.php b/tests/TestCase.php index b142833..7070aa4 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -200,14 +200,28 @@ abstract class TestCase extends \Orchestra\Testbench\TestCase protected function runOnlyOnRedisReplication() { if (config('websockets.replication.driver') !== 'redis') { - $this->markTestSkipped('Skipped test because the replication driver is set to Redis.'); + $this->markTestSkipped('Skipped test because the replication driver is not set to Redis.'); } } protected function runOnlyOnLocalReplication() { if (config('websockets.replication.driver') !== 'local') { - $this->markTestSkipped('Skipped test because the replication driver is set to Local.'); + $this->markTestSkipped('Skipped test because the replication driver is not set to Local.'); + } + } + + protected function skipOnRedisReplication() + { + if (config('websockets.replication.driver') === 'redis') { + $this->markTestSkipped('Skipped test because the replication driver is Redis.'); + } + } + + protected function skipOnLocalReplication() + { + if (config('websockets.replication.driver') === 'local') { + $this->markTestSkipped('Skipped test because the replication driver is Local.'); } }