I was browsing a little and was not able to find any solutions for something I want to accomplish.
I am in Symofny 5
project and I am writing some Unit tests
.
The goal of my tests is to check, if the messages will appear as they are defined. The messages are rendered by the twig
template. I am not that familiar with Symfony and twig regrading to tests. I do not know, if I somehow can render the output of a view using that twig template for just that entry and then check, if the message contains the expected text in the right manor.
Is it something like this doable?
Can some help and give me guidance as example for something like this?
I think it can be beneficial to other coders out there in the future.
I have an entity like User
, than want to get the status, like:
$user->getStatus('ready);
in twig:
{% if item.status == 'ready' %}
<p>The status of user is {{ item.status }}</p>
{% endif %}
So, I want to assert that twig templates are rendering correct output for given status.