Exemplo n.º 1
0
 public function testRemoveUser()
 {
     $user = $this->getUserMock();
     $em = $this->getMockBuilder('Doctrine\\ORM\\EntityManagerInterface')->getMock();
     $em->expects($this->once())->method('remove')->with($user);
     $userCreateMail = $this->getUserCreateMailMock();
     $userFacade = new UserFacade($em, $userCreateMail);
     $userFacade->remove($user);
 }
Exemplo n.º 2
0
 /**
  * @Sensio\Route("/{id}/smazat", name="users_remove")
  * @Sensio\Method({"GET"})
  * @Sensio\ParamConverter("id", class="AppBundle:User")
  *
  * @param Request $request
  * @param User $user
  * @return Response
  */
 public function removeAction(User $user)
 {
     try {
         $this->userFacade->remove($user);
         $this->addFlash('success', 'Uživatel byl úspěšně vymazán');
     } catch (UserException $e) {
         $this->addFlash('danger', $e->getMessage());
     }
     return $this->redirectToRoute('users_index');
 }