mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2026-03-17 11:27:45 +00:00
Add seeds to data fixtures, to avoid random failures in tests
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user