/**
  * @test
  **/
 public function it_send_email_if_user_exists_and_is_not_active_and_set_message()
 {
     $this->enableEmailConfirmation();
     $input = ["email" => "*****@*****.**", "password" => "pass", "activated" => 0, "first_name" => "", "last_name" => ""];
     StateKeeper::set('expected_to', $input["email"]);
     StateKeeper::set('expected_subject', "Registration request to: " . Config::get('acl_base.app_name'));
     StateKeeper::set('expected_body', 'You account has been created. However, before you can use it you need to confirm your email address first by clicking the');
     $mock_register_service = m::mock('register_service')->shouldReceive('sendRegistrationMailToClient')->getMock();
     App::instance('register_service', $mock_register_service);
     $this->activateSingleEmailCheck();
     $this->user_repository->create($input);
     $validator = new UserSignupEmailValidator();
     $this->assertFalse($validator->validateEmailUnique("email", $input["email"], $input));
     $this->assertTrue(Session::has('message'));
 }
 /**
  * @test
  * @jtodoIMP TODO fix this when try to send mail
  **/
 public function it_process_recovery_data_and_redirect_with_success()
 {
     StateKeeper::set('expected_to', $this->current_email);
     StateKeeper::set('expected_subject', 'Password recovery request');
     StateKeeper::set('expected_body', 'We received a request to change your password, if you authorize it');
     Event::listen('mailer.sending', 'LaravelAcl\\Authentication\\Tests\\Unit\\AuthControllerTest@checkForSingleMailData');
     $this->route('POST', 'user.reminder', ["email" => $this->current_email]);
     $this->assertRedirectedTo('/user/reminder-success');
 }
 /**
  * @test
  **/
 public function sendsActivationEmail()
 {
     $this->disableEmailConfirmation();
     $user_email = "*****@*****.**";
     StateKeeper::set('expected_to', $user_email);
     StateKeeper::set('expected_subject', Config::get('acl_base.messages.email.user_registration_request_subject'));
     StateKeeper::set('expected_body', 'You can now login to the website using the');
     Event::listen('mailer.sending', 'LaravelAcl\\Authentication\\Tests\\Unit\\AuthControllerTest@checkForSingleMailData');
     $mock_validator = $this->getValidatorSuccess();
     $mock_user_repository = $this->mockUserRepositoryToCreateARandomUser();
     App::instance('user_repository', $mock_user_repository);
     $mock_profile_repository = $this->mockProfileRepositoryCreation();
     App::instance('profile_repository', $mock_profile_repository);
     $mock_auth = $this->mockAuthActiveToken();
     App::instance('authenticator', $mock_auth);
     $service = new UserRegisterService($mock_validator);
     $service->register(["email" => $user_email, "password" => "p", "activated" => 1, "first_name" => "first_name"]);
 }