/** * @param string $originalText * @param string $expectedText * @dataProvider processResponseBodyDataProvider */ public function testProcessResponseBody($originalText, $expectedText) { $actualText = $originalText; $this->_model->processResponseBody($actualText, false); $this->markTestIncomplete('Bug MAGE-2494'); $expected = new \DOMDocument(); $expected->preserveWhiteSpace = false; $expected->loadHTML($expectedText); $actual = new \DOMDocument(); $actual->preserveWhiteSpace = false; $actual->loadHTML($actualText); $this->assertEquals($expected, $actual); }
/** * @param $scope * @param $body * @param $expected * @dataProvider processResponseBodyGetInlineScriptDataProvider * @SuppressWarnings(PHPMD.NPathComplexity) */ public function testProcessResponseBodyGetInlineScript($scope, $body, $expected) { $isJson = true; $this->prepareIsAllowed(true, true, true, $scope); $jsonCall = is_array($body) ? 2 * (count($body) + 1) : 2; $this->parserMock->expects($this->exactly($jsonCall))->method('setIsJson')->will($this->returnValueMap([[$isJson, $this->returnSelf()], [!$isJson, $this->returnSelf()]])); $this->parserMock->expects($this->exactly(1))->method('processResponseBodyString')->with(is_array($body) ? reset($body) : $body); $this->parserMock->expects($this->exactly(2))->method('getContent')->will($this->returnValue(is_array($body) ? reset($body) : $body)); $model = new Inline($this->scopeResolverMock, $this->urlMock, $this->layoutMock, $this->configMock, $this->parserMock, $this->stateMock, '', '', $scope); $model->processResponseBody($body, $isJson); $this->assertEquals($body, $expected); }