diff --git a/src/Symfony/Component/DomCrawler/Tests/CrawlerTest.php b/src/Symfony/Component/DomCrawler/Tests/CrawlerTest.php
index bfd9527a05c8..495a4a9d14a3 100644
--- a/src/Symfony/Component/DomCrawler/Tests/CrawlerTest.php
+++ b/src/Symfony/Component/DomCrawler/Tests/CrawlerTest.php
@@ -353,7 +353,7 @@ public function testText()
public function testHtml()
{
$this->assertEquals('', $this->createTestCrawler()->filterXPath('//a[5]')->html());
- $this->assertEquals('', trim($this->createTestCrawler()->filterXPath('//form[@id="FooFormId"]')->html()));
+ $this->assertEquals('', trim(preg_replace('~>\s+<~', '><', $this->createTestCrawler()->filterXPath('//form[@id="FooFormId"]')->html())));
try {
$this->createTestCrawler()->filterXPath('//ol')->html();