當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Mock::shouldDeferMissing方法代碼示例

本文整理匯總了PHP中Mockery\Mock::shouldDeferMissing方法的典型用法代碼示例。如果您正苦於以下問題:PHP Mock::shouldDeferMissing方法的具體用法?PHP Mock::shouldDeferMissing怎麽用?PHP Mock::shouldDeferMissing使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Mockery\Mock的用法示例。


在下文中一共展示了Mock::shouldDeferMissing方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: sendNewPassword_can_send_a_new_password

 /**
  * @test sendNewPassword() can send a new password
  */
 public function sendNewPassword_can_send_a_new_password()
 {
     $user = Mockery::mock();
     $user->shouldReceive('getAttribute')->with('email')->once()->andReturn('baz');
     $user->shouldReceive('getAttribute')->with('first_name')->once()->andReturn('John');
     $user->shouldReceive('getAttribute')->with('last_name')->once()->andReturn('Doe');
     $user->shouldReceive('checkResetPasswordCode')->with('foo')->once()->andReturn(true);
     $user->shouldReceive('getId')->withNoArgs()->once()->andReturn(1);
     $user->shouldReceive('attemptResetPassword')->with('foo', 'bar')->once()->andReturn(true);
     $throttle = Mockery::mock();
     $throttle->shouldReceive('unsuspend')->withNoArgs()->once()->andReturn(true);
     $this->sentry->shouldDeferMissing();
     $this->sentry->shouldReceive('findUserById')->with(1)->once()->andReturn($user);
     $this->mockably->shouldReceive('str_random')->with(16)->once()->andReturn('bar');
     $this->sentry->shouldReceive('findThrottlerByUserId')->with(1)->once()->andReturn($throttle);
     $this->applyConfigFixture();
     $this->lang->shouldReceive('get')->with('larapress::email.Password Reset!')->once()->andReturn('Subject');
     $this->mail->shouldReceive('send')->once();
     $this->mail->shouldReceive('failures')->once()->andReturn(array());
     $narrator = $this->getNarratorInstance();
     $narrator->sendNewPassword(1, 'foo');
     $this->assertEquals('Sending the email containing the new password failed. ' . 'Please try again later or contact the administrator.', $narrator->getMailErrorMessage());
 }
開發者ID:LaraGit,項目名稱:larapress,代碼行數:26,代碼來源:NarratorTest.php

示例2: getCurrentTimeDifference_can_throw_an_exception_on_bad_calls

 /**
  * @test getCurrentTimeDifference() can throw an exception on bad calls
  * @expectedException BadMethodCallException
  */
 public function getCurrentTimeDifference_can_throw_an_exception_on_bad_calls()
 {
     $this->mockably->shouldDeferMissing();
     $helpers = $this->getHelpersInstance();
     $helpers->getCurrentTimeDifference(0.0, 'foo');
 }
開發者ID:LaraGit,項目名稱:larapress,代碼行數:10,代碼來源:HelpersTest.php


注:本文中的Mockery\Mock::shouldDeferMissing方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。