2018-08-13 14:31:50 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* @group PortableInfobox
|
|
|
|
* @covers PortableInfobox\Parser\Nodes\NodeHeader
|
|
|
|
*/
|
|
|
|
class NodeHeaderTest extends MediaWikiTestCase {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @covers PortableInfobox\Parser\Nodes\NodeHeader::getData
|
|
|
|
* @covers PortableInfobox\Parser\Nodes\Node::getInnerValue
|
|
|
|
* @dataProvider dataProvider
|
|
|
|
*
|
|
|
|
* @param $markup
|
|
|
|
* @param $expected
|
|
|
|
*/
|
2018-10-02 07:41:19 +00:00
|
|
|
public function testData( $markup, $expected ) {
|
|
|
|
$node = PortableInfobox\Parser\Nodes\NodeFactory::newFromXML( $markup );
|
2018-08-13 14:31:50 +00:00
|
|
|
|
|
|
|
$this->assertEquals( $expected, $node->getData() );
|
|
|
|
}
|
|
|
|
|
|
|
|
public function dataProvider() {
|
|
|
|
return [
|
2018-10-02 07:41:19 +00:00
|
|
|
[
|
|
|
|
'<header></header>',
|
2019-02-02 22:34:48 +00:00
|
|
|
[ 'value' => '', 'item-name' => null ]
|
2018-10-02 07:41:19 +00:00
|
|
|
],
|
|
|
|
[
|
|
|
|
'<header>kjdflkja dafkjlsdkfj</header>',
|
2019-02-02 22:34:48 +00:00
|
|
|
[ 'value' => 'kjdflkja dafkjlsdkfj', 'item-name' => null ]
|
2018-10-02 07:41:19 +00:00
|
|
|
],
|
|
|
|
[
|
|
|
|
'<header>kjdflkja<ref>dafkjlsdkfj</ref></header>',
|
2019-02-02 22:34:48 +00:00
|
|
|
[ 'value' => 'kjdflkja<ref>dafkjlsdkfj</ref>', 'item-name' => null ]
|
2018-10-02 07:41:19 +00:00
|
|
|
]
|
2018-08-13 14:31:50 +00:00
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|