This repository was archived by the owner on Jan 29, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -224,12 +224,23 @@ public function testAuthenticateWithNoIdentityParam()
224
224
$ user = $ pdoDatabase ->authenticate ('test ' , 'password ' );
225
225
}
226
226
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 )
228
239
{
229
240
$ stmt = $ this ->prophesize (PDOStatement::class);
230
241
$ stmt ->bindParam (Argument::any (), Argument::any ())->willReturn ();
231
242
$ stmt ->execute (Argument::any ())->willReturn ();
232
- $ stmt ->fetchObject ()->willReturn ((object )['password ' => null ]);
243
+ $ stmt ->fetchObject ()->willReturn ((object )['password ' => $ password ]);
233
244
234
245
$ pdo = $ this ->prophesize (PDO ::class);
235
246
$ pdo ->prepare (Argument::any ())->willReturn ($ stmt ->reveal ());
@@ -240,7 +251,7 @@ public function testHandlesNullPassword()
240
251
$ this ->userFactory
241
252
);
242
253
243
- $ user = $ pdoDatabase ->authenticate ('null ' , null );
254
+ $ user = $ pdoDatabase ->authenticate ('null ' , $ password );
244
255
$ this ->assertNull ($ user );
245
256
}
246
257
}
You can’t perform that action at this time.
0 commit comments