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 ],
[ '',
[ [ 'data' => [ ], 'sources' => [ 'test' ], 'labels' => [ 'test' => 1 ] ] ] ],
[ '', false ],
[ ' ', [ [ 'data' => [ ], 'sources' => [ ], 'labels' => [ ] ] ] ],
[ '', false ],
[ '', false ],
];
}
}