From 7b68a3e9c339af535277e48d5df3df738603bb59 Mon Sep 17 00:00:00 2001 From: Reasno Date: Wed, 20 May 2020 17:56:57 +0800 Subject: [PATCH] test: test #1771 --- src/socketio-server/tests/Cases/SocketTest.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/socketio-server/tests/Cases/SocketTest.php b/src/socketio-server/tests/Cases/SocketTest.php index c7ad946ab..998a34c1f 100644 --- a/src/socketio-server/tests/Cases/SocketTest.php +++ b/src/socketio-server/tests/Cases/SocketTest.php @@ -98,4 +98,17 @@ class SocketTest extends AbstractTestCase $socket1->to('room')->emit('hello'); $this->assertTrue(true); } + + public function testBroadcast() + { + $socket1 = make(Socket::class, [ + 'fd' => 1, + 'nsp' => '/', + ]); + $reflection = new \ReflectionClass(Socket::class); + $prop = $reflection->getProperty('broadcast'); + $prop->setAccessible(true); + $this->assertFalse($prop->getValue($socket1)); + $this->assertTrue($prop->getValue($socket1->broadcast)); + } }