PortableInfobox/tests/phpunit/nodes/NodeInfoboxTest.php

31 lines
741 B
PHP
Raw Normal View History

2015-06-11 12:51:54 +00:00
<?php
2018-08-08 09:42:22 +00:00
/**
* @group PortableInfobox
* @covers PortableInfobox\Parser\Nodes\NodeInfobox
2018-08-08 09:42:22 +00:00
*/
class NodeInfoboxTest extends MediaWikiTestCase {
2015-06-11 12:51:54 +00:00
/**
* @covers PortableInfobox\Parser\Nodes\NodeInfobox::getParams
2015-06-11 12:51:54 +00:00
* @dataProvider paramsProvider
*
* @param $markup
* @param $expected
*/
public function testParams( $markup, $expected ) {
2018-08-16 09:25:53 +00:00
$node = PortableInfobox\Parser\Nodes\NodeFactory::newFromXML( $markup, [] );
2015-06-11 12:51:54 +00:00
$this->assertEquals( $expected, $node->getParams() );
}
public function paramsProvider() {
return [
2018-08-16 09:25:53 +00:00
[ '<infobox></infobox>', [] ],
2015-06-11 12:51:54 +00:00
[ '<infobox theme="abs"></infobox>', [ 'theme' => 'abs' ] ],
[ '<infobox theme="abs" more="sdf"></infobox>', [ 'theme' => 'abs', 'more' => 'sdf' ] ],
];
}
2018-08-16 09:25:53 +00:00
}