Jyxo\XmlReaderTest::testGetContent PHP Method

testGetContent() public method

Tests the getContent() method.
See also: Jyxo\XmlReader::getContent()
public testGetContent ( )
    public function testGetContent()
    {
        // In the form: tag (key), expected value (value)
        $tests = [];
        $tests['zero'] = '';
        $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());
            }
        }
    }