'Symfony Test - Testing database with data to check Show($id) Feature

Could someone explain me how can I add some entities in to database for test purpose? I want to test that endpoint /show/{id} show correct response, but to check that i need to have a entity in test database so i could download his data.

Im using last version of Symfony, Doctrine and PHP Unit.



Solution 1:[1]

You are looking for Integration tests with symfony and you will face prerequisites (fixtures, test database, api call via WebTestCase class, ...). It's a bit longer to explain in details, so all you want is in this page: https://symfony.com/doc/current/testing.html

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Lounis