You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Symfony\Component\DomCrawler\Test\Constraint::CrawlerSelectorTextContains::matches method uses the Symfony\Component\DomCrawler\Crawler::text() method in such a way that it triggers a deprecation error.
While not a being a critical bug, I think a component should not trigger its own deprecation errors. It looks like the app using the component is doing something wrong but it is not.
How to reproduce
I am running a WebTestCase that has the following assertion:
$this->assertPageTitleContains('Expected title');
The page's <title> element has a text content with multiple spaces, like this:
<title> Site name
–
Expected title</title>
Possible Solution
The constraint could explicitly pass the optional arguments to the text() method.
Additional context
Here is the deprecation error that shows up in the test report of my company's symfony application:
4x: "Symfony\Component\DomCrawler\Crawler::text()" will normalize whitespaces by default in Symfony 5.0, set the second "$normalizeWhitespace" argument to false to retrieve the non-normalized version of the text.
Symfony version(s) affected: 4.4.4
Description
The
Symfony\Component\DomCrawler\Test\Constraint::CrawlerSelectorTextContains::matches
method uses theSymfony\Component\DomCrawler\Crawler::text()
method in such a way that it triggers a deprecation error.While not a being a critical bug, I think a component should not trigger its own deprecation errors. It looks like the app using the component is doing something wrong but it is not.
How to reproduce
I am running a WebTestCase that has the following assertion:
The page's
<title>
element has a text content with multiple spaces, like this:Possible Solution
The constraint could explicitly pass the optional arguments to the
text()
method.Additional context
Here is the deprecation error that shows up in the test report of my company's symfony application:
The method call:
https://github.com/symfony/dom-crawler/blob/4.4/Test/Constraint/CrawlerSelectorTextContains.php#L48
The deprecation trigger:
https://github.com/symfony/dom-crawler/blob/4.4/Crawler.php#L617-L620
There is probably the same issue with the
CrawlerSelectorTextSame
contraint:https://github.com/symfony/dom-crawler/blob/4.4/Test/Constraint/CrawlerSelectorTextSame.php#L48
The text was updated successfully, but these errors were encountered: