setupFile = dirname( __FILE__ ) . '/../PortableInfobox.setup.php';
parent::setUp();
$this->simpleXmlUtil = \Wikia\PortableInfobox\Helpers\SimpleXmlUtil::getInstance();
}
protected function tearDown() {
// we use libxml only for tests here
libxml_clear_errors();
parent::tearDown();
}
/**
* @dataProvider testGetInnerXMLDataProvider
*/
public function testGetInnerXML( $xmlString, $expValue, $message ) {
$xml = simplexml_load_string( $xmlString );
$this->assertEquals( $expValue, $this->simpleXmlUtil->getInnerXML( $xml ), $message );
}
public function testGetInnerXMLDataProvider() {
return [
[
'TestFile.png',
'TestFile.png',
'Valid gallery tag in default'
],
[
'Test ',
'Test ',
'Text + XML'
],
[
'',
'',
'Valid self-closing tag'
],
[
'',
'',
'Invalid inner XML'
],
[
'',
'',
'Invalid inner XML'
],
[
'',
'',
'No inner XML'
]
];
}
}