7 months ago

is it safe to use double !! !! only for fetching data from server?

Posted 7 months ago by untymage

I wrote a unit test for my project that checks if the title exist on my page:

$tag = factory(Tag::class)->create(['name' => 'Example & Example ']);

But since the laravel escapes data with {{ }} my test fails and says :

Failed asserting that page contains "Example & Example".

Because laravel convet & to '& amp ' ;

<a href="#">Example &amp; Example  }}</a>

So what is good approach to handle this test ? is it safe to only use {{!! !!}} for only getting data from database ?

Please sign in or create an account to participate in this conversation.