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

Commit 7d47fef

Browse files
committed
Added test PDO for empty password
1 parent 193bbf8 commit 7d47fef

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

test/UserRepository/PdoDatabaseTest.php

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -224,12 +224,23 @@ public function testAuthenticateWithNoIdentityParam()
224224
$user = $pdoDatabase->authenticate('test', 'password');
225225
}
226226

227-
public function testHandlesNullPassword()
227+
public function getVoidPasswords()
228+
{
229+
return [
230+
[ null ],
231+
[ '' ]
232+
];
233+
}
234+
235+
/**
236+
* @dataProvider getVoidPasswords
237+
*/
238+
public function testHandlesNullOrEmptyPassword($password)
228239
{
229240
$stmt = $this->prophesize(PDOStatement::class);
230241
$stmt->bindParam(Argument::any(), Argument::any())->willReturn();
231242
$stmt->execute(Argument::any())->willReturn();
232-
$stmt->fetchObject()->willReturn((object)['password' => null]);
243+
$stmt->fetchObject()->willReturn((object)['password' => $password]);
233244

234245
$pdo = $this->prophesize(PDO::class);
235246
$pdo->prepare(Argument::any())->willReturn($stmt->reveal());
@@ -240,7 +251,7 @@ public function testHandlesNullPassword()
240251
$this->userFactory
241252
);
242253

243-
$user = $pdoDatabase->authenticate('null', null);
254+
$user = $pdoDatabase->authenticate('null', $password);
244255
$this->assertNull($user);
245256
}
246257
}

0 commit comments

Comments
 (0)