Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F120838933
DegradedAccountReminderTest.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
DegradedAccountReminderTest.php
View Options
<?php
namespace
Tests\Unit\Mail
;
use
App\Mail\DegradedAccountReminder
;
use
App\Utils
;
use
Tests\TestCase
;
class
DegradedAccountReminderTest
extends
TestCase
{
/**
* Test email content
*/
public
function
testBuild
():
void
{
$user
=
$this
->
getTestUser
(
'ned@kolab.org'
);
$john
=
$this
->
getTestUser
(
'john@kolab.org'
);
$wallet
=
$john
->
wallets
->
first
();
$mail
=
$this
->
renderMail
(
new
DegradedAccountReminder
(
$wallet
,
$user
));
$html
=
$mail
[
'html'
];
$plain
=
$mail
[
'plain'
];
$dashboardUrl
=
Utils
::
serviceUrl
(
'/dashboard'
);
$dashboardLink
=
sprintf
(
'<a href="%s">%s</a>'
,
$dashboardUrl
,
$dashboardUrl
);
$appName
=
$user
->
tenant
->
title
;
$this
->
assertSame
(
"{$appName} Reminder: Your account is free"
,
$mail
[
'subject'
]);
$this
->
assertStringStartsWith
(
'<!DOCTYPE html>'
,
$html
);
$this
->
assertTrue
(
strpos
(
$html
,
$user
->
name
(
true
))
>
0
);
$this
->
assertTrue
(
strpos
(
$html
,
$dashboardLink
)
>
0
);
$this
->
assertTrue
(
strpos
(
$html
,
"your {$john->email} account is a free account"
)
>
0
);
$this
->
assertTrue
(
strpos
(
$html
,
"{$appName} Team"
)
>
0
);
$this
->
assertStringStartsWith
(
'Dear '
.
$user
->
name
(
true
),
$plain
);
$this
->
assertTrue
(
strpos
(
$plain
,
$dashboardUrl
)
>
0
);
$this
->
assertTrue
(
strpos
(
$plain
,
"your {$john->email} account is a free account"
)
>
0
);
$this
->
assertTrue
(
strpos
(
$plain
,
"{$appName} Team"
)
>
0
);
}
/**
* Test getSubject() and getUser()
*/
public
function
testGetSubjectAndUser
():
void
{
$user
=
$this
->
getTestUser
(
'ned@kolab.org'
);
$wallet
=
$user
->
wallets
->
first
();
$appName
=
$user
->
tenant
->
title
;
$mail
=
new
DegradedAccountReminder
(
$wallet
,
$user
);
$this
->
assertSame
(
"{$appName} Reminder: Your account is free"
,
$mail
->
getSubject
());
$this
->
assertSame
(
$user
,
$mail
->
getUser
());
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Fri, Apr 24, 2:06 PM (1 w, 17 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
18857864
Default Alt Text
DegradedAccountReminderTest.php (1 KB)
Attached To
Mode
rK kolab
Attached
Detach File
Event Timeline