This commit is contained in:
Marcel Pociot 2018-12-02 23:49:45 +01:00
parent 89ace08139
commit 46bbaa03fb
1 changed files with 21 additions and 0 deletions

View File

@ -28,6 +28,27 @@ class ChannelTest extends TestCase
]);
}
/** @test */
public function clients_can_unsubscribe_from_channels()
{
$connection = $this->getConnectedWebSocketConnection(['test-channel']);
$channel = $this->getChannel($connection, 'test-channel');
$this->assertTrue($channel->hasConnections());
$message = new Message(json_encode([
'event' => 'pusher:unsubscribe',
'data' => [
'channel' => 'test-channel'
],
]));
$this->pusherServer->onMessage($connection, $message);
$this->assertFalse($channel->hasConnections());
}
/** @test */
public function a_client_cannot_broadcast_to_other_clients_by_default()
{