public function testSend() { $user = m::mock(); $user->shouldReceive('getResetPasswordCode')->once()->andReturn('123456789'); Mail::shouldReceive('queue')->once()->with(m::type('array'), array('user' => $user, 'code' => '123456789'), m::type('closure')); $this->reset->send($user); }
public function testSend() { $user = m::mock(); $user->shouldReceive('getActivationCode')->once()->andReturn('secretC0d3'); Mail::shouldReceive('queue')->once()->with(m::type('array'), array('user' => $user, 'code' => 'secretC0d3'), m::type('closure')); $this->activation->send($user); }
/** * @test * @group unit */ public function it_registers_MailRecorder_withMail_in_the_setup_with_before_annotated_method() { $swift_mock = Mockery::mock(Swift_Mailer::class); $swift_mock->shouldReceive('registerPlugin')->once()->with(Mockery::on(function ($closure) { return is_a($closure, MailRecorder::class); }))->andReturnNull(); Mail::shouldReceive('getSwiftMailer')->once()->withNoArgs()->andReturn($swift_mock); // TODO: Get this method name by parsing annotations $this->mail_tracking->setUpMailTracking(); }
public function testSendEmailInvite() { \Illuminate\Support\Facades\Request::setSession($this->app['session.store']); $user = User::findOrFail(1); Mail::shouldReceive('send')->once()->andReturn(function ($message) { $this->assertEquals('fleetany invitation', $message->getSubject()); $this->assertEquals($user->email, $message->getTo()); $this->assertEquals(View::make('emails.invite'), $message->getBody()); }); try { $repo = new UserRepositoryEloquent(new Application()); $userController = new InviteController($repo); $userController->sendEmailInvite($user->id); } catch (\Exception $e) { echo $e->getMessage(); } }
public function testSendEmailNotification() { Mail::shouldReceive('queue')->once(); $email = new \Skovachev\Notifier\Notifiers\EmailNotifier(); Config::shouldReceive('get')->once()->with('notifier::email.enabled')->andReturn(true); Config::shouldReceive('get')->once()->with('notifier::views_folder')->andReturn('viewsFolder'); Config::shouldReceive('get')->once()->with('notifier::email.from_email')->andReturn('fromEmail'); Config::shouldReceive('get')->once()->with('notifier::email.cc_email')->andReturn('ccEmail'); Config::shouldReceive('get')->once()->with('notifier::email.bcc_email')->andReturn('bccEmail'); Config::shouldReceive('get')->once()->with('notifier::email.getter_email')->andReturn(function ($user) { return 'getterEmail'; }); Config::shouldReceive('get')->once()->with('notifier::email.getter_name')->andReturn(function ($user) { return 'userName'; }); $email->notify('fooUser', 'fooView', array('foo' => 'bar')); }