minor #23859 [DomCrawler] Fix testHtml method with regexp (MatthieuMota)

This PR was submitted for the master branch but it was merged into the 2.7 branch instead (closes #23859).

Discussion
----------

[DomCrawler] Fix testHtml method with regexp

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #23858
| License       | MIT
| Doc PR        | no

As explained in this issue #23858, adding a regexp in addition to the trim for the testHtml method of [CrawlerTest](https://github.com/symfony/symfony/blob/master/src/Symfony/Component/DomCrawler/Tests/CrawlerTest.php#L397) class.

Commits
-------

339592d Fix testHtml method with regexp
This commit is contained in:
Nicolas Grekas 2017-08-14 12:36:32 +02:00
commit 993546b4ca
1 changed files with 1 additions and 1 deletions

View File

@ -353,7 +353,7 @@ EOF
public function testHtml()
{
$this->assertEquals('<img alt="Bar">', $this->createTestCrawler()->filterXPath('//a[5]')->html());
$this->assertEquals('<input type="text" value="TextValue" name="TextName"><input type="submit" value="FooValue" name="FooName" id="FooId"><input type="button" value="BarValue" name="BarName" id="BarId"><button value="ButtonValue" name="ButtonName" id="ButtonId"></button>', trim($this->createTestCrawler()->filterXPath('//form[@id="FooFormId"]')->html()));
$this->assertEquals('<input type="text" value="TextValue" name="TextName"><input type="submit" value="FooValue" name="FooName" id="FooId"><input type="button" value="BarValue" name="BarName" id="BarId"><button value="ButtonValue" name="ButtonName" id="ButtonId"></button>', trim(preg_replace('~>\s+<~', '><', $this->createTestCrawler()->filterXPath('//form[@id="FooFormId"]')->html())));
try {
$this->createTestCrawler()->filterXPath('//ol')->html();