/**
  * @test
  **/
 public function it_check_for_permission_and_set_error_incase()
 {
     $mock_auth_helper = m::mock('StdClass')->shouldReceive('checkProfileEditPermission')->once()->andReturn(false)->getMock();
     App::instance('authentication_helper', $mock_auth_helper);
     $service = new UserProfileService(new VoidValidator());
     try {
         $service->processForm(["user_id" => 1]);
     } catch (\Jacopo\Authentication\Exceptions\PermissionException $e) {
     }
     $errors = $service->getErrors();
     $this->assertTrue($errors->has('model'));
 }
 public function postEditProfile()
 {
     $input = Input::all();
     $service = new UserProfileService($this->profile_validator);
     try {
         $service->processForm($input);
     } catch (JacopoExceptionsInterface $e) {
         $errors = $service->getErrors();
         return Redirect::back()->withInput()->withErrors($errors);
     }
     return Redirect::back()->withInput()->withMessage(Config::get('laravel-authentication-acl::messages.flash.success.user_profile_edit_success'));
 }
 public function postEditProfile()
 {
     $input = Input::all();
     $service = new UserProfileService($this->profile_validator);
     try {
         $service->processForm($input);
     } catch (JacopoExceptionsInterface $e) {
         $errors = $service->getErrors();
         return Redirect::back()->withInput()->withErrors($errors);
     }
     return Redirect::back()->withInput()->withMessage("Profile edited with success.");
 }