Skip to content

Commit 5f9b4e2

Browse files
committed
chore: Enhance email tests to validate presence of username.
1 parent 7aff384 commit 5f9b4e2

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

src/Views/Email/email_2fa_email.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,4 @@
2929
<p><?= lang('Auth.emailDate') ?> <?= esc($date) ?></p>
3030
</body>
3131

32-
</html>
32+
</html>

src/Views/Email/magic_link_email.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,4 @@
3434
<p><?= lang('Auth.emailDate') ?> <?= esc($date) ?></p>
3535
</body>
3636

37-
</html>
37+
</html>

tests/Controllers/ActionsTest.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,9 @@ public function testEmail2FAHandleSendsEmail(): void
134134

135135
// Should have sent an email with the code....
136136
$this->assertStringContainsString('Your authentication code is:', service('email')->archive['body']);
137+
138+
// Should have included the username in the email
139+
$this->assertStringContainsString($this->user->username, service('email')->archive['body']);
137140
}
138141

139142
public function testEmail2FAVerifyFails(): void
@@ -248,6 +251,9 @@ public function testEmailActivateShow(): void
248251
'!<h1>[0-9]{6}</h1>!',
249252
service('email')->archive['body']
250253
);
254+
255+
// Should have included the username in the email
256+
$this->assertStringContainsString($this->user->username, service('email')->archive['body']);
251257
}
252258

253259
public function testEmailActivateVerify(): void

0 commit comments

Comments
 (0)