XW-2444: resolving notices and warnings in PortableInfoboxMobileRenderServiceTest

This commit is contained in:
Mateusz Rybarski 2016-12-29 10:46:13 +01:00
parent 52d85ec2a1
commit cf900e715c

View file

@ -55,6 +55,10 @@ class PortableInfoboxMobileRenderServiceTest extends WikiaBaseTest {
* @return string
*/
private function normalizeHTML( $html ) {
if ( empty( $hrml ) ) {
return '';
}
$DOM = new DOMDocument( '1.0' );
$DOM->formatOutput = true;
$DOM->preserveWhiteSpace = false;
@ -74,7 +78,7 @@ class PortableInfoboxMobileRenderServiceTest extends WikiaBaseTest {
$this->mockInfoboxRenderServiceHelper( $mockParams );
$infoboxRenderService = new PortableInfoboxMobileRenderService();
$actualOutput = $infoboxRenderService->renderInfobox( $input, '', '' );
$actualOutput = $infoboxRenderService->renderInfobox( $input, '', '', '', '' );
$expectedHtml = $this->normalizeHTML( $expectedOutput );
$actualHtml = $this->normalizeHTML( $actualOutput );
@ -86,7 +90,8 @@ class PortableInfoboxMobileRenderServiceTest extends WikiaBaseTest {
[
'input' => [ ],
'output' => '',
'description' => 'Empty data should yield no infobox markup'
'description' => 'Empty data should yield no infobox markup',
'mockParams' => []
],
[
'input' => [
@ -100,7 +105,8 @@ class PortableInfoboxMobileRenderServiceTest extends WikiaBaseTest {
'output' => '<aside class="portable-infobox pi-background">
<h2 class="pi-item pi-item-spacing pi-title">Test Title</h2>
</aside>',
'description' => 'Only title'
'description' => 'Only title',
'mockParams' => []
],
[
'input' => [
@ -114,7 +120,8 @@ class PortableInfoboxMobileRenderServiceTest extends WikiaBaseTest {
'output' => '<aside class="portable-infobox pi-background">
<nav class="pi-navigation pi-item-spacing pi-secondary-background pi-secondary-font">navigation value</nav>
</aside>',
'description' => 'navigation only'
'description' => 'navigation only',
'mockParams' => []
],
[
'input' => [
@ -132,7 +139,8 @@ class PortableInfoboxMobileRenderServiceTest extends WikiaBaseTest {
<div class="pi-data-value pi-font">test value</div>
</div>
</aside>',
'description' => 'Only pair'
'description' => 'Only pair',
'mockParams' => []
],
[
'input' => [
@ -216,7 +224,8 @@ class PortableInfoboxMobileRenderServiceTest extends WikiaBaseTest {
<div class="pi-data-value pi-font">test value</div>
</div>
</aside>',
'description' => 'Simple infobox with title, INVALID image and key-value pair'
'description' => 'Simple infobox with title, INVALID image and key-value pair',
'mockParams' => []
],
[
'input' => [
@ -241,7 +250,8 @@ class PortableInfoboxMobileRenderServiceTest extends WikiaBaseTest {
<div class="pi-data-value pi-font">test value</div>
</div>
</aside>',
'description' => 'Simple infobox with title, empty image and key-value pair'
'description' => 'Simple infobox with title, empty image and key-value pair',
'mockParams' => []
],
[
'input' => [
@ -293,7 +303,8 @@ class PortableInfoboxMobileRenderServiceTest extends WikiaBaseTest {
</div>
</section>
</aside>',
'description' => 'Infobox with title, group with header and two key-value pairs'
'description' => 'Infobox with title, group with header and two key-value pairs',
'mockParams' => []
],
[
'input' => [
@ -422,7 +433,8 @@ class PortableInfoboxMobileRenderServiceTest extends WikiaBaseTest {
<p>Links</p>
</nav>
</aside>',
'description' => 'Infobox with navigation'
'description' => 'Infobox with navigation',
'mockParams' => []
],
[
'input' => [