mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2026-04-04 20:13:42 +00:00
Add seeds to data fixtures, to avoid random failures in tests
This commit is contained in:
@@ -55,6 +55,9 @@ final class RelationshipApiControllerTest extends WebTestCase
|
||||
|
||||
public static function personProvider(): array
|
||||
{
|
||||
// fix a seed to avoid random errors
|
||||
mt_srand(1234588755);
|
||||
|
||||
self::bootKernel();
|
||||
$em = self::getContainer()->get(EntityManagerInterface::class);
|
||||
$personIdHavingRelation = $em->createQueryBuilder()
|
||||
@@ -116,6 +119,9 @@ final class RelationshipApiControllerTest extends WebTestCase
|
||||
|
||||
public static function relationProvider(): array
|
||||
{
|
||||
// fix a seed to avoid random errors
|
||||
mt_srand(1234588755);
|
||||
|
||||
self::bootKernel();
|
||||
$em = self::getContainer()->get(EntityManagerInterface::class);
|
||||
$personIdWithoutRelations = $em->createQueryBuilder()
|
||||
@@ -144,6 +150,8 @@ final class RelationshipApiControllerTest extends WebTestCase
|
||||
->findAll();
|
||||
}
|
||||
|
||||
return self::$relations[\array_rand(self::$relations)];
|
||||
$keys = array_keys(self::$relations);
|
||||
|
||||
return self::$relations[mt_rand(0, \count($keys) - 1)];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user