From 7524041a76bcef6c1bec8d72ab5ea3232d0ab446 Mon Sep 17 00:00:00 2001 From: Pig Fang Date: Fri, 13 Jul 2018 19:23:20 +0800 Subject: [PATCH] use `Mail::fake()` --- tests/AuthControllerTest.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/AuthControllerTest.php b/tests/AuthControllerTest.php index 52a9b3ec..dc40ff12 100644 --- a/tests/AuthControllerTest.php +++ b/tests/AuthControllerTest.php @@ -401,6 +401,8 @@ class AuthControllerTest extends TestCase public function testHandleForgot() { + Mail::fake(); + // Should return a warning if `captcha` is wrong $this->withSession(['phrase' => 'a'])->postJson('/auth/forgot', [ 'captcha' => 'b' @@ -443,9 +445,7 @@ class AuthControllerTest extends TestCase $user->getToken().substr(time(), 4, 6).str_random(16) ); $url = Option::get('site_url')."/auth/reset?uid=$uid&token=$token"; - // An email should be send - // Laravel supports `Mail::fake()` since v5.4, but now we cannot - // Thanks: https://stackoverflow.com/questions/31120567/unittesting-laravel-5-mail-using-mock + // @see https://stackoverflow.com/questions/31120567/unittesting-laravel-5-mail-using-mock Mail::shouldReceive('send') ->once() ->with(