示例#1
0
 /**
  * @BeforeScenario
  */
 public function createApiApp(ScenarioEvent $event)
 {
     $user = $this->getMainContext()->getSubcontext('entity')->getAuthoriseUser();
     $manager = $this->kernel->getContainer()->get('fos_oauth_server.client_manager.default');
     $app = new ExternalApp();
     $app->setUser($user)->setName('Test App')->setAppType('website')->setDescription('Lorem ipsum');
     $app->setRedirectUrisString('');
     $manager->updateClient($app);
     $this->app = $app;
 }
示例#2
0
 public function createApiApp()
 {
     $em = $this->getEntityManager();
     $this->appUser = new User();
     $this->appUser->setEmail('*****@*****.**')->setName('Test User');
     $factory = $this->client->getKernel()->getContainer()->get('security.encoder_factory');
     $encoder = $factory->getEncoder($this->appUser);
     $hashed_password = $encoder->encodePassword('password', $this->appUser->getSalt());
     $this->appUser->setPassword($hashed_password);
     $em->persist($this->appUser);
     $app = new ExternalApp();
     $app->setUser($this->appUser)->setName('Test App')->setAppType('website')->setDescription('Lorem ipsum');
     $app->setRedirectUrisString('');
     $em->persist($app);
     $em->flush();
     $this->app = $app;
 }