public function getProtokollString() { $this->buffer->writeInt32BE($this->buffer->length() - 4, 0); $this->buffer->writeInt8(self::TYPE, 4); $this->buffer->writeInt32BE(strlen($this->channel->getName()), 5); $this->buffer->write($this->channel->getName(), 9); $this->buffer->write($this->message, 9 + strlen($this->channel->getName())); return (string) $this->buffer; }
public function testGetProtokollString() { $channel = new Channel('channel'); $message = 'php'; $buffer = new Buffer(4 + 1 + 4 + strlen($channel->getName()) + strlen($message)); $buffer->writeInt32BE($buffer->length() - 4, 0); $buffer->writeInt8(0x1, 4); $buffer->writeInt32BE(strlen($channel->getName()), 5); $buffer->write($channel->getName(), 9); $buffer->write($message, 9 + strlen($channel->getName())); $msg = new PublishMessage($channel, $message); $this->assertEquals((string) $buffer, $msg->getProtokollString()); }
public function testGetName() { $channel = new Channel('channel_one'); $this->assertEquals('channel_one', $channel->getName()); }