2018-08-13 14:31:50 +00:00
|
|
|
<?php
|
2022-03-11 20:35:51 +00:00
|
|
|
|
|
|
|
use PortableInfobox\Parser\Nodes\NodeFactory;
|
|
|
|
|
2018-08-13 14:31:50 +00:00
|
|
|
/**
|
|
|
|
* @group PortableInfobox
|
2022-03-11 20:35:51 +00:00
|
|
|
* @covers \PortableInfobox\Parser\Nodes\NodeHeader
|
|
|
|
* @coversDefaultClass \PortableInfobox\Parser\Nodes\NodeHeader
|
2018-08-13 14:31:50 +00:00
|
|
|
*/
|
2021-12-15 22:01:13 +00:00
|
|
|
class NodeHeaderTest extends MediaWikiIntegrationTestCase {
|
2018-08-13 14:31:50 +00:00
|
|
|
|
|
|
|
/**
|
2022-03-11 20:35:51 +00:00
|
|
|
* @covers ::getData
|
|
|
|
* @covers \PortableInfobox\Parser\Nodes\Node::getInnerValue
|
2018-08-13 14:31:50 +00:00
|
|
|
* @dataProvider dataProvider
|
|
|
|
*
|
|
|
|
* @param $markup
|
|
|
|
* @param $expected
|
|
|
|
*/
|
2018-10-02 07:41:19 +00:00
|
|
|
public function testData( $markup, $expected ) {
|
2022-03-11 20:35:51 +00:00
|
|
|
$node = 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 ]
|
2019-02-03 16:49:06 +00:00
|
|
|
],
|
|
|
|
[
|
|
|
|
'<header name="headertest">kjdflkja dafkjlsdkfj</header>',
|
|
|
|
[ 'value' => 'kjdflkja dafkjlsdkfj', 'item-name' => 'headertest' ]
|
2018-10-02 07:41:19 +00:00
|
|
|
]
|
2018-08-13 14:31:50 +00:00
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|