use Mail::fake()
This commit is contained in:
parent
3f77c98783
commit
7524041a76
|
|
@ -401,6 +401,8 @@ class AuthControllerTest extends TestCase
|
||||||
|
|
||||||
public function testHandleForgot()
|
public function testHandleForgot()
|
||||||
{
|
{
|
||||||
|
Mail::fake();
|
||||||
|
|
||||||
// Should return a warning if `captcha` is wrong
|
// Should return a warning if `captcha` is wrong
|
||||||
$this->withSession(['phrase' => 'a'])->postJson('/auth/forgot', [
|
$this->withSession(['phrase' => 'a'])->postJson('/auth/forgot', [
|
||||||
'captcha' => 'b'
|
'captcha' => 'b'
|
||||||
|
|
@ -443,9 +445,7 @@ class AuthControllerTest extends TestCase
|
||||||
$user->getToken().substr(time(), 4, 6).str_random(16)
|
$user->getToken().substr(time(), 4, 6).str_random(16)
|
||||||
);
|
);
|
||||||
$url = Option::get('site_url')."/auth/reset?uid=$uid&token=$token";
|
$url = Option::get('site_url')."/auth/reset?uid=$uid&token=$token";
|
||||||
// An email should be send
|
// @see https://stackoverflow.com/questions/31120567/unittesting-laravel-5-mail-using-mock
|
||||||
// Laravel supports `Mail::fake()` since v5.4, but now we cannot
|
|
||||||
// Thanks: https://stackoverflow.com/questions/31120567/unittesting-laravel-5-mail-using-mock
|
|
||||||
Mail::shouldReceive('send')
|
Mail::shouldReceive('send')
|
||||||
->once()
|
->once()
|
||||||
->with(
|
->with(
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user