Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F120825967
PasswordResetEmailTest.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None
PasswordResetEmailTest.php
View Options
<?php
namespace
Tests\Feature\Jobs
;
use
App\Jobs\PasswordResetEmail
;
use
App\Mail\PasswordReset
;
use
App\User
;
use
App\VerificationCode
;
use
Illuminate\Support\Facades\Mail
;
use
Tests\TestCase
;
class
PasswordResetEmailTest
extends
TestCase
{
private
$code
;
/**
* {@inheritDoc}
*
* @return void
*/
public
function
setUp
():
void
{
parent
::
setUp
();
$this
->
deleteTestUser
(
'PasswordReset@UserAccount.com'
);
}
/**
* {@inheritDoc}
*
* @return void
*/
public
function
tearDown
():
void
{
$this
->
deleteTestUser
(
'PasswordReset@UserAccount.com'
);
parent
::
tearDown
();
}
/**
* Test job handle
*
* @return void
*/
public
function
testPasswordResetEmailHandle
()
{
$code
=
new
VerificationCode
([
'mode'
=>
'password-reset'
,
]);
$user
=
$this
->
getTestUser
(
'PasswordReset@UserAccount.com'
);
$user
->
verificationcodes
()->
save
(
$code
);
$user
->
setSettings
([
'external_email'
=>
'etx@email.com'
]);
Mail
::
fake
();
// Assert that no jobs were pushed...
Mail
::
assertNothingSent
();
$job
=
new
PasswordResetEmail
(
$code
);
$job
->
handle
();
// Assert the email sending job was pushed once
Mail
::
assertSent
(
PasswordReset
::
class
,
1
);
// Assert the mail was sent to the code's email
Mail
::
assertSent
(
PasswordReset
::
class
,
function
(
$mail
)
use
(
$code
)
{
return
$mail
->
hasTo
(
$code
->
user
->
getSetting
(
'external_email'
));
});
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Fri, Apr 24, 10:47 AM (5 d, 10 h ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
c7/b3/73bc81f38d71dc77bf5ebf32e8fa
Default Alt Text
PasswordResetEmailTest.php (1 KB)
Attached To
Mode
rK kolab
Attached
Detach File
Event Timeline