Skip to content

Commit 34c07c6

Browse files
Remove calls to TestCase::iniSet() and calls to deprecated methods of MockBuilder
1 parent 2c17186 commit 34c07c6

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

Tests/Authentication/Provider/UserAuthenticationProviderTest.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
use Symfony\Component\Security\Core\Exception\BadCredentialsException;
2323
use Symfony\Component\Security\Core\Exception\CredentialsExpiredException;
2424
use Symfony\Component\Security\Core\Exception\UserNotFoundException;
25+
use Symfony\Component\Security\Core\Tests\Fixtures\MockableUsernamePasswordTokenWithRoles;
2526
use Symfony\Component\Security\Core\User\InMemoryUser;
2627
use Symfony\Component\Security\Core\User\UserCheckerInterface;
2728
use Symfony\Component\Security\Core\User\UserInterface;
@@ -232,7 +233,9 @@ public function testAuthenticatePreservesOriginalToken()
232233

233234
protected function getSupportedToken()
234235
{
235-
$mock = $this->getMockBuilder(UsernamePasswordToken::class)->onlyMethods(['getCredentials', 'getFirewallName'])->addMethods(['getRoles'])->disableOriginalConstructor()->getMock();
236+
$mock = $this->getMockBuilder(MockableUsernamePasswordTokenWithRoles::class)
237+
->onlyMethods(['getCredentials', 'getFirewallName', 'getRoles'])
238+
->disableOriginalConstructor()->getMock();
236239
$mock
237240
->expects($this->any())
238241
->method('getFirewallName')
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
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\Core\Tests\Fixtures;
13+
14+
use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken;
15+
16+
class MockableUsernamePasswordTokenWithRoles extends UsernamePasswordToken
17+
{
18+
public function getRoles(): array
19+
{
20+
return [];
21+
}
22+
}

0 commit comments

Comments
 (0)