/** * @Given there is :nb dummy objects */ public function thereIsDummyObjects($nb) { $descriptions = ['Smart dummy.', 'Not so smart dummy.']; for ($i = 1; $i <= $nb; ++$i) { $dummy = new Dummy(); $dummy->setName('Dummy #' . $i); $dummy->setAlias('Alias #' . ($nb - $i)); $dummy->setDummy('SomeDummyTest' . $i); $dummy->setDescription($descriptions[($i - 1) % 2]); $this->manager->persist($dummy); } $this->manager->flush(); }