Skip to content

Commit

Permalink
chore: Enhance email tests to validate presence of username.
Browse files Browse the repository at this point in the history
  • Loading branch information
pmagictech committed Jun 13, 2024
1 parent 7aff384 commit 5f9b4e2
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Views/Email/email_2fa_email.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@
<p><?= lang('Auth.emailDate') ?> <?= esc($date) ?></p>
</body>

</html>
</html>
2 changes: 1 addition & 1 deletion src/Views/Email/magic_link_email.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@
<p><?= lang('Auth.emailDate') ?> <?= esc($date) ?></p>
</body>

</html>
</html>
6 changes: 6 additions & 0 deletions tests/Controllers/ActionsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,9 @@ public function testEmail2FAHandleSendsEmail(): void

// Should have sent an email with the code....
$this->assertStringContainsString('Your authentication code is:', service('email')->archive['body']);

// Should have included the username in the email
$this->assertStringContainsString($this->user->username, service('email')->archive['body']);
}

public function testEmail2FAVerifyFails(): void
Expand Down Expand Up @@ -248,6 +251,9 @@ public function testEmailActivateShow(): void
'!<h1>[0-9]{6}</h1>!',
service('email')->archive['body']
);

// Should have included the username in the email
$this->assertStringContainsString($this->user->username, service('email')->archive['body']);
}

public function testEmailActivateVerify(): void

Check warning on line 259 in tests/Controllers/ActionsTest.php

View workflow job for this annotation

GitHub Actions / phpunit / PHP 8.3 - SQLite3

Took 0.61s from 0.50s limit to run Tests\\Controllers\\ActionsTest::testEmailActivateVerify
Expand Down

0 comments on commit 5f9b4e2

Please sign in to comment.