/** * @group disconnected */ public function testFlushHandlesPartialBuffers() { $connection = $this->getMock('Predis\\Connection\\SingleConnectionInterface'); $connection->expects($this->exactly(4))->method('writeCommand'); $connection->expects($this->exactly(4))->method('readResponse')->will($this->returnCallback($this->getReadCallback())); $pipeline = new PipelineContext(new Client($connection)); $pipeline->echo('one'); $pipeline->echo('two'); $pipeline->flushPipeline(); $pipeline->echo('three'); $pipeline->echo('four'); $this->assertSame(array('one', 'two', 'three', 'four'), $pipeline->execute()); }