Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2513118
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
10 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/src/tests/Unit/Mail/NegativeBalanceBeforeDeleteTest.php b/src/tests/Unit/Mail/NegativeBalanceBeforeDeleteTest.php
index 7f601a20..1e5d11e5 100644
--- a/src/tests/Unit/Mail/NegativeBalanceBeforeDeleteTest.php
+++ b/src/tests/Unit/Mail/NegativeBalanceBeforeDeleteTest.php
@@ -1,125 +1,125 @@
<?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;
/**
* {@inheritDoc}
*/
public function setUp(): void
{
parent::setUp();
\App\TenantSetting::truncate();
}
/**
* {@inheritDoc}
*/
public function tearDown(): void
{
\App\TenantSetting::truncate();
parent::tearDown();
}
/**
* 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');
+ $appName = $user->tenant->title;
$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);
// Test with user that is not the same tenant as in .env
$user = $this->getTestUser('user@sample-tenant.dev-local');
$tenant = $user->tenant;
$wallet = $user->wallets->first();
$wallet->balance = -100;
$wallet->save();
$threshold = WalletCheck::threshold($wallet, WalletCheck::THRESHOLD_DELETE);
$tenant->setSettings([
'app.support_url' => 'https://test.org/support',
'app.public_url' => 'https://test.org',
]);
$mail = $this->fakeMail(new NegativeBalanceBeforeDelete($wallet, $user));
$html = $mail['html'];
$plain = $mail['plain'];
$walletUrl = 'https://test.org/wallet';
$walletLink = sprintf('<a href="%s">%s</a>', $walletUrl, $walletUrl);
$supportUrl = 'https://test.org/support';
$supportLink = sprintf('<a href="%s">%s</a>', $supportUrl, $supportUrl);
$this->assertMailSubject("{$tenant->title} 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 {$tenant->title}") > 0);
$this->assertTrue(strpos($html, $threshold->toDateString()) > 0);
$this->assertTrue(strpos($html, "{$tenant->title} Support") > 0);
$this->assertTrue(strpos($html, "{$tenant->title} 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 {$tenant->title}") > 0);
$this->assertTrue(strpos($plain, $threshold->toDateString()) > 0);
$this->assertTrue(strpos($plain, "{$tenant->title} Support") > 0);
$this->assertTrue(strpos($plain, "{$tenant->title} Team") > 0);
}
}
diff --git a/src/tests/Unit/Mail/NegativeBalanceReminderTest.php b/src/tests/Unit/Mail/NegativeBalanceReminderTest.php
index 53755cbc..f68d58b5 100644
--- a/src/tests/Unit/Mail/NegativeBalanceReminderTest.php
+++ b/src/tests/Unit/Mail/NegativeBalanceReminderTest.php
@@ -1,62 +1,62 @@
<?php
namespace Tests\Unit\Mail;
use App\Jobs\WalletCheck;
use App\Mail\NegativeBalanceReminder;
use App\User;
use App\Wallet;
use Tests\MailInterceptTrait;
use Tests\TestCase;
class NegativeBalanceReminderTest 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_SUSPEND);
\config([
'app.support_url' => 'https://kolab.org/support',
]);
$mail = $this->fakeMail(new NegativeBalanceReminder($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');
+ $appName = $user->tenant->title;
$this->assertMailSubject("$appName Payment Reminder", $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, "you are behind on paying for your $appName account") > 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, "you are behind on paying for your $appName account") > 0);
$this->assertTrue(strpos($plain, $threshold->toDateString()) > 0);
$this->assertTrue(strpos($plain, "$appName Support") > 0);
$this->assertTrue(strpos($plain, "$appName Team") > 0);
}
}
diff --git a/src/tests/Unit/Mail/NegativeBalanceSuspendedTest.php b/src/tests/Unit/Mail/NegativeBalanceSuspendedTest.php
index 7190ffab..fc59ad50 100644
--- a/src/tests/Unit/Mail/NegativeBalanceSuspendedTest.php
+++ b/src/tests/Unit/Mail/NegativeBalanceSuspendedTest.php
@@ -1,62 +1,62 @@
<?php
namespace Tests\Unit\Mail;
use App\Jobs\WalletCheck;
use App\Mail\NegativeBalanceSuspended;
use App\User;
use App\Wallet;
use Tests\MailInterceptTrait;
use Tests\TestCase;
class NegativeBalanceSuspendedTest 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 NegativeBalanceSuspended($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');
+ $appName = $user->tenant->title;
$this->assertMailSubject("$appName Account Suspended", $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, "Your $appName account has been suspended") > 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, "Your $appName account has been suspended") > 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-diff
Expires
Sat, Apr 18, 10:05 AM (50 m, 13 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
436128
Default Alt Text
(10 KB)
Attached To
Mode
R2 kolab
Attached
Detach File
Event Timeline
Log In to Comment