Skip to content

Commit 6ab8f21

Browse files
[Tests] Replace setMethods() by onlyMethods() and addMethods()
1 parent 7c71908 commit 6ab8f21

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
@@ -42,7 +42,7 @@ protected function setUp(): void
4242
$this->session = $this->createMock(SessionInterface::class);
4343
$this->request = $this->createMock(Request::class);
4444
$this->request->expects($this->any())->method('getSession')->willReturn($this->session);
45-
$this->exception = $this->getMockBuilder(AuthenticationException::class)->setMethods(['getMessage'])->getMock();
45+
$this->exception = $this->getMockBuilder(AuthenticationException::class)->onlyMethods(['getMessage'])->getMock();
4646
}
4747

4848
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
@@ -366,7 +366,7 @@ public function testWithPreviousNotStartedSession()
366366

367367
public function testSessionIsNotReported()
368368
{
369-
$usageReporter = $this->getMockBuilder(\stdClass::class)->setMethods(['__invoke'])->getMock();
369+
$usageReporter = $this->getMockBuilder(\stdClass::class)->addMethods(['__invoke'])->getMock();
370370
$usageReporter->expects($this->never())->method('__invoke');
371371

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

0 commit comments

Comments
 (0)