Skip to content

Latest commit

 

History

History
23 lines (15 loc) · 936 Bytes

File metadata and controls

23 lines (15 loc) · 936 Bytes

Abnormal behavior of relations during tests

using liip/test-fixtures-bundle and hautelook/alice-bundle

Abnormal behavior:

I have 2 entities Board and Lane that have a OneToMany relationship. Everything works normally with the entities loaded from the database. However, I had problems with my tests if I load the fixtures before, the collections are empty when they should contain data.

To demonstrate the bug I started from the Symfony Docker to make it easier to reproduce the bug. I removed caddy and postgres since they are not necessary to see the bug.

There is a Makefile, so to see the bug, you can do :

make dev-up

make test

Solution:

Well I think it come from theofidry/AliceDataFixtures peristerloader. I have to add the following code after have loaded the fixtures and tests pass: static::getContainer()->get('doctrine')->getManager()->clear();