Symfony2 tests : filter with html:contains return one value
The selector html:contains("This value should not be blank")
that you use means get every <html>
tag containing the "This value should not be blank"
string. Even if this string is present twice, there is only one <html>
tag per page, so you will never count 2 filtered items.
The solution is to use a more specific rule:
$crawler->filter('div:contains("This value should not be blank")')
Use the name of the tag which contains your error messages. By default it's <div>
but you may have changed this in your Twig template.