Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2484987
SignupInvitationEmailTest.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
SignupInvitationEmailTest.php
View Options
<?php
namespace
Tests\Feature\Jobs
;
use
App\Jobs\SignupInvitationEmail
;
use
App\Mail\SignupInvitation
;
use
App\SignupInvitation
as
SI
;
use
Illuminate\Queue\Events\JobFailed
;
use
Illuminate\Support\Facades\Mail
;
use
Illuminate\Support\Facades\Queue
;
use
Tests\TestCase
;
class
SignupInvitationEmailTest
extends
TestCase
{
private
$invitation
;
/**
* {@inheritDoc}
*/
public
function
setUp
():
void
{
parent
::
setUp
();
Queue
::
fake
();
$this
->
invitation
=
SI
::
create
([
'email'
=>
'SignupInvitationEmailTest@external.com'
]);
}
/**
* {@inheritDoc}
*/
public
function
tearDown
():
void
{
$this
->
invitation
->
delete
();
}
/**
* Test job handle
*/
public
function
testSignupInvitationEmailHandle
():
void
{
Mail
::
fake
();
// Assert that no jobs were pushed...
Mail
::
assertNothingSent
();
$job
=
new
SignupInvitationEmail
(
$this
->
invitation
);
$job
->
handle
();
// Assert the email sending job was pushed once
Mail
::
assertSent
(
SignupInvitation
::
class
,
1
);
// Assert the mail was sent to the code's email
Mail
::
assertSent
(
SignupInvitation
::
class
,
function
(
$mail
)
{
return
$mail
->
hasTo
(
$this
->
invitation
->
email
);
});
$this
->
assertTrue
(
$this
->
invitation
->
isSent
());
}
/**
* Test job failure handling
*/
public
function
testSignupInvitationEmailFailure
():
void
{
$this
->
markTestIncomplete
();
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Thu, Nov 20, 5:06 PM (19 h, 43 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
387230
Default Alt Text
SignupInvitationEmailTest.php (1 KB)
Attached To
Mode
R2 kolab
Attached
Detach File
Event Timeline
Log In to Comment