public function testCloseConnection() { $directivesManager = $this->createDirectivesManagerMock(); $consumerManager = $this->createConsumerManagerMock(); $directivesManager->expects($this->once())->method('hasAccess')->will($this->returnValue(true)); $manager = new TopicsManager($directivesManager, $consumerManager); $conn = $this->getMock('Ratchet\\ConnectionInterface'); $conn->User = $this->getMock('Alchemy\\Phrasea\\Websocket\\Consumer\\ConsumerInterface'); $topic = new Topic('http://topic'); $topic->add($conn); // should be subscribed to be unsubscribed $manager->subscribe($conn, $topic); $manager->closeConnection($conn); $this->assertFalse($topic->has($conn)); }
public function testDoesNotHaveAfterRemove() { $conn = $this->newConn(); $topic = new Topic('Ras'); $topic->add($conn)->remove($conn); $this->assertFalse($topic->has($conn)); }