/**
  * @return void
  */
 public function rewind()
 {
     parent::rewind();
     $this->ensureCurrentElementState();
     $this->didRewind = true;
     $this->index = 0;
 }
 /**
  * @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());
 }
Exemplo n.º 3
0
 public function rewind()
 {
     parent::next();
     parent::rewind();
 }