Author: Jaroslav Hanslík
Inheritance: extends XMLReader
Beispiel #1
0
 /**
  * Tests the getContent() method.
  *
  * @see \Jyxo\XmlReader::getContent()
  */
 public function testGetContent()
 {
     // In the form: tag (key), expected value (value)
     $tests = array();
     $tests['one'] = 'word';
     $tests['second'] = 'two <tag>words</tag>';
     $tests['third'] = 'three<empty/><tag>simple</tag> words';
     $tests['forth'] = "\n\t\tfour<tag>words</tag>on<empty/>several<empty/>lines\n\t";
     $tests['fifth'] = 'fifth test without tags';
     $tests['sixth'] = 'cdata in sixth test';
     $tests['seventh'] = 'cdata with <empty/><tag>tags</tag> in seventh test';
     $tests['eighth'] = 'eigth test with <tag attribute="value">tags and attributes</tag>';
     $tests['ninth'] = 'ninth test with <tag attribute="value">tags and attributes and <inner>inner tags</inner></tag>';
     $this->reader->open($this->path . '/content.xml');
     $this->reader->next('test');
     while ($this->reader->read()) {
         if ($this->reader->nodeType == \XMLReader::ELEMENT) {
             $this->assertEquals($tests[$this->reader->name], $this->reader->getContent());
         }
     }
 }