Add test
This commit is contained in:
parent
89ace08139
commit
46bbaa03fb
|
|
@ -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 */
|
/** @test */
|
||||||
public function a_client_cannot_broadcast_to_other_clients_by_default()
|
public function a_client_cannot_broadcast_to_other_clients_by_default()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue