当前位置: 首页>>代码示例>>PHP>>正文


PHP Mail::shouldReceive方法代码示例

本文整理汇总了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);
 }
开发者ID:laravel-italia,项目名称:site,代码行数:7,代码来源:SendPasswordRecoveryEmailTest.php

示例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');
 }
开发者ID:BibleBowl,项目名称:account,代码行数:10,代码来源:GroupRegistrationTest.php

示例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]);
 }
开发者ID:ryanrobertsname,项目名称:giftertipster.com,代码行数:25,代码来源:UpdateProductsTest.php

示例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');
 }
开发者ID:sharad23,项目名称:testing,代码行数:9,代码来源:FoodsControllerTest.php

示例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('/');
 }
开发者ID:abada,项目名称:webshop,代码行数:14,代码来源:InscriptionTest.php

示例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);
     }
 }
开发者ID:rlacerda83,项目名称:recommendation-system-service,代码行数:20,代码来源:ControllerTest.php

示例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());
 }
开发者ID:clarkwinkelmann,项目名称:forms,代码行数:14,代码来源:SubmissionTest.php

示例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);
 }
开发者ID:BibleBowl,项目名称:account,代码行数:18,代码来源:ThirdPartyAuthTest.php

示例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');
 }
开发者ID:bengitiger,项目名称:cleverup-crm-laravel5,代码行数:17,代码来源:PasswordControllerTest.php

示例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();
 }
开发者ID:larasite,项目名称:larasite,代码行数:21,代码来源:SendMailFomrTest.php

示例11: receivesNotificationsForPastDueRegistrationFees

 /**
  * @test
  */
 public function receivesNotificationsForPastDueRegistrationFees()
 {
     Mail::shouldReceive('queue')->once();
     Artisan::call(\BibleBowl\Seasons\RemindGroupsOfPendingRegistrationPayments::COMMAND);
 }
开发者ID:BibleBowl,项目名称:account,代码行数:8,代码来源:SeasonalRegistrationTest.php

示例12: receivesNotificationsForOutstandingRegistrationFees

 /**
  * @test
  */
 public function receivesNotificationsForOutstandingRegistrationFees()
 {
     Mail::shouldReceive('queue')->once();
     Artisan::call(\BibleBowl\Seasons\NotifyOfficeOfOutstandingRegistrationPayments::COMMAND);
 }
开发者ID:BibleBowl,项目名称:account,代码行数:8,代码来源:GroupsTest.php

示例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);
 }
开发者ID:Korko,项目名称:SecretSanta,代码行数:22,代码来源:RequestTest.php

示例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);
 }
开发者ID:pra85,项目名称:timegrid,代码行数:8,代码来源:TransMailTest.php


注:本文中的Mail::shouldReceive方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。