mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2026-04-04 12:03:44 +00:00
Add seeds to data fixtures, to avoid random failures in tests
This commit is contained in:
@@ -41,6 +41,7 @@ class LoadOption extends AbstractFixture implements OrderedFixtureInterface
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
mt_srand(123456789);
|
||||
$this->fakerFr = \Faker\Factory::create('fr_FR');
|
||||
$this->fakerEn = \Faker\Factory::create('en_EN');
|
||||
$this->fakerNl = \Faker\Factory::create('nl_NL');
|
||||
@@ -104,7 +105,7 @@ class LoadOption extends AbstractFixture implements OrderedFixtureInterface
|
||||
$manager->persist($parent);
|
||||
|
||||
// Load children
|
||||
$expected_nb_children = random_int(10, 50);
|
||||
$expected_nb_children = mt_rand(10, 50);
|
||||
|
||||
for ($i = 0; $i < $expected_nb_children; ++$i) {
|
||||
$companyName = $this->fakerFr->company;
|
||||
@@ -144,7 +145,7 @@ class LoadOption extends AbstractFixture implements OrderedFixtureInterface
|
||||
$manager->persist($parent);
|
||||
|
||||
// Load children
|
||||
$expected_nb_children = random_int(10, 50);
|
||||
$expected_nb_children = mt_rand(10, 50);
|
||||
|
||||
for ($i = 0; $i < $expected_nb_children; ++$i) {
|
||||
$manager->persist($this->createChildOption($parent, [
|
||||
|
||||
Reference in New Issue
Block a user