Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2397677
NegativeBalanceBeforeDeleteTest.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
NegativeBalanceBeforeDeleteTest.php
View Options
<?php
namespace
Tests\Unit\Mail
;
use
App\Jobs\WalletCheck
;
use
App\Mail\NegativeBalanceBeforeDelete
;
use
App\User
;
use
App\Wallet
;
use
Tests\MailInterceptTrait
;
use
Tests\TestCase
;
class
NegativeBalanceBeforeDeleteTest
extends
TestCase
{
use
MailInterceptTrait
;
/**
* Test email content
*/
public
function
testBuild
():
void
{
$user
=
$this
->
getTestUser
(
'ned@kolab.org'
);
$wallet
=
$user
->
wallets
->
first
();
$wallet
->
balance
=
-
100
;
$wallet
->
save
();
$threshold
=
WalletCheck
::
threshold
(
$wallet
,
WalletCheck
::
THRESHOLD_DELETE
);
\config
([
'app.support_url'
=>
'https://kolab.org/support'
,
]);
$mail
=
$this
->
fakeMail
(
new
NegativeBalanceBeforeDelete
(
$wallet
,
$user
));
$html
=
$mail
[
'html'
];
$plain
=
$mail
[
'plain'
];
$walletUrl
=
\App\Utils
::
serviceUrl
(
'/wallet'
);
$walletLink
=
sprintf
(
'<a href="%s">%s</a>'
,
$walletUrl
,
$walletUrl
);
$supportUrl
=
\config
(
'app.support_url'
);
$supportLink
=
sprintf
(
'<a href="%s">%s</a>'
,
$supportUrl
,
$supportUrl
);
$appName
=
\config
(
'app.name'
);
$this
->
assertMailSubject
(
"$appName Final Warning"
,
$mail
[
'message'
]);
$this
->
assertStringStartsWith
(
'<!DOCTYPE html>'
,
$html
);
$this
->
assertTrue
(
strpos
(
$html
,
$user
->
name
(
true
))
>
0
);
$this
->
assertTrue
(
strpos
(
$html
,
$walletLink
)
>
0
);
$this
->
assertTrue
(
strpos
(
$html
,
$supportLink
)
>
0
);
$this
->
assertTrue
(
strpos
(
$html
,
"This is a final reminder to settle your $appName"
)
>
0
);
$this
->
assertTrue
(
strpos
(
$html
,
$threshold
->
toDateString
())
>
0
);
$this
->
assertTrue
(
strpos
(
$html
,
"$appName Support"
)
>
0
);
$this
->
assertTrue
(
strpos
(
$html
,
"$appName Team"
)
>
0
);
$this
->
assertStringStartsWith
(
'Dear '
.
$user
->
name
(
true
),
$plain
);
$this
->
assertTrue
(
strpos
(
$plain
,
$walletUrl
)
>
0
);
$this
->
assertTrue
(
strpos
(
$plain
,
$supportUrl
)
>
0
);
$this
->
assertTrue
(
strpos
(
$plain
,
"This is a final reminder to settle your $appName"
)
>
0
);
$this
->
assertTrue
(
strpos
(
$plain
,
$threshold
->
toDateString
())
>
0
);
$this
->
assertTrue
(
strpos
(
$plain
,
"$appName Support"
)
>
0
);
$this
->
assertTrue
(
strpos
(
$plain
,
"$appName Team"
)
>
0
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Mon, Nov 3, 2:47 PM (1 d, 8 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
361074
Default Alt Text
NegativeBalanceBeforeDeleteTest.php (2 KB)
Attached To
Mode
R2 kolab
Attached
Detach File
Event Timeline
Log In to Comment