public function testUnsubscribe() { $this->testSubject->subscribe('commandOne'); $this->testSubject->subscribe('commandTwo'); $anotherNode = new RedisTemplate('tcp://127.0.0.1:6379?read_write_timeout=-1', 'test-node2', []); $anotherNode->subscribe('commandTwo'); $this->testSubject->unsubscribe('commandOne'); $this->testSubject->unsubscribe('commandTwo'); $this->assertEmpty($this->testSubject->getSubscriptions('commandOne')); $secondMembers = $this->testSubject->getSubscriptions('commandTwo'); $this->assertCount(1, $secondMembers); $this->assertContains('test-node2', $secondMembers); }
/** * */ public function clearSubscriptions() { foreach ($this->localSegment->getSubscriptions() as $command => $handler) { $this->template->unsubscribe($command); } }