Closed seizan8 closed 1 year ago
Please try with loadAllFixtures()
: https://github.com/liip/LiipTestFixturesBundle/blob/e19bfbba2ae99025739dd9e031f6aedead2cc0e7/doc/database.md#methods
It should work with something like loadAllFixtures(['mygroup1', 'mygroup2']);
.
@alexislefebvre Indeed! This totally works. Did not notice that optional parameter for the groups. Thanks!
Is your feature request related to a problem? Please describe.
A great way to organise fixtures is using the FixtureGroupInterface and assigning groups to the fixtures. I usually make one group for base data and then different groups for various test data or test cases.
The TestFixtureBundle is great for loading my fixtures. However, I have to list every single fixture file myself in every case. It would also make it easier if the base data get's extended. Let's say the first version has only 1 user role. And later on different user roles are introduced. To manage these they are stored in the DB. So now we have a fixture for these user roles that are needed for every setup. Loading fixtures by groups would allow me to simply add the fixture file and add all necessary groups. Ideally my test cases would not break by default because my app is trying to load some roles it expects to be there.
Describe alternatives you've considered
Loading all fixtures of my intended group individually.
Additional context
This might be way more relevant for WebTestCases than actual UnitTests.