/** * End subscription. * * @return void */ public function unsubscribe() { if ($this->active) { $this->client->sendFrame($this->getProtocol()->getUnsubscribeFrame($this->subscription->getDestination(), $this->subscription->getSubscriptionId(), false)); $this->active = false; } }
/** * Not acknowledge consumption of a message from a subscription * * @param Frame $frame * @return void */ public function nack(Frame $frame) { $this->client->sendFrame($this->getProtocol()->getNackFrame($frame), false); }
public function testClientWillAutoConnectOnSendFrame() { $connection = $this->getMockBuilder(Connection::class)->setMethods(['connect', 'getParser'])->disableOriginalConstructor()->getMock(); $connection->expects($this->once())->method('connect'); $connection->expects($this->any())->method('getParser')->willReturn(new Parser()); $client = new Client($connection); try { $client->sendFrame(new Message('test')); } catch (ConnectionException $connectionFailed) { $this->addToAssertionCount(1); } }