diff --git a/services/Parser/Nodes/NodeFooter.php b/services/Parser/Nodes/NodeFooter.php
index d617139..cd89107 100644
--- a/services/Parser/Nodes/NodeFooter.php
+++ b/services/Parser/Nodes/NodeFooter.php
@@ -2,16 +2,15 @@
namespace Wikia\PortableInfobox\Parser\Nodes;
class NodeFooter extends Node {
- const LINKS_TAG_NAME = 'links';
public function getData() {
$data = [];
- $data['links'] = $this->parseWithExternalParser( (string) $this->xmlNode->{self::LINKS_TAG_NAME}, true );
+ $data['value'] = $this->parseWithExternalParser( (string) $this->xmlNode, true );
return $data;
}
public function isEmpty( $data ) {
- $links = trim( $data['links'] );
+ $links = trim( $data['value'] );
return empty( $links );
}
}
diff --git a/templates/PortableInfoboxItemFooter.mustache b/templates/PortableInfoboxItemFooter.mustache
index 7e133f4..15d5c1a 100644
--- a/templates/PortableInfoboxItemFooter.mustache
+++ b/templates/PortableInfoboxItemFooter.mustache
@@ -1,4 +1,4 @@
diff --git a/tests/ParserNodesTest.php b/tests/ParserNodesTest.php
index a9a5420..b3ab5e0 100644
--- a/tests/ParserNodesTest.php
+++ b/tests/ParserNodesTest.php
@@ -52,11 +52,11 @@ class PortableInfoboxParserNodesTest extends WikiaBaseTest {
}
public function testNodeFooter() {
- $string = '';
+ $string = '';
$xml = simplexml_load_string( $string );
$node = new Wikia\PortableInfobox\Parser\Nodes\NodeFooter( $xml, [ ] );
- $this->assertTrue( $node->getData()[ 'links' ] == '123' );
+ $this->assertTrue( $node->getData()[ 'value' ] == '123' );
}
public function testNodeGroup() {
diff --git a/tests/PortableInfoboxRenderServiceTest.php b/tests/PortableInfoboxRenderServiceTest.php
index 279eff3..18b1fc2 100644
--- a/tests/PortableInfoboxRenderServiceTest.php
+++ b/tests/PortableInfoboxRenderServiceTest.php
@@ -28,7 +28,13 @@ class PortableInfoboxRenderServiceTest extends PHPUnit_Framework_TestCase {
$actualDOM->loadXML($actualOutput);
$expectedDOM->loadXML($expectedOutput);
- $this->assertEquals( $expectedDOM->saveXML(), $actualDOM->saveXML(), $description );
+ // lets sanitize expected and actual HTML to not deal with whitespaces
+ $from = ['/\>[^\S ]+/s', '/[^\S ]+\ ', '<', '\\1', '><'];
+ $expectedHtml = preg_replace($from, $to, $expectedDOM->saveXML());
+ $actualHtml = preg_replace($from, $to, $actualDOM->saveXML());
+
+ $this->assertEquals( $expectedHtml, $actualHtml, $description );
}
public function testRenderInfoboxDataProvider() {
@@ -51,6 +57,19 @@ class PortableInfoboxRenderServiceTest extends PHPUnit_Framework_TestCase {
'output' => '',
'description' => 'Only title'
],
+ [
+ 'input' => [
+ [
+ 'type' => 'footer',
+ 'data' => [
+ 'value' => 'Footer value',
+ 'isEmpty' => false
+ ]
+ ]
+ ],
+ 'output' => '',
+ 'description' => 'Footer only'
+ ],
[
'input' => [
[
diff --git a/tests/XmlParserTest.php b/tests/XmlParserTest.php
index 8dc7775..bab7f27 100644
--- a/tests/XmlParserTest.php
+++ b/tests/XmlParserTest.php
@@ -27,7 +27,7 @@ class XmlParserTest extends WikiaBaseTest {
-
+
@@ -59,14 +59,12 @@ class XmlParserTest extends WikiaBaseTest {
ABB
-
+
-
+
';
$data = $parser->getDataFromXmlString( $markup );