diff --git a/tests/PortableInfoboxParserTagControllerTest.php b/tests/PortableInfoboxParserTagControllerTest.php index c5f308c..6834b1c 100644 --- a/tests/PortableInfoboxParserTagControllerTest.php +++ b/tests/PortableInfoboxParserTagControllerTest.php @@ -39,7 +39,12 @@ class PortableInfoboxParserTagControllerTest extends WikiaBaseTest { protected function getXPath( $output ) { $result = new DOMDocument(); + + // Surpress `Warning: DOMDocument::loadHTML(): Tag aside invalid in Entity` + // http://stackoverflow.com/questions/9149180/domdocumentloadhtml-error + libxml_use_internal_errors( true ); $result->loadHTML( $output ); + libxml_use_internal_errors( false ); return new DOMXPath( $result ); } diff --git a/tests/PortableInfoboxRenderServiceHelperTest.php b/tests/PortableInfoboxRenderServiceHelperTest.php index 44aace1..06692f9 100644 --- a/tests/PortableInfoboxRenderServiceHelperTest.php +++ b/tests/PortableInfoboxRenderServiceHelperTest.php @@ -22,7 +22,7 @@ class PortableInfoboxRenderServiceHelperTest extends WikiaBaseTest { $fileHeight = isset( $input[ 'fileHeight' ] ) ? $input[ 'fileHeight' ] : null; $fileMock = $this->getMockBuilder( 'File' ) - ->setConstructorArgs( [ 'TestFile' ] ) + ->setConstructorArgs( [ 'TestFile', false ] ) ->setMethods( [ 'getWidth', 'getHeight' ] ) ->getMock(); $fileMock->expects( $this->any() ) diff --git a/tests/PortableInfoboxRenderServiceTest.php b/tests/PortableInfoboxRenderServiceTest.php index 81e663d..fa9440d 100644 --- a/tests/PortableInfoboxRenderServiceTest.php +++ b/tests/PortableInfoboxRenderServiceTest.php @@ -60,6 +60,10 @@ class PortableInfoboxRenderServiceTest extends WikiaBaseTest { * @return string */ private function normalizeHTML( $html ) { + if ( empty( $html ) ) { + return ''; + } + $DOM = new DOMDocument( '1.0' ); $DOM->formatOutput = true; $DOM->preserveWhiteSpace = false; @@ -107,7 +111,8 @@ class PortableInfoboxRenderServiceTest extends WikiaBaseTest { [ 'input' => [ ], 'output' => '', - 'description' => 'Empty data should yield no infobox markup' + 'description' => 'Empty data should yield no infobox markup', + 'mockParams' => [] ], [ 'input' => [ @@ -121,7 +126,8 @@ class PortableInfoboxRenderServiceTest extends WikiaBaseTest { 'output' => '', - 'description' => 'Only title' + 'description' => 'Only title', + 'mockParams' => [] ], [ 'input' => [ @@ -226,7 +232,8 @@ class PortableInfoboxRenderServiceTest extends WikiaBaseTest { 'output' => '', - 'description' => 'navigation only' + 'description' => 'navigation only', + 'mockParams' => [] ], [ 'input' => [ @@ -244,7 +251,8 @@ class PortableInfoboxRenderServiceTest extends WikiaBaseTest {
Links
', - 'description' => 'Infobox with navigation' + 'description' => 'Infobox with navigation', + 'mockParams' => [] ], [ 'input' => [ diff --git a/tests/nodes/NodeImageTest.php b/tests/nodes/NodeImageTest.php index 0655204..da49496 100644 --- a/tests/nodes/NodeImageTest.php +++ b/tests/nodes/NodeImageTest.php @@ -171,23 +171,13 @@ class NodeImageTest extends WikiaBaseTest { * @throws \Wikia\PortableInfobox\Parser\XmlMarkupParseErrorException */ public function testVideo( $markup, $params, $expected ) { - global $wgHooks; - - // backup the hooks - $tmpHooks = $wgHooks[ 'PortableInfoboxNodeImage::getData' ]; - $wgHooks[ 'PortableInfoboxNodeImage::getData' ] = [ ]; - $fileMock = new FileMock(); $xmlObj = Wikia\PortableInfobox\Parser\XmlParser::parseXmlString( $markup ); - $this->mockStaticMethod( 'WikiaFileHelper', 'getFileFromTitle', $fileMock ); $nodeImage = new Wikia\PortableInfobox\Parser\Nodes\NodeImage( $xmlObj, $params ); $this->assertEquals( $expected, $nodeImage->getData() ); - - // restore the hooks - $wgHooks[ 'PortableInfoboxNodeImage::getData' ] = $tmpHooks; } public function testVideoProvider() {