doctrine / data-fixtures

Doctrine2 ORM Data Fixtures Extensions
http://www.doctrine-project.org
MIT License
2.78k stars 224 forks source link

Persistent ReferenceRepository to be used in tests #466

Open mkrauser opened 9 months ago

mkrauser commented 9 months ago

Hey,

in the past my each test I wrote, loaded the fixtures (or part of it) before executing. Then I used the ReferenceRepository to get references to objects required in the tests.

Now we load all fixtures while bootstrapping the tests and after each test we rollback the database transaction. But that way we don't have access to the ReferenceRepository.

I had an idea regarding this: When loading the fixtures, it should be possible to serialize the information from the ReferenceRepository to a file, which can then be used to reconstruct the ReferenceRepository later. This would potentially reduce the Overhead-Code in Tests dramatically.

Thank you for your work on doctrine!