/**
  * @test
  */
 function iteration()
 {
     $reader = new XMLReaderStub('<r><a>1</a><a>2</a></r>');
     $it = new XMLReaderIterator($reader);
     $this->assertSame(null, $it->valid());
     $it->rewind();
     $this->assertSame(true, $it->valid());
     $node = $it->current();
     $this->assertEquals('r', $node->getName());
     $this->assertEquals('12', (string) $node);
     $it->moveToNextElementByName('a');
     $node = $it->current();
     $this->assertEquals('a', $node->getName());
     $this->assertEquals('1', (string) $node);
     $it->moveToNextElementByName('a');
     $node = $it->current();
     $this->assertEquals('a', $node->getName());
     $this->assertEquals('2', (string) $node);
     $it->next();
     $it->next();
     $this->assertEquals(XMLReader::END_ELEMENT, $reader->nodeType);
     $this->assertEquals('a', $it->current()->getName());
     $it->next();
     $it->next();
     $this->assertEquals(false, $it->valid());
 }
 public function next()
 {
     if (self::$goToNext) {
         parent::next();
     }
     self::$goToNext = true;
 }
 public function next()
 {
     if (parent::valid()) {
         $this->index++;
     }
     parent::next();
     $this->ensureCurrentElementState();
 }
 public function rewind()
 {
     parent::next();
     parent::rewind();
 }