Merge branch 'refs/heads/easen'
This commit is contained in:
commit
f25e030779
@ -77,8 +77,11 @@ class TopicManager implements WsServerInterface, WampServerInterface {
|
|||||||
public function onClose(ConnectionInterface $conn) {
|
public function onClose(ConnectionInterface $conn) {
|
||||||
$this->app->onClose($conn);
|
$this->app->onClose($conn);
|
||||||
|
|
||||||
foreach ($this->topicLookup as $topic) {
|
foreach ($this->topicLookup as $topic => $storage) {
|
||||||
$topic->remove($conn);
|
$storage->remove($conn);
|
||||||
|
if (0 === $storage->count()) {
|
||||||
|
unset($this->topicLookup[$topic]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -166,12 +166,19 @@ class TopicManagerTest extends \PHPUnit_Framework_TestCase {
|
|||||||
$method = $class->getMethod('getTopic');
|
$method = $class->getMethod('getTopic');
|
||||||
$method->setAccessible(true);
|
$method->setAccessible(true);
|
||||||
|
|
||||||
|
$attribute = $class->getProperty('topicLookup');
|
||||||
|
$attribute->setAccessible(true);
|
||||||
|
|
||||||
$topic = $method->invokeArgs($this->mngr, array($name));
|
$topic = $method->invokeArgs($this->mngr, array($name));
|
||||||
|
|
||||||
|
$this->assertCount(1, $attribute->getValue($this->mngr));
|
||||||
|
|
||||||
$this->mngr->onSubscribe($this->conn, $name);
|
$this->mngr->onSubscribe($this->conn, $name);
|
||||||
$this->mngr->onClose($this->conn);
|
$this->mngr->onClose($this->conn);
|
||||||
|
|
||||||
$this->assertFalse($topic->has($this->conn));
|
$this->assertFalse($topic->has($this->conn));
|
||||||
|
|
||||||
|
$this->assertCount(0, $attribute->getValue($this->mngr));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testOnErrorBubbles() {
|
public function testOnErrorBubbles() {
|
||||||
|
Loading…
Reference in New Issue
Block a user