Skip to content

Commit 210fc3f

Browse files
Merge branch '5.4' into 6.2
* 5.4: [Tests] Replace `setMethods()` by `onlyMethods()` and `addMethods()`
2 parents 58de93d + 6ab8f21 commit 210fc3f

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

Tests/Authentication/DefaultAuthenticationFailureHandlerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ protected function setUp(): void
4747
$this->session = $this->createMock(SessionInterface::class);
4848
$this->request = $this->createMock(Request::class);
4949
$this->request->expects($this->any())->method('getSession')->willReturn($this->session);
50-
$this->exception = $this->getMockBuilder(AuthenticationException::class)->setMethods(['getMessage'])->getMock();
50+
$this->exception = $this->getMockBuilder(AuthenticationException::class)->onlyMethods(['getMessage'])->getMock();
5151
}
5252

5353
public function testForward()

Tests/EventListener/CheckCredentialsListenerTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ public function testAddsNoPasswordUpgradeBadgeIfItAlreadyExists()
136136
$this->hasherFactory->expects($this->any())->method('getPasswordHasher')->with($this->identicalTo($this->user))->willReturn($hasher);
137137

138138
$passport = $this->getMockBuilder(Passport::class)
139-
->setMethods(['addBadge'])
139+
->onlyMethods(['addBadge'])
140140
->setConstructorArgs([new UserBadge('wouter', function () { return $this->user; }), new PasswordCredentials('ThePa$$word'), [new PasswordUpgradeBadge('ThePa$$word')]])
141141
->getMock();
142142

@@ -153,7 +153,7 @@ public function testAddsNoPasswordUpgradeBadgeIfPasswordIsInvalid()
153153
$this->hasherFactory->expects($this->any())->method('getPasswordHasher')->with($this->identicalTo($this->user))->willReturn($hasher);
154154

155155
$passport = $this->getMockBuilder(Passport::class)
156-
->setMethods(['addBadge'])
156+
->onlyMethods(['addBadge'])
157157
->setConstructorArgs([new UserBadge('wouter', function () { return $this->user; }), new PasswordCredentials('ThePa$$word'), [new PasswordUpgradeBadge('ThePa$$word')]])
158158
->getMock();
159159

Tests/Firewall/ContextListenerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ public function testWithPreviousNotStartedSession()
307307

308308
public function testSessionIsNotReported()
309309
{
310-
$usageReporter = $this->getMockBuilder(\stdClass::class)->setMethods(['__invoke'])->getMock();
310+
$usageReporter = $this->getMockBuilder(\stdClass::class)->addMethods(['__invoke'])->getMock();
311311
$usageReporter->expects($this->never())->method('__invoke');
312312

313313
$session = new Session(new MockArraySessionStorage(), null, null, $usageReporter);

0 commit comments

Comments
 (0)