/** * @param InputInterface $input * @param OutputInterface $output * @return int|null|void */ protected function execute(InputInterface $input, OutputInterface $output) { $output->writeln('Creating sample institutions...'); $getInstitutions = $this->getInstitutionsFromFile($input, $output); $findCountry = $this->em->getRepository('BulutYazilimLocationBundle:Country')->find($this->getContainer()->getParameter('country_id')); foreach ($getInstitutions as $institutionName) { $institutionName = trim($institutionName); $output->writeln($institutionName); $institution = new Institution(); $institution->setName($institutionName); $institution->setCountry($findCountry); $this->em->persist($institution); } $this->em->flush(); }
public function testDelete() { $em = $this->em; $institution = new Institution(); $institution->setCurrentLocale($this->locale); $institution->setEmail('*****@*****.**'); $institution->setName('Delete Institution Name - phpunit'); $institution->setUrl('http://ojs.io'); $institution->setAbout('About'); $institution->setPhone('0123456789'); $institution->setAddress('address'); $publisherType = $em->getRepository('OjsJournalBundle:PublisherTypes')->find(1); $institution->setInstitutionType($publisherType); $em->persist($institution); $em->flush(); $id = $institution->getId(); $this->logIn(); $client = $this->client; $token = $this->generateToken('ojs_admin_institution' . $id); $client->request('DELETE', '/admin/institution/' . $id . '/delete', array('_token' => $token)); $this->assertStatusCode(302, $client); }