setupFile = dirname( __FILE__ ) . '/../PortableInfobox.setup.php';
parent::setUp();
}
/**
* @dataProvider translationsDataProvider
*/
public function testTranslation( $data, $expected ) {
$service = new PortableInfoboxBuilderService();
$this->assertEquals( $expected, $service->translate( $data ) );
}
public function translationsDataProvider() {
return [
[ "", "" ],
[ "[]", "" ],
[ '{"data":[{"type":"data", "source":"asdf"}]}', '' ],
[ '{"data":[{"type":"data", "source":"asdf", "data": {"label": "asdfsda"}}]}',
'' ],
[ '{"data":[{"type":"title", "source":"title", "data": {"defaultValue": "{{PAGENAME}}"}}]}',
'{{PAGENAME}}' ],
[ '{"data":[{"type":"group", "data": [{"type": "data", "source": "asdf"}]}]}',
'' ],
[ '{"theme": "asdf", "data": [{"type": "image", "source": "image", "data": { "alt": {"source": "title", "data": {"default": "asdf"}}}}]}',
'asdf' ],
[ '{"theme": "adsf", "data": [{"type": "group", "data": [{"type":"header", "data":"asdf"}]}]}',
'' ]
];
}
}