Skip to content

Commit

Permalink
minor #23859 [DomCrawler] Fix testHtml method with regexp (MatthieuMota)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
nicolas-grekas committed Aug 14, 2017
2 parents 1b9619c + 339592d commit 993546b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Symfony/Component/DomCrawler/Tests/CrawlerTest.php
Expand Up @@ -353,7 +353,7 @@ public function testText()
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();
Expand Down

0 comments on commit 993546b

Please sign in to comment.