Add seeds to data fixtures, to avoid random failures in tests

This commit is contained in:
2026-03-09 13:00:30 +00:00
parent e2dec28577
commit a921009eff
16 changed files with 78 additions and 41 deletions

View File

@@ -25,7 +25,10 @@ class LoadRelationships extends Fixture implements DependentFixtureInterface
{
use PersonRandomHelper;
public function __construct(private readonly EntityManagerInterface $em) {}
public function __construct(private readonly EntityManagerInterface $em)
{
mt_srand(123456789);
}
public function getDependencies(): array
{
@@ -47,8 +50,8 @@ class LoadRelationships extends Fixture implements DependentFixtureInterface
->setFromPerson($this->getRandomPerson($this->em))
->setToPerson($this->getRandomPerson($this->em))
->setRelation($this->getReference(LoadRelations::RELATION_KEY.
random_int(0, \count(LoadRelations::RELATIONS) - 1), Relation::class))
->setReverse((bool) random_int(0, 1))
mt_rand(0, \count(LoadRelations::RELATIONS) - 1), Relation::class))
->setReverse((bool) mt_rand(0, 1))
->setCreatedBy($user)
->setUpdatedBy($user)
->setCreatedAt($date)