/** * @group disconnected */ public function testReadResponse() { $reader = new TextResponseReader(); $protocol = new ComposableTextProtocol(); $protocol->setReader($reader); $connection = $this->getMock('Predis\\Connection\\ComposableConnectionInterface'); $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->assertTrue($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)); }
/** * @group disconnected * @expectedException InvalidArgumentException * @expectedExceptionMessage The option unknown_option is not supported by the current protocol */ public function testSetInvalidOption() { $protocol = new ComposableTextProtocol(); $protocol->setOption('unknown_option', true); }