diff --git a/src/Ratchet/Wamp/TopicManager.php b/src/Ratchet/Wamp/TopicManager.php index a69e315..bceee73 100644 --- a/src/Ratchet/Wamp/TopicManager.php +++ b/src/Ratchet/Wamp/TopicManager.php @@ -77,11 +77,8 @@ class TopicManager implements WsServerInterface, WampServerInterface { public function onClose(ConnectionInterface $conn) { $this->app->onClose($conn); - foreach ($this->topicLookup as $topic => $storage) { - $storage->remove($conn); - if (0 === $storage->count()) { - unset($this->topicLookup[$topic]); - } + foreach ($this->topicLookup as $topic) { + $topic->remove($conn); } } diff --git a/tests/unit/Wamp/TopicManagerTest.php b/tests/unit/Wamp/TopicManagerTest.php index 7439064..0c31d9a 100644 --- a/tests/unit/Wamp/TopicManagerTest.php +++ b/tests/unit/Wamp/TopicManagerTest.php @@ -166,19 +166,12 @@ class TopicManagerTest extends \PHPUnit_Framework_TestCase { $method = $class->getMethod('getTopic'); $method->setAccessible(true); - $attribute = $class->getProperty('topicLookup'); - $attribute->setAccessible(true); - $topic = $method->invokeArgs($this->mngr, array($name)); - $this->assertCount(1, $attribute->getValue($this->mngr)); - $this->mngr->onSubscribe($this->conn, $name); $this->mngr->onClose($this->conn); $this->assertFalse($topic->has($this->conn)); - - $this->assertCount(0, $attribute->getValue($this->mngr)); } public function testOnErrorBubbles() {