Changeset View
Changeset View
Standalone View
Standalone View
src/tests/Unit/Mail/PaymentSuccessTest.php
- This file was added.
<?php | |||||
namespace Tests\Unit\Mail; | |||||
use App\Mail\PaymentSuccess; | |||||
use App\Payment; | |||||
use App\User; | |||||
use Tests\TestCase; | |||||
class PaymentSuccessTest extends TestCase | |||||
{ | |||||
/** | |||||
* Test email content | |||||
* | |||||
* @return void | |||||
*/ | |||||
public function testBuild() | |||||
{ | |||||
// @phpstan-ignore-next-line | |||||
$user = new User(); | |||||
$payment = new Payment(); | |||||
$payment->amount = 123; | |||||
\config(['app.support_url' => 'https://kolab.org/support']); | |||||
$mail = new PaymentSuccess($payment, $user); | |||||
$html = $mail->build()->render(); | |||||
$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->assertSame("$appName Payment Succeeded", $mail->subject); | |||||
$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, "$appName Support") > 0); | |||||
$this->assertTrue(strpos($html, "The auto-payment for your $appName account") > 0); | |||||
$this->assertTrue(strpos($html, "$appName Team") > 0); | |||||
vanmeeuwen: This should be 'The auto-payment'.
Why not, here too, use:
```
$this->assertTrue(strpos($html… | |||||
Done Inline ActionsWe could use trans() here. However, what if the localization is broken? Also, some labels might contain characters that are converted to html entities (or nl2br) which would make a difference. So, I'd keep it this way. machniak: We could use trans() here. However, what if the localization is broken? Also, some labels might… | |||||
} | |||||
} |
This should be 'The auto-payment'.
Why not, here too, use:
?