/**
  * @expectedException \InvalidArgumentException
  */
 public function testActivateWithInvalidUsername()
 {
     $userManagerMock = $this->createMock('FOS\\UserBundle\\Model\\UserManagerInterface');
     $invalidusername = '******';
     $userManagerMock->expects($this->once())->method('findUserByUsername')->will($this->returnValue(null))->with($this->equalTo($invalidusername));
     $userManagerMock->expects($this->never())->method('updateUser');
     $manipulator = new UserManipulator($userManagerMock);
     $manipulator->activate($invalidusername);
 }
Пример #2
0
 /**
  * function description
  * Activation de l'Agent pour sa connexion 
  */
 public function ActivateAgentAction($username, $enable)
 {
     $userManager = $this->get('fos_user.user_manager');
     $userManipulator = new UserManipulator($userManager);
     if ($enable == 1) {
         $active = $userManipulator->deactivate($username);
     } else {
         $active = $userManipulator->activate($username);
     }
     return $this->ShowAgentAction($default = "Default");
 }
Пример #3
0
 /**
  * 
  * @Route("/StatusUser",name="StatusUser")
  * 
  * 
  */
 public function StatusUsersAction(Request $request)
 {
     $enable = $request->get('enable');
     $username = $request->get('username');
     $userManager = $this->get('fos_user.user_manager');
     $userManipulator = new UserManipulator($userManager);
     if ($enable == 1) {
         $active = $userManipulator->deactivate($username);
     } else {
         $active = $userManipulator->activate($username);
     }
     return $this->redirect($this->generateUrl("listusers"));
 }