PortableInfobox/tests/phpunit/nodes/NodeInfoboxTest.php

34 lines
790 B
PHP
Raw Normal View History

2015-06-11 12:51:54 +00:00
<?php
2022-03-11 20:35:51 +00:00
use PortableInfobox\Parser\Nodes\NodeFactory;
2018-08-08 09:42:22 +00:00
/**
* @group PortableInfobox
2022-03-11 20:35:51 +00:00
* @covers \PortableInfobox\Parser\Nodes\NodeInfobox
* @coversDefaultClass \PortableInfobox\Parser\Nodes\NodeInfobox
2018-08-08 09:42:22 +00:00
*/
2021-12-15 22:01:13 +00:00
class NodeInfoboxTest extends MediaWikiIntegrationTestCase {
2015-06-11 12:51:54 +00:00
/**
2022-03-11 20:35:51 +00:00
* @covers ::getParams
2015-06-11 12:51:54 +00:00
* @dataProvider paramsProvider
*
* @param $markup
* @param $expected
*/
public function testParams( $markup, $expected ) {
2022-03-11 20:35:51 +00:00
$node = 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
}