Skip to content

Commit c58aece

Browse files
Merge branch '5.1' into 5.2
* 5.1: More cleanups and fixes
2 parents 1d764e0 + c3a869c commit c58aece

File tree

6 files changed

+11
-10
lines changed

6 files changed

+11
-10
lines changed

Tests/Authenticator/FormLoginAuthenticatorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ public function testHandleNonStringUsernameWithObject($postOnly)
118118
*/
119119
public function testHandleNonStringUsernameWithToString($postOnly)
120120
{
121-
$usernameObject = $this->getMockBuilder(DummyUserClass::class)->getMock();
121+
$usernameObject = $this->createMock(DummyUserClass::class);
122122
$usernameObject->expects($this->once())->method('__toString')->willReturn('someUsername');
123123

124124
$request = Request::create('/login_check', 'POST', ['_username' => $usernameObject, '_password' => 's$cr$t']);

Tests/Authenticator/HttpBasicAuthenticatorTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ class HttpBasicAuthenticatorTest extends TestCase
2222

2323
protected function setUp(): void
2424
{
25-
$this->userProvider = $this->getMockBuilder(UserProviderInterface::class)->getMock();
26-
$this->encoderFactory = $this->getMockBuilder(EncoderFactoryInterface::class)->getMock();
27-
$this->encoder = $this->getMockBuilder(PasswordEncoderInterface::class)->getMock();
25+
$this->userProvider = $this->createMock(UserProviderInterface::class);
26+
$this->encoderFactory = $this->createMock(EncoderFactoryInterface::class);
27+
$this->encoder = $this->createMock(PasswordEncoderInterface::class);
2828
$this->encoderFactory
2929
->expects($this->any())
3030
->method('getEncoder')

Tests/EventListener/RememberMeListenerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ protected function setUp(): void
3939
{
4040
$this->rememberMeServices = $this->createMock(RememberMeServicesInterface::class);
4141
$this->listener = new RememberMeListener($this->rememberMeServices);
42-
$this->request = $this->getMockBuilder(Request::class)->disableOriginalConstructor()->getMock();
42+
$this->request = $this->createMock(Request::class);
4343
$this->response = $this->createMock(Response::class);
4444
$this->token = $this->createMock(TokenInterface::class);
4545
}

Tests/EventListener/SessionStrategyListenerTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
use PHPUnit\Framework\TestCase;
1515
use Symfony\Component\HttpFoundation\Request;
16+
use Symfony\Component\HttpFoundation\Session\SessionInterface;
1617
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
1718
use Symfony\Component\Security\Core\User\User;
1819
use Symfony\Component\Security\Http\Authenticator\AuthenticatorInterface;
@@ -68,7 +69,7 @@ private function createEvent($firewallName)
6869

6970
private function configurePreviousSession()
7071
{
71-
$session = $this->getMockBuilder(\Symfony\Component\HttpFoundation\Session\SessionInterface::class)->getMock();
72+
$session = $this->createMock(SessionInterface::class);
7273
$session->expects($this->any())
7374
->method('getName')
7475
->willReturn('test_session_name');

Tests/Firewall/AccessListenerTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ public function testHandleWhenTheSecurityTokenStorageHasNoTokenAndExceptionOnTok
259259
$tokenStorage,
260260
$accessDecisionManager,
261261
$accessMap,
262-
$this->getMockBuilder(AuthenticationManagerInterface::class)->getMock(),
262+
$this->createMock(AuthenticationManagerInterface::class),
263263
false
264264
);
265265

@@ -288,7 +288,7 @@ public function testHandleWhenPublicAccessIsAllowedAndExceptionOnTokenIsFalse()
288288
$tokenStorage,
289289
$accessDecisionManager,
290290
$accessMap,
291-
$this->getMockBuilder(AuthenticationManagerInterface::class)->getMock(),
291+
$this->createMock(AuthenticationManagerInterface::class),
292292
false
293293
);
294294

@@ -319,7 +319,7 @@ public function testHandleWhenPublicAccessWhileAuthenticated()
319319
$tokenStorage,
320320
$accessDecisionManager,
321321
$accessMap,
322-
$this->getMockBuilder(AuthenticationManagerInterface::class)->getMock(),
322+
$this->createMock(AuthenticationManagerInterface::class),
323323
false
324324
);
325325

Tests/Firewall/ContextListenerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ public function testSessionIsNotReported()
369369
$tokenStorage = new TokenStorage();
370370

371371
$listener = new ContextListener($tokenStorage, [], 'context_key', null, null, null, [$tokenStorage, 'getToken']);
372-
$listener(new RequestEvent($this->getMockBuilder(HttpKernelInterface::class)->getMock(), $request, HttpKernelInterface::MASTER_REQUEST));
372+
$listener(new RequestEvent($this->createMock(HttpKernelInterface::class), $request, HttpKernelInterface::MASTER_REQUEST));
373373
}
374374

375375
protected function runSessionOnKernelResponse($newToken, $original = null)

0 commit comments

Comments
 (0)