Author: Daniele Alessandri (suppakilla@gmail.com)
Inheritance: implements Predis\Protocol\ProtocolProcessorInterface
 /**
  * @group disconnected
  */
 public function testConnectionRead()
 {
     $connection = $this->getMock('Predis\\Connection\\CompositeConnectionInterface');
     $reader = $this->getMock('Predis\\Protocol\\ResponseReaderInterface');
     $protocol = new CompositeProtocolProcessor(null, $reader);
     $reader->expects($this->once())->method('read')->with($connection)->will($this->returnValue('bulk'));
     $this->assertSame('bulk', $protocol->read($connection));
 }
 /**
  * @group disconnected
  */
 public function testReadResponse()
 {
     $reader = new ResponseReader();
     $protocol = new CompositeProtocolProcessor();
     $protocol->setResponseReader($reader);
     $connection = $this->getMock('Predis\\Connection\\CompositeConnectionInterface');
     $connection->expects($this->at(0))->method('readLine')->will($this->returnValue('+OK'));
     $connection->expects($this->at(1))->method('readLine')->will($this->returnValue('-ERR error message'));
     $connection->expects($this->at(2))->method('readLine')->will($this->returnValue(':2'));
     $connection->expects($this->at(3))->method('readLine')->will($this->returnValue('$-1'));
     $connection->expects($this->at(4))->method('readLine')->will($this->returnValue('*-1'));
     $this->assertEquals('OK', $reader->read($connection));
     $this->assertEquals('ERR error message', $reader->read($connection));
     $this->assertSame(2, $reader->read($connection));
     $this->assertNull($reader->read($connection));
     $this->assertNull($reader->read($connection));
 }