本文整理汇总了PHP中Mail::shouldReceive方法的典型用法代码示例。如果您正苦于以下问题:PHP Mail::shouldReceive方法的具体用法?PHP Mail::shouldReceive怎么用?PHP Mail::shouldReceive使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mail
的用法示例。
在下文中一共展示了Mail::shouldReceive方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testSend
public function testSend()
{
$this->event->expects($this->once())->method('getUser')->willReturn($this->user);
$this->event->expects($this->once())->method('getToken')->willReturn('test_token');
\Mail::shouldReceive('send')->once();
$this->listener->handle($this->event);
}
示例2: canInviteQuizmasters
/**
* @test
*/
public function canInviteQuizmasters()
{
$tournament = Tournament::firstOrFail();
// verify the quizzing preferences email is sent
Mail::shouldReceive('queue')->once();
$this->visit('/tournaments/' . $tournament->slug . '/group')->click('Add Quizmaster')->type('John', 'first_name')->type('Gutson', 'last_name')->type('tester123' . time() . '@no-domain.com', 'email')->press('Save & Continue')->see('Quizmaster has been added')->see('John Gutson');
}
示例3: testCommandWithMailNotificationOptions
public function testCommandWithMailNotificationOptions()
{
$prod_repo_mock = Mockery::mock('Giftertipster\\Repository\\Product\\ProductRepositoryInterface');
$prod_repo_mock->shouldReceive('getRefreshedIdRange')->once()->with(1, null, 100)->andReturn([['id' => 1, 'vendor' => 'amz', 'vendor_id' => 'a1'], ['id' => 2, 'vendor' => 'amz', 'vendor_id' => 'a2']]);
$prod_repo_mock->shouldReceive('getRefreshedIdRange')->once()->with(3, null, 100)->andReturn(false);
$this->app->instance('Giftertipster\\Repository\\Product\\ProductRepositoryInterface', $prod_repo_mock);
$amz_prod_repo_mock = Mockery::mock('Giftertipster\\Repository\\AmzProduct\\AmzProductRepositoryInterface');
$amz_prod_repo_mock->shouldReceive('detailLookup')->with('a1, a2')->once()->andReturn([['vendor' => 'amz', 'vendor_id' => 'a2'], ['vendor' => 'amz', 'vendor_id' => 'a1']]);
$this->app->instance('Giftertipster\\Repository\\AmzProduct\\AmzProductRepositoryInterface', $amz_prod_repo_mock);
$prod_suite_repo_mock = Mockery::mock('Giftertipster\\Repository\\ProductSuite\\ProductSuiteRepositoryInterface');
$prod_suite_repo_mock->shouldreceive('update')->with(1, ['vendor' => 'amz', 'vendor_id' => 'a1'], true)->once()->andReturn(true);
$prod_suite_repo_mock->shouldreceive('update')->with(2, ['vendor' => 'amz', 'vendor_id' => 'a2'], true)->once()->andReturn(true);
$this->app->instance('Giftertipster\\Repository\\ProductSuite\\ProductSuiteRepositoryInterface', $prod_suite_repo_mock);
$job = $this->app->make('Giftertipster\\Entity\\Eloquent\\RangeCronJob');
$job->last_id_processed = 0;
$job->last_status = 'success';
$cron_job_repo_mock = Mockery::mock('Giftertipster\\Repository\\RangeCronJob\\RangeCronJobRepositoryInterface');
$cron_job_repo_mock->shouldReceive('findJob')->with('products_update')->once()->andReturn($job);
$cron_job_repo_mock->shouldReceive('updateJob')->with($job, 'in_progress', 2)->once()->andReturn(true);
$cron_job_repo_mock->shouldReceive('updateJob')->with($job, 'success', 2)->once()->andReturn(true);
$this->app->instance('Giftertipster\\Repository\\RangeCronJob\\RangeCronJobRepositoryInterface', $cron_job_repo_mock);
\Mail::shouldReceive('send')->once();
$tester = new CommandTester(new UpdateProducts());
$tester->execute(['--mail-notification' => true]);
}
示例4: testEsarz
public function testEsarz()
{
$this->mock->shouldReceive('create')->once();
$this->app->instance('Food', $this->mock);
Validator::shouldReceive('make')->once()->andReturn(Mockery::mock(['fails' => false]));
Mail::shouldReceive('send')->once()->with('emails.post', ['title' => 'dasdasd'], $this->getSendCallbackMock());
$this->call('POST', 'esarz', array('title' => 'dasdasd'));
$this->assertRedirectedToRoute('foods.index');
}
示例5: testSubscription
/**
*
* @return void
*/
public function testSubscription()
{
$user = factory(App\Droit\Newsletter\Entities\Newsletter_users::class)->make();
$user->subscriptions = factory(App\Droit\Newsletter\Entities\Newsletter_subscriptions::class)->make();
$this->subscription->shouldReceive('findByEmail')->once()->andReturn(null);
$this->subscription->shouldReceive('create')->once()->andReturn($user);
Mail::shouldReceive('send')->once();
$response = $this->call('POST', 'subscribe', ['email' => 'info@leschaud.ch']);
$this->assertRedirectedTo('/');
}
示例6: testSendEmail
/**
* @param $queryParams
* @param $expectedResult
*
* @dataProvider providerTestSendEmail
*/
public function testSendEmail($queryParams, $expectedResult)
{
if ($queryParams['save'] == true && $expectedResult == 201) {
$totalBefore = Email::count();
}
Mail::shouldReceive('send')->andReturn(true);
Mail::shouldReceive('queue')->andReturn(true);
$this->call('POST', '/api/emails/send', $queryParams, [], [], $this->serverParams);
$this->assertResponseStatus($expectedResult);
if ($queryParams['save'] == true && $expectedResult == 201) {
$totalAfter = Email::count();
$this->assertEquals($totalBefore, $totalAfter - 1);
}
}
示例7: testSendEmailConfirmation
public function testSendEmailConfirmation()
{
$form = Form::where('slug', 'test-with-email-confirmation')->firstOrFail();
Mail::shouldReceive('send')->once()->andReturnUsing(function ($view, $data, $callback) {
// replicate the behavior of Illuminate\Mail\Mailer::callMessageBuilder()
// so we can test what would have been the result of the send() method
$message = new Message(new Swift_Message());
call_user_func($callback, $message);
$this->assertEquals('john@example.com', collect($message->getTo())->keys()->first());
return $message;
});
$response = $this->call('POST', '/forms/' . $form->slug, ['email' => 'john@example.com']);
$this->assertEquals(201, $response->status());
}
示例8: loginViaOAuth2
/**
* @test
*/
public function loginViaOAuth2()
{
Mail::shouldReceive('send');
$this->expectsEvents('auth.registered');
$this->call('GET', '/login/' . ThirdPartyAuthenticator::PROVIDER_GOOGLE, ['code' => uniqid()]);
$this->assertRedirectedTo('/dashboard');
//assert user created
$name = explode(' ', $this->providerUser->getName());
$createdUser = User::where('first_name', $name[0])->where('last_name', $name[1])->where('email', $this->providerUser->getEmail())->where('avatar', $this->providerUser->getAvatar())->first();
$this->assertGreaterThan(0, $createdUser->id);
//assert OAuth id is linked to user
$userProvider = $createdUser->providers->first();
$this->assertEquals(ThirdPartyAuthenticator::PROVIDER_GOOGLE, $userProvider->provider);
$this->assertEquals($this->providerUser->getId(), $userProvider->provider_id);
}
示例9: testEmail
public function testEmail()
{
$user = $this->user;
$subject = 'Your Password Reset Link';
Mail::shouldReceive('send')->once()->with('emails.password', m::on(function ($data) {
$this->assertArrayHasKey('user', $data);
return true;
}), m::on(function (\Closure $closure) use($user, $subject) {
$mock = m::mock('Illuminate\\Mail\\Message');
$mock->shouldReceive('to')->once()->with($user->email)->andReturn($mock);
//simulate the chaining
$mock->shouldReceive('subject')->once()->with($subject);
$closure($mock);
return true;
}));
$this->visit('/password/email')->see('Reset Password')->type($this->email, 'email')->press('Send Password Reset Link');
}
示例10: testSendMail
public function testSendMail()
{
$datas = $this->validData(['title' => 'TITLE', 'question' => 'QUESTION']);
$filterd_datas = [];
foreach ($datas as $key => $value) {
if ($key[0] != '_') {
$filterd_datas[$key] = $value;
}
}
$message = m::mock(Message::class);
$message->shouldReceive('from')->once()->with($datas['email'], $datas['name'])->andReturn($message);
$message->shouldReceive('replyTo')->once()->with($datas['email'], $datas['name'])->andReturn($message);
$message->shouldReceive('to')->once()->with($this->to['address'], $this->to['name'])->andReturn($message);
$message->shouldReceive('subject')->once()->with($datas['_mailform_subject'])->andReturn($message);
\Mail::shouldReceive('send')->once()->with(['text' => 'emails.mailform'], ['data' => $filterd_datas], m::on(function (\Closure $closure) use($message) {
$closure($message);
return true;
}));
$mailForm = new SendMailForm($datas);
$mailForm->handle();
}
示例11: receivesNotificationsForPastDueRegistrationFees
/**
* @test
*/
public function receivesNotificationsForPastDueRegistrationFees()
{
Mail::shouldReceive('queue')->once();
Artisan::call(\BibleBowl\Seasons\RemindGroupsOfPendingRegistrationPayments::COMMAND);
}
示例12: receivesNotificationsForOutstandingRegistrationFees
/**
* @test
*/
public function receivesNotificationsForOutstandingRegistrationFees()
{
Mail::shouldReceive('queue')->once();
Artisan::call(\BibleBowl\Seasons\NotifyOfficeOfOutstandingRegistrationPayments::COMMAND);
}
示例13: testOk_several
public function testOk_several()
{
Recaptcha::shouldReceive('verify')->once()->andReturn(true);
Mail::shouldReceive('raw')->once()->with('#test mail toto => tata#', Mockery::on(function ($closure) {
$message = Mockery::mock('Illuminate\\Mailer\\Message');
$message->shouldReceive('to')->with('test@test.com', 'toto')->andReturn(Mockery::self());
$message->shouldReceive('subject')->with('test mail title')->andReturn(Mockery::self());
$closure($message);
return true;
}))->andReturn(true);
Mail::shouldReceive('raw')->once()->with('#test mail tutu => toto#', Mockery::on(function ($closure) {
$message = Mockery::mock('Illuminate\\Mailer\\Message');
$message->shouldReceive('to')->with('test2@test.com', 'tutu')->andReturn(Mockery::self());
$message->shouldReceive('subject')->with('test mail title')->andReturn(Mockery::self());
$closure($message);
return true;
}))->andReturn(true);
Sms::shouldReceive('message')->once()->with('0612345678', '#test sms "tata\' => &tutu#')->andReturn(true);
Sms::shouldReceive('message')->once()->with('0712345678', '#test sms "tutu\' => &toto#')->andReturn(true);
$content = $this->ajaxPost('/', ['g-recaptcha-response' => 'mocked', 'name' => ['toto', 'tata', 'tutu'], 'email' => ['test@test.com', '', 'test2@test.com'], 'phone' => ['', '0612345678', '0712345678'], 'exclusions' => [['2'], ['0'], ['1']], 'title' => 'test mail title', 'contentMail' => 'test mail {SANTA} => {TARGET}', 'contentSMS' => 'test sms "{SANTA}\' => &{TARGET}'], 200);
$this->assertEquals(['Envoyé avec succès !'], $content);
}
示例14: it_sends_a_localized_email
/**
* @test
*/
public function it_sends_a_localized_email()
{
$this->mail->shouldReceive('send');
$this->transmail->locale('en_US.utf8')->template('welcome')->subject('welcome')->send($this->header, $this->params);
}