コード例 #1
0
 public function testEditUserWithDisabledValidationWillProceedImmediatelyToSave()
 {
     $user = $this->createExampleUser();
     $this->repositoryMock->expects($this->never())->method('findById');
     $this->validatorMock->expects($this->never())->method('validate');
     $this->repositoryMock->expects($this->once())->method('save')->with($user);
     $this->useCase->editUser($user, false);
 }
コード例 #2
0
 /**
  * @param User $user
  * @param Request $request
  * @return View
  */
 private function processForm(User $user, Request $request)
 {
     $form = $this->formFactory->createNamed('', 'user_edit', $user);
     $form->handleRequest($request);
     if (!$form->isValid()) {
         return new View($form, 400);
     }
     $this->useCase->editUser($user, false);
     return new View($user, 200);
 }