mirror of
https://github.com/Universal-Omega/PortableInfobox.git
synced 2024-11-15 11:59:56 +00:00
35 lines
1.2 KiB
PHP
35 lines
1.2 KiB
PHP
<?php
|
|
|
|
class PortableInfoboxTemplatesHelperTest extends WikiaBaseTest {
|
|
|
|
protected function setUp() {
|
|
$this->setupFile = dirname( __FILE__ ) . '/../PortableInfobox.setup.php';
|
|
parent::setUp();
|
|
}
|
|
|
|
/**
|
|
* @dataProvider testsProvider
|
|
*/
|
|
public function testInfoboxParsing( $markup, $expected ) {
|
|
$helper = $this->getMockBuilder( 'Wikia\PortableInfobox\Helpers\PortableInfoboxTemplatesHelper' )
|
|
->setMethods( [ 'fetchContent' ] )->getMock();
|
|
$helper->expects( $this->once() )->method( 'fetchContent' )->will( $this->returnValue( $markup ) );
|
|
|
|
$result = $helper->parseInfoboxes( new Title() );
|
|
|
|
$this->assertEquals( $expected, $result );
|
|
}
|
|
|
|
public function testsProvider() {
|
|
return [
|
|
[ 'test', false ],
|
|
[ '<includeonly><infobox><data source="test"><label>1</label></data></infobox></includeonly>',
|
|
[ [ 'data' => [ ], 'sources' => [ 'test' ] ] ] ],
|
|
[ '<includeonly></includeonly><infobox></infobox>', false ],
|
|
[ '<includeonly><infobox></infobox></includeonly> ', [ [ 'data' => [ ], 'sources' => [ ] ] ] ],
|
|
[ '<nowiki><includeonly><infobox></infobox></includeonly></nowiki>', false ],
|
|
[ '<includeonly><nowiki><infobox></infobox></nowiki></includeonly>', false ],
|
|
];
|
|
}
|
|
}
|