/** * @expectedException RuntimeException * @expectedExceptionMessage A streaming iterator cannot be rewinded. */ public function testRewindException() { $message = $this->getMock('Riak\\Client\\ProtoBuf\\RpbListKeysResp', [], [], '', false); $this->client->expects($this->once())->method('receiveMessage')->willReturn($message)->with($this->equalTo($this->stream), $this->equalTo($this->messageCode)); $this->instance->rewind(); $this->instance->rewind(); }
/** * @return \Iterator */ protected function readNext() { if ($this->isDone()) { return null; } $this->message = $this->iterator->current(); return $this->extract($this->message); }
public function testReadNextWhenIsNotDone() { if (defined('HHVM_VERSION')) { $this->markTestSkipped('HHVM Fail to invoke readNext( WTF !!).'); } $message = new RpbListKeysResp(); $this->iterator->expects($this->once())->method('current')->willReturn($message); $this->instance->expects($this->once())->method('extract')->willReturn('value')->with($this->equalTo($message)); $this->assertEquals('value', $this->invokeMethod($this->instance, 'readNext')); }