Skip to content
This repository was archived by the owner on Jan 29, 2020. It is now read-only.

Commit 3e87a56

Browse files
committed
add test for invalid username
1 parent 81e0c46 commit 3e87a56

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

test/UserRepository/PdoDatabaseTest.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,21 @@ public function testAuthenticateInvalidUser()
5151
$this->assertNull($user);
5252
}
5353

54+
public function testAuthenticateInvalidUsername()
55+
{
56+
$pdo = new PDO('sqlite:'. __DIR__ . '/../TestAssets/pdo.sqlite');
57+
$pdoDatabase = new PdoDatabase($pdo, [
58+
'table' => 'user',
59+
'field' => [
60+
'username' => 'username',
61+
'password' => 'password'
62+
]
63+
]);
64+
65+
$user = $pdoDatabase->authenticate('invaliduser', 'foo');
66+
$this->assertNull($user);
67+
}
68+
5469
public function testAuthenticateWithRole()
5570
{
5671
$pdo = new PDO('sqlite:'. __DIR__ . '/../TestAssets/pdo_role.sqlite');

0 commit comments

Comments
 (0)