/** * {@inheritDoc} */ public function load(ObjectManager $manager) { // Add application for e2e test in frontend $response = new Response(); $response->setName("Test"); $response->setUrl("test"); $response->setValue(array("Dummy" => "Data")); $response->setMethod("GET"); $response->setStatusCode(200); $application = $this->getReference(sprintf('test_application')); $response->setApplication($application); $manager->persist($response); $faker = Factory::create('pl_PL'); $arrayOfMethod = ['POST', 'GET', 'DELETE', 'PUT']; $arrayOfStatusCode = [200, 201, 403, 500]; for ($i = 0; $i < self::RESPONSE_NUMBER; $i++) { $response = new Response(); $response->setName($faker->word); $response->setUrl($faker->word . '/' . $faker->word); $response->setValue(array($faker->word => $faker->word)); $key = array_rand($arrayOfMethod); $response->setMethod($arrayOfMethod[$key]); $key = array_rand($arrayOfStatusCode); $response->setStatusCode($arrayOfStatusCode[$key]); $random = rand(0, LoadApplicationData::APPLICATIONS_NUMBER - 1); $application = $this->getReference(sprintf('application-%s', $random)); $response->setApplication($application); $manager->persist($response); } $manager->flush(); }
public function createFirst(Application $application) { $value = array("Message" => "Hello world!!!"); $response = new Response(); $response->setName("Hello world"); $response->setUrl("welcome"); $response->setMethod("GET"); $response->setStatusCode(200); $response->setValue($value); $response->setApplication($application); return $response; }