Skip to content

Commit 23a875c

Browse files
committed
[SecurityHttp] Don't call createMock() with multiple interfaces.
1 parent c448773 commit 23a875c

File tree

3 files changed

+23
-4
lines changed

3 files changed

+23
-4
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <[email protected]>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Component\Security\Http\Tests\Authenticator\Fixtures;
13+
14+
use Symfony\Component\Security\Core\User\PasswordUpgraderInterface;
15+
use Symfony\Component\Security\Core\User\UserProviderInterface;
16+
17+
abstract class PasswordUpgraderProvider implements UserProviderInterface, PasswordUpgraderInterface
18+
{
19+
}

Tests/Authenticator/FormLoginAuthenticatorTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
1717
use Symfony\Component\Security\Core\Exception\BadCredentialsException;
1818
use Symfony\Component\Security\Core\Security;
19-
use Symfony\Component\Security\Core\User\PasswordUpgraderInterface;
2019
use Symfony\Component\Security\Core\User\User;
2120
use Symfony\Component\Security\Core\User\UserProviderInterface;
2221
use Symfony\Component\Security\Http\Authentication\AuthenticationFailureHandlerInterface;
@@ -25,6 +24,7 @@
2524
use Symfony\Component\Security\Http\Authenticator\Passport\Badge\CsrfTokenBadge;
2625
use Symfony\Component\Security\Http\Authenticator\Passport\Badge\PasswordUpgradeBadge;
2726
use Symfony\Component\Security\Http\HttpUtils;
27+
use Symfony\Component\Security\Http\Tests\Authenticator\Fixtures\PasswordUpgraderProvider;
2828

2929
class FormLoginAuthenticatorTest extends TestCase
3030
{
@@ -148,7 +148,7 @@ public function testUpgradePassword()
148148
$request = Request::create('/login_check', 'POST', ['_username' => 'wouter', '_password' => 's$cr$t']);
149149
$request->setSession($this->createSession());
150150

151-
$this->userProvider = $this->createMock([UserProviderInterface::class, PasswordUpgraderInterface::class]);
151+
$this->userProvider = $this->createMock(PasswordUpgraderProvider::class);
152152
$this->userProvider->expects($this->any())->method('loadUserByUsername')->willReturn(new User('test', 's$cr$t'));
153153

154154
$this->setUpAuthenticator();

Tests/Authenticator/HttpBasicAuthenticatorTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66
use Symfony\Component\HttpFoundation\Request;
77
use Symfony\Component\Security\Core\Encoder\EncoderFactoryInterface;
88
use Symfony\Component\Security\Core\Encoder\PasswordEncoderInterface;
9-
use Symfony\Component\Security\Core\User\PasswordUpgraderInterface;
109
use Symfony\Component\Security\Core\User\User;
1110
use Symfony\Component\Security\Core\User\UserProviderInterface;
1211
use Symfony\Component\Security\Http\Authenticator\HttpBasicAuthenticator;
1312
use Symfony\Component\Security\Http\Authenticator\Passport\Badge\PasswordUpgradeBadge;
1413
use Symfony\Component\Security\Http\Authenticator\Passport\Credentials\PasswordCredentials;
14+
use Symfony\Component\Security\Http\Tests\Authenticator\Fixtures\PasswordUpgraderProvider;
1515

1616
class HttpBasicAuthenticatorTest extends TestCase
1717
{
@@ -77,7 +77,7 @@ public function testUpgradePassword()
7777
'PHP_AUTH_PW' => 'ThePassword',
7878
]);
7979

80-
$this->userProvider = $this->createMock([UserProviderInterface::class, PasswordUpgraderInterface::class]);
80+
$this->userProvider = $this->createMock(PasswordUpgraderProvider::class);
8181
$this->userProvider->expects($this->any())->method('loadUserByUsername')->willReturn(new User('test', 's$cr$t'));
8282
$authenticator = new HttpBasicAuthenticator('test', $this->userProvider);
8383

0 commit comments

Comments
 (0)