Skip to content
Advertisement

How to test for character references in Symfony with PHPUnit?

I want to test this very simple page generated by my PHP/Symfony project

JavaScript

(It’s in French, so it needs the   hard spaces in front of the exclamation points.)

I thought an equally simple test such as

JavaScript

would do the trick, but I get a failure.

Further inquiry shows that

JavaScript

returns

JavaScript

So, how do I help assertSelectorTextContains() (and more generally, PHPUnit) understand that both strings are actually the same? (Or at least equivalent?)

Advertisement

Answer

Changing my search criteria yielded the answer, html_entity_decode():

JavaScript

does the job.

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement