PortableInfobox/tests/phpunit/nodes/NodeHeaderTest.php

40 lines
873 B
PHP
Raw Normal View History

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>',
[ 'value' => '' ]
],
[
'<header>kjdflkja dafkjlsdkfj</header>',
[ 'value' => 'kjdflkja dafkjlsdkfj' ]
],
[
'<header>kjdflkja<ref>dafkjlsdkfj</ref></header>',
[ 'value' => 'kjdflkja<ref>dafkjlsdkfj</ref>' ]
]
2018-08-13 14:31:50 +00:00
];
}
}