Skip to content

Commit c466f38

Browse files
committed
MC-18051: PHP 7.3 upgrade for Page Builder
- Resolving failing test, strip whitespace and new lines before comparison
1 parent fe0c405 commit c466f38

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

dev/tests/integration/testsuite/Magento/PageBuilder/Plugin/Filter/TemplatePluginTest.php

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ protected function setUp()
4747
public function testFiltering(string $preFiltered, string $postFiltered, string $preFilteredBasename)
4848
{
4949
$this->assertEquals(
50-
$postFiltered,
51-
$this->templateFilter->filter($preFiltered),
50+
$this->formatHtml($postFiltered),
51+
$this->formatHtml($this->templateFilter->filter($preFiltered)),
5252
"Failed asserting that two strings are equal after filtering $preFilteredBasename"
5353
);
5454
}
@@ -79,4 +79,15 @@ public function filterDataProvider(): array
7979

8080
return $dataProviderArgs;
8181
}
82+
83+
/**
84+
* Strip whitespace from the HTML to conduct a fairer comparison
85+
*
86+
* @param string $html
87+
* @return string|string[]|null
88+
*/
89+
private function formatHtml(string $html): string
90+
{
91+
return preg_replace('/(?<=>)\s+|\s+(?=<)/m', '', $html);
92+
}
8293
}

0 commit comments

Comments
 (0)