/** * @inheritdoc */ public function current() { $current = $this->delegatorReader->current(); if (!$current) { $this->iterator->next(); if (!$this->iterator->valid()) { return false; } $resource = $this->convertResource($this->resource, $this->iterator->current()); $this->delegatorReader->open($resource); return $this->current(); } return $current; }
/** * @covers Yosmanyga\Resource\Reader\Iterator\DelegatorReader::current */ public function testCurrent() { $internalReader1 = $this->getMock('Yosmanyga\\Resource\\Reader\\Iterator\\ReaderInterface'); $internalReader1->expects($this->once())->method('supports')->will($this->returnValue(true)); $internalReader1->expects($this->once())->method('current'); $reader = new DelegatorReader(array($internalReader1)); $reader->open(new Resource()); $reader->current(); }