Skip to content

Commit

Permalink
Test VerifyRegistration mail
Browse files Browse the repository at this point in the history
  • Loading branch information
range-of-motion committed Dec 29, 2023
1 parent 9919db7 commit 5981920
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 8 deletions.
2 changes: 1 addition & 1 deletion app/Mail/ResetPassword.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class ResetPassword extends Mailable
use SerializesModels;

public function __construct(
protected $token
protected $token,
) {
//
}
Expand Down
9 changes: 4 additions & 5 deletions app/Mail/VerifyRegistration.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,10 @@ class VerifyRegistration extends Mailable
use Queueable;
use SerializesModels;

protected $user;

public function __construct(User $user)
{
$this->user = $user;
public function __construct(
protected User $user,
) {
//
}

public function build()
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/Mail/ResetPasswordTest.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace App\Unit\Mail;
namespace Tests\Unit\Mail;

use App\Mail\ResetPassword;
use Tests\TestCase;
Expand Down
27 changes: 27 additions & 0 deletions tests/Unit/Mail/VerifyRegistrationTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

namespace Tests\Unit\Mail;

use App\Mail\VerifyRegistration;
use App\Models\User;
use Tests\TestCase;

class VerifyRegistrationTest extends TestCase
{
public function testMailable(): void
{
$user = User::factory()
->create([
'name' => 'John Doe',
'verification_token' => 'abc123',
]);

$mailable = new VerifyRegistration($user);

$mailable
->assertSeeInText('Welcome aboard, John Doe')
->assertSeeInText('We\'re going to help you get insight into your personal finances.')
->assertSeeInText('No more dealing with pesky, half-assed spreadsheets.')
->assertSeeInHtml('<a href="' . config('app.url') . '/verify/abc123">Verify</a>', false);
}
}
2 changes: 1 addition & 1 deletion tests/Unit/Mail/WeeklyReportTest.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace App\Unit\Mail;
namespace Tests\Unit\Mail;

use App\Mail\WeeklyReport;
use App\Models\Space;
Expand Down

0 comments on commit 5981920

Please sign in to comment.