public function test_Should_SendEmailNotification_When_ToAddressIsSet() { $mockSwiftMailer = $this->mock('Swift_Mailer'); $mockSwiftMailTransport = $this->mockPartial('Swift_MailTransport'); $mockSwiftMailer->shouldReceive('send'); $mockSwiftMailer->shouldReceive('getTransport')->andReturn($mockSwiftMailTransport); $this->app['mailer']->setSwiftMailer($mockSwiftMailer); $notifier = new MailNotifier(); $notifier->to('*****@*****.**')->notify('Subject', 'Message'); }