/** @test */ public function generateMailerFailure() { $user = $this->getMockUser(); $user->shouldReceive('deactivate')->once(); $this->codes->shouldReceive('deleteUser')->with($user); $this->codes->shouldReceive('create')->with($user, m::type('string')); $user->shouldReceive('getActivationEmail')->andReturn('*****@*****.**'); $this->mailer->shouldReceive('send')->once()->andReturn(true); $this->mailer->shouldReceive('failures')->once()->andReturn(['*****@*****.**']); $this->setExpectedException('anlutro\\Core\\Auth\\Activation\\ActivationException'); $this->activation->generate($user); }
/** * Send an activation code to a user. * * @param UserModel $user * * @return void */ public function sendActivationCode($user) { if ($this->activations === null) { throw new \RuntimeException('Activation service not set.'); } $this->activations->generate($user); }