コード例 #1
0
ファイル: DaySpec.php プロジェクト: TumTum/TrolleyAgenda
 /**
  * Der User konnte gehen, wurde gecancelt.
  * Daraufhin bewarb er sich erneut, und bekommt den nicht angenommen Status
  */
 public function it_user_removed_so_next_time_is_autmatic_accept_to_go(User $user)
 {
     $user->getUsername()->shouldBeCalled()->willReturn('UserCanGo');
     $this->addUser($user);
     $this->userAcceptToGo($user);
     $this->removeUser($user);
     $this->addUser($user);
     $this->canUserGo($user)->shouldReturn(false);
 }
コード例 #2
0
 /**
  * @Route("/new");
  * @Security("has_role('ROLE_ADMIN')");
  *
  * @param Request $request
  */
 public function newAction(Request $request)
 {
     $user = new User();
     $user->setEnabled('true');
     list($isSaveDB, $form) = $this->_userFromSave($user, $request);
     if ($isSaveDB) {
         $this->addFlash('success', 'page.user.saved_sussfully');
         return $this->redirectToRoute('trolley_agenda_users_edit', ['id' => $user->getId()]);
     }
     return $this->render('TrolleyAgendaBundle:Users:edit.html.twig', ['user' => $user, 'user_form' => $form->createView()]);
 }
コード例 #3
0
 /**
  * @param string $username
  *
  * @return User
  */
 public function createUser($username = '******', $admin = false)
 {
     $user = new User();
     $user->setUsername($username);
     $user->setFirstlastname($username . " bot");
     $user->setEmail($username . '@localhost');
     $user->setPlainPassword($username . 'passwort');
     $user->setEnabled(true);
     if ($admin) {
         $user->addRole('ROLE_ADMIN');
     }
     return $user;
 }
コード例 #4
0
 /**
  * Erstellt einen Admin Login User
  *
  * @return User
  */
 protected function createLoginAdminUser()
 {
     $testAdminUser = new User();
     $testAdminUser->setUsername('testadminlogin');
     $testAdminUser->setPlainPassword('0e487493');
     $testAdminUser->setEmail('testadmin@localhost');
     $testAdminUser->addRole('ROLE_ADMIN');
     $testAdminUser->setEnabled(true);
     return $testAdminUser;
 }
コード例 #5
0
ファイル: MockUser.php プロジェクト: TumTum/TrolleyAgenda
 /**
  * @param User   $user
  * @param string $username
  * @param bool   $admin
  *
  * @return mixed
  */
 public static function User($user, $username = '******', $admin = false, $shouldBeCalled = false)
 {
     $user->getId()->willReturn(self::getAutoIncrement());
     $user->getUsername()->willReturn($username);
     $user->getFirstlastname()->willReturn($username . " bot");
     $user->getEmail()->willReturn($username . '@localhost');
     $user->isEnabled()->willReturn(true);
     $user->hasRole('ROLE_ADMIN')->willReturn($admin);
     self::markShouldBeCalled([$user->getId(), $user->getUsername(), $user->getFirstlastname(), $user->getEmail()], $shouldBeCalled);
     return $user;
 }