/** * @group disconnected */ public function testConnectionWrite() { $serialized = "*1\r\n\$4\r\nPING\r\n"; $command = $this->getMock('Predis\\Command\\CommandInterface'); $connection = $this->getMock('Predis\\Connection\\ComposableConnectionInterface'); $serializer = $this->getMock('Predis\\Protocol\\CommandSerializerInterface'); $protocol = new ComposableTextProtocol(); $protocol->setSerializer($serializer); $connection->expects($this->once())->method('writeBytes')->with($this->equalTo($serialized)); $serializer->expects($this->once())->method('serialize')->with($command)->will($this->returnValue($serialized)); $protocol->write($connection, $command); }