minor #38102 [SecurityHttp] Don't call createMock() with multiple interfaces (derrabus)
This PR was merged into the 5.1 branch.
Discussion
----------
[SecurityHttp] Don't call createMock() with multiple interfaces
| Q | A
| ------------- | ---
| Branch? | 5.1
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | #37564
| License | MIT
| Doc PR | N/A
Continuation of #38079 for the 5.1 branch.
Commits
-------
028ec0cf68
[SecurityHttp] Don't call createMock() with multiple interfaces.
This commit is contained in:
commit
be42ef77a2
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Security\Http\Tests\Authenticator\Fixtures;
|
||||
|
||||
use Symfony\Component\Security\Core\User\PasswordUpgraderInterface;
|
||||
use Symfony\Component\Security\Core\User\UserProviderInterface;
|
||||
|
||||
abstract class PasswordUpgraderProvider implements UserProviderInterface, PasswordUpgraderInterface
|
||||
{
|
||||
}
|
@ -16,7 +16,6 @@ use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
|
||||
use Symfony\Component\Security\Core\Exception\BadCredentialsException;
|
||||
use Symfony\Component\Security\Core\Security;
|
||||
use Symfony\Component\Security\Core\User\PasswordUpgraderInterface;
|
||||
use Symfony\Component\Security\Core\User\User;
|
||||
use Symfony\Component\Security\Core\User\UserProviderInterface;
|
||||
use Symfony\Component\Security\Http\Authentication\AuthenticationFailureHandlerInterface;
|
||||
@ -25,6 +24,7 @@ use Symfony\Component\Security\Http\Authenticator\FormLoginAuthenticator;
|
||||
use Symfony\Component\Security\Http\Authenticator\Passport\Badge\CsrfTokenBadge;
|
||||
use Symfony\Component\Security\Http\Authenticator\Passport\Badge\PasswordUpgradeBadge;
|
||||
use Symfony\Component\Security\Http\HttpUtils;
|
||||
use Symfony\Component\Security\Http\Tests\Authenticator\Fixtures\PasswordUpgraderProvider;
|
||||
|
||||
class FormLoginAuthenticatorTest extends TestCase
|
||||
{
|
||||
@ -148,7 +148,7 @@ class FormLoginAuthenticatorTest extends TestCase
|
||||
$request = Request::create('/login_check', 'POST', ['_username' => 'wouter', '_password' => 's$cr$t']);
|
||||
$request->setSession($this->createSession());
|
||||
|
||||
$this->userProvider = $this->createMock([UserProviderInterface::class, PasswordUpgraderInterface::class]);
|
||||
$this->userProvider = $this->createMock(PasswordUpgraderProvider::class);
|
||||
$this->userProvider->expects($this->any())->method('loadUserByUsername')->willReturn(new User('test', 's$cr$t'));
|
||||
|
||||
$this->setUpAuthenticator();
|
||||
|
@ -6,12 +6,12 @@ use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\Security\Core\Encoder\EncoderFactoryInterface;
|
||||
use Symfony\Component\Security\Core\Encoder\PasswordEncoderInterface;
|
||||
use Symfony\Component\Security\Core\User\PasswordUpgraderInterface;
|
||||
use Symfony\Component\Security\Core\User\User;
|
||||
use Symfony\Component\Security\Core\User\UserProviderInterface;
|
||||
use Symfony\Component\Security\Http\Authenticator\HttpBasicAuthenticator;
|
||||
use Symfony\Component\Security\Http\Authenticator\Passport\Badge\PasswordUpgradeBadge;
|
||||
use Symfony\Component\Security\Http\Authenticator\Passport\Credentials\PasswordCredentials;
|
||||
use Symfony\Component\Security\Http\Tests\Authenticator\Fixtures\PasswordUpgraderProvider;
|
||||
|
||||
class HttpBasicAuthenticatorTest extends TestCase
|
||||
{
|
||||
@ -77,7 +77,7 @@ class HttpBasicAuthenticatorTest extends TestCase
|
||||
'PHP_AUTH_PW' => 'ThePassword',
|
||||
]);
|
||||
|
||||
$this->userProvider = $this->createMock([UserProviderInterface::class, PasswordUpgraderInterface::class]);
|
||||
$this->userProvider = $this->createMock(PasswordUpgraderProvider::class);
|
||||
$this->userProvider->expects($this->any())->method('loadUserByUsername')->willReturn(new User('test', 's$cr$t'));
|
||||
$authenticator = new HttpBasicAuthenticator('test', $this->userProvider);
|
||||
|
||||
|
Reference in New Issue
Block a user