protected function setUp()
 {
     $this->initAutoload();
     $this->bbapp = $this->getBBApp();
     $this->initDb($this->bbapp);
     $this->bbapp->start();
     // valid user
     $user = new User();
     $user->setLogin('user123');
     $user->setEmail('*****@*****.**');
     $user->setPassword(md5('password123'));
     $user->setActivated(true);
     $this->getEntityManager()->persist($user);
     $this->getEntityManager()->flush();
     $this->controller = $this->getController();
 }
Example #2
0
 /**
  * @covers ::postAction
  * @expectedException \Symfony\Component\HttpKernel\Exception\ConflictHttpException
  * @expectedExceptionMessage User with that login already exists: usernameDuplicate
  */
 public function testPostActionDuplicateLogin()
 {
     // set up permissions
     $aclManager = $this->getBBApp()->getContainer()->get('security.acl_manager');
     $aclManager->insertOrUpdateClassAce(new ObjectIdentity('all', get_class($this->user)), UserSecurityIdentity::fromAccount($this->user), MaskBuilder::MASK_CREATE);
     $controller = $this->getController();
     // create user
     $user = new User();
     $user->setLogin('usernameDuplicate')->setEmail('*****@*****.**')->setPassword('password123')->setApiKeyEnabled(false)->setApiKeyPrivate('PRIVATE_KEY')->setApiKeyPublic('PUBLIC_KEY')->setFirstname('FirstName')->setLastname('LastName')->setActivated(true);
     $this->getBBApp()->getEntityManager()->persist($user);
     $this->getBBApp()->getEntityManager()->flush();
     $response = $controller->postAction(new Request([], ['login' => 'usernameDuplicate', 'email' => '*****@*****.**', 'api_key_enabled' => true, 'api_key_public' => 'api_key_public', 'api_key_private' => 'api_key_private', 'firstname' => 'first_name', 'lastname' => 'last_name', 'activated' => false, 'password' => 'password']));
 }