-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FIX Email correct content via translation key correction
Upon registering a user is being sent an email to notify them that they have successfully added a multiple factor of authentication to their account on the site. However due to a mix up with translation keys, the default text was being replaced with that for removing an authentication factor. This commit fixes the translation key, and extends the tests to cover the body as well as the subject.
- Loading branch information
Dylan Wagstaff
committed
Jul 24, 2019
1 parent
f2b1bda
commit 254864f
Showing
4 changed files
with
14 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,7 @@ | |
use SilverStripe\MFA\Tests\Stub\BasicMath\Method as BasicMathMethod; | ||
use SilverStripe\ORM\DataObject; | ||
use SilverStripe\Security\Member; | ||
use SilverStripe\View\SSViewer; | ||
|
||
class RegisteredMethodManagerTest extends SapphireTest | ||
{ | ||
|
@@ -92,6 +93,7 @@ public function testRegisterForMemberAssignsDefaultRegisteredMethod() | |
|
||
public function testRegisterForMemberSendsNotification() | ||
{ | ||
SSViewer::set_themes(['$public', '$default']); | ||
/** @var Member&MemberExtension $member */ | ||
$member = Member::create(['FirstName' => 'Mike', 'Email' => '[email protected]']); | ||
$member->write(); | ||
|
@@ -100,7 +102,12 @@ public function testRegisterForMemberSendsNotification() | |
$manager = RegisteredMethodManager::singleton(); | ||
RegisteredMethodManager::singleton()->registerForMember($member, $method, ['foo', 'bar']); | ||
|
||
$this->assertEmailSent($member->Email, null, '/method was added to your account/'); | ||
$this->assertEmailSent( | ||
$member->Email, | ||
null, | ||
'/method was added to your account/', | ||
'/You have successfully registered/' | ||
); | ||
} | ||
|
||
public function testRegisterBackupMethodDoesNotSendEmail() | ||
|
@@ -146,13 +153,14 @@ public function testDeleteFromMember() | |
|
||
public function testDeleteFromMemberSendsNotification() | ||
{ | ||
SSViewer::set_themes(['$public', '$default']); | ||
/** @var Member&MemberExtension $member */ | ||
$member = $this->objFromFixture(Member::class, 'bob_jones'); | ||
|
||
$manager = RegisteredMethodManager::singleton(); | ||
$manager->deleteFromMember($member, new BasicMathMethod()); | ||
|
||
$this->assertEmailSent($member->Email, null, '/method was removed from your account/'); | ||
$this->assertEmailSent($member->Email, null, '/method was removed from your account/', '/You have removed/'); | ||
} | ||
|
||
public function testDeletingLastMethodRemovesBackupCodes() | ||
|