setupFile = dirname( __FILE__ ) . '/../PortableInfobox.setup.php';
parent::setUp();
}
public function testIsEmpty() {
$parser = new \Wikia\PortableInfobox\Parser\XmlParser([
'elem2' => 'ELEM2',
'lado2' => 'LALALA',
'nonempty' => '111'
]);
$markup = '
';
$data = $parser->getDataFromXmlString( $markup );
$this->assertTrue( $data[0]['data']['value'][0]['data']['value'][0]['data']['value'] == 'Combatientes' );
$this->assertTrue( $data[1]['data']['value'] == '111' );
}
public function testExternalParser() {
$parser = new \Wikia\PortableInfobox\Parser\XmlParser([
'elem2' => 'ELEM2',
'lado2' => 'LALALA'
]);
$externalParser = new \Wikia\PortableInfobox\Parser\DummyParser();
$parser->setExternalParser( $externalParser );
$markup = '
ABB
';
$data = $parser->getDataFromXmlString( $markup );
$this->assertTrue( $data[0]['data']['value'] == 'parseRecursive(ABB)' );
$this->assertTrue( $data[1]['data']['value'][0]['data']['value'][1]['data']['value'] == 'parseRecursive(LALALA)');
}
}