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
$this->assertSelectorTextContains('#errorMessages', 'Lorem Ipsum dolor sit amet');
Generates this error message:
1) App\Tests\Controller\SomeController::testErrors
Failed asserting that Symfony\Component\DomCrawler\Crawler Object &000000006f47faf00000000020f6e407 (
'uri' => 'http://localhost/...'
'defaultNamespacePrefix' => 'default'
'namespaces' => Array &0 ()
'baseHref' => '...'
'document' => DOMDocument Object &000000006f47f0290000000020f6e407 ()
'nodes' => Array &1 (
0 => DOMElement Object &000000006f47faa70000000020f6e407 ()
)
'isHtml' => true
'html5Parser' => null
) matches selector "#errorMessages" and has a node matching selector "#errorMessages" with content containing "Lorem Ipsum dolor sit amet".
This is the error message I'd like to see:
1) App\Tests\Controller\SomeController::testErrors
Failed asserting that selector "#errorMessages" contains "Lorem Ipsum dolor sit amet".
The "#errorMessages" element exists, but its content is "Foo bar lorem ipsum"
or:
1) App\Tests\Controller\SomeController::testErrors
Failed asserting that selector "#errorMessages" contains "Lorem Ipsum dolor sit amet".
The "#errorMessages" selector does not match any elements.
As usual, we must answer many questions before trying to fix this: do we really want to do this? Is it technically possible to do it? Would it work for all asserts and all possible scenarios? Thanks!
The text was updated successfully, but these errors were encountered:
…orTextContains constraint (xabbuh)
This PR was merged into the 4.4 branch.
Discussion
----------
[DomCrawler] improve failure messages of the CrawlerSelectorTextContains constraint
| Q | A
| ------------- | ---
| Branch? | 5.x
| Bug fix? | no
| New feature? | no
| Deprecations? | no
| Tickets | Fix#33551, #37757
| License | MIT
| Doc PR |
Commits
-------
ba451ab improve failure messages of the CrawlerSelectorTextContains constraint
Uh oh!
There was an error while loading. Please reload this page.
Description
I love the test assert methods provided by Symfony but their error messages are sometimes cryptic.
Example
This test:
Generates this error message:
This is the error message I'd like to see:
or:
As usual, we must answer many questions before trying to fix this: do we really want to do this? Is it technically possible to do it? Would it work for all asserts and all possible scenarios? Thanks!
The text was updated successfully, but these errors were encountered: