Skip to content

Commit ff98a0b

Browse files
Merge branch '7.4' into 8.0
* 7.4: [Console] Fix ProgressBar %remaining% and %estimated% placeholder guards [Validator] Fix missing null type in ValidatorInterface::validate() phpdoc use PHPUnit 13 on PHP 8.4+ [PropertyInfo] Prioritize property type over is/has/can accessors
2 parents ca6af4e + 376755e commit ff98a0b

2 files changed

Lines changed: 12 additions & 6 deletions

File tree

Tests/Hasher/MigratingPasswordHasherTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,9 @@ public function testFallback()
4242
{
4343
$bestHasher = new NativePasswordHasher(4, 12000, 4);
4444

45-
$extraHasher1 = $this->createStub(PasswordHasherInterface::class);
45+
$extraHasher1 = $this->createMock(PasswordHasherInterface::class);
4646
$extraHasher1
47+
->expects($this->atLeastOnce())
4748
->method('verify')
4849
->with('abc', 'foo', 'salt')
4950
->willReturn(true);

Tests/Hasher/UserPasswordHasherTest.php

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)