Skip to content

Commit

Permalink
MNT Test failed login is logged correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
GuySartorelli committed Dec 20, 2023
1 parent 44ee87d commit d5f2f0b
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions tests/AuditHookTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -333,4 +333,31 @@ public function testRestoreToStage()
$this->assertStringContainsString('deleted Page', $message);
$this->assertStringContainsString('My page', $message);
}

public function testFailedLogin()
{
$member = $this->createMemberWithPermission('ADMIN');
$this->get('Security/login');
$this->submitForm(
'MemberLoginForm_LoginForm',
null,
['Email' => $member->Email, 'Password' => 'clearly wrong password']
);

$message = $this->writer->getLastMessage();
$this->assertStringContainsString('Failed login attempt using email "' . $member->Email . '"', $message);
}

public function testFailedLoginWithoutMember()
{
$this->get('Security/login');
$this->submitForm(
'MemberLoginForm_LoginForm',
null,
['Email' => '__NO VALID USER__', 'Password' => 'clearly wrong password']
);

$message = $this->writer->getLastMessage();
$this->assertStringContainsString('Failed login attempt using email "__NO VALID USER__"', $message);
}
}

0 comments on commit d5f2f0b

Please sign in to comment.