@@ -27,8 +27,9 @@ public function testHashWithLegacyUser()
2727 {
2828 $ user = new TestLegacyPasswordAuthenticatedUser ('name ' , null , 'userSalt ' );
2929
30- $ passwordHasher = $ this ->createStub (PasswordHasherInterface::class);
30+ $ passwordHasher = $ this ->createMock (PasswordHasherInterface::class);
3131 $ passwordHasher
32+ ->expects ($ this ->once ())
3233 ->method ('hash ' )
3334 ->with ($ this ->equalTo ('plainPassword ' ), $ this ->equalTo ('userSalt ' ))
3435 ->willReturn ('hash ' );
@@ -47,8 +48,9 @@ public function testHashWithPasswordAuthenticatedUser()
4748 {
4849 $ user = new TestPasswordAuthenticatedUser ();
4950
50- $ passwordHasher = $ this ->createStub (PasswordHasherInterface::class);
51+ $ passwordHasher = $ this ->createMock (PasswordHasherInterface::class);
5152 $ passwordHasher
53+ ->expects ($ this ->once ())
5254 ->method ('hash ' )
5355 ->with ($ this ->equalTo ('plainPassword ' ), $ this ->equalTo (null ))
5456 ->willReturn ('hash ' );
@@ -68,8 +70,9 @@ public function testVerifyWithLegacyUser()
6870 {
6971 $ user = new TestLegacyPasswordAuthenticatedUser ('user ' , 'hash ' , 'userSalt ' );
7072
71- $ passwordHasher = $ this ->createStub (PasswordHasherInterface::class);
73+ $ passwordHasher = $ this ->createMock (PasswordHasherInterface::class);
7274 $ passwordHasher
75+ ->expects ($ this ->once ())
7376 ->method ('verify ' )
7477 ->with ($ this ->equalTo ('hash ' ), $ this ->equalTo ('plainPassword ' ), $ this ->equalTo ('userSalt ' ))
7578 ->willReturn (true );
@@ -88,8 +91,9 @@ public function testVerify()
8891 {
8992 $ user = new TestPasswordAuthenticatedUser ('hash ' );
9093
91- $ passwordHasher = $ this ->createStub (PasswordHasherInterface::class);
94+ $ passwordHasher = $ this ->createMock (PasswordHasherInterface::class);
9295 $ passwordHasher
96+ ->expects ($ this ->once ())
9397 ->method ('verify ' )
9498 ->with ($ this ->equalTo ('hash ' ), $ this ->equalTo ('plainPassword ' ), $ this ->equalTo (null ))
9599 ->willReturn (true );
@@ -109,8 +113,9 @@ public function testNeedsRehash()
109113 $ user = new InMemoryUser ('username ' , null );
110114 $ hasher = new NativePasswordHasher (4 , 20000 , 4 );
111115
112- $ passwordHasherFactory = $ this ->createStub (PasswordHasherFactoryInterface::class);
116+ $ passwordHasherFactory = $ this ->createMock (PasswordHasherFactoryInterface::class);
113117 $ passwordHasherFactory
118+ ->expects ($ this ->exactly (4 ))
114119 ->method ('getPasswordHasher ' )
115120 ->with ($ user )
116121 ->willReturn ($ hasher , $ hasher , new NativePasswordHasher (5 , 20000 , 5 ), $ hasher );
0 commit comments