Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8d2e484

Browse files
committed
Replaced user.
1 parent 2d73d64 commit 8d2e484

File tree

1 file changed

+2
-31
lines changed

1 file changed

+2
-31
lines changed

src/Symfony/Bundle/SecurityBundle/Tests/Security/UserAuthenticatorTest.php

Lines changed: 2 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use Symfony\Component\DependencyInjection\Container;
99
use Symfony\Component\HttpFoundation\Request;
1010
use Symfony\Component\HttpFoundation\RequestStack;
11+
use Symfony\Component\Security\Core\User\InMemoryUser;
1112
use Symfony\Component\Security\Core\User\InMemoryUserProvider;
1213
use Symfony\Component\Security\Core\User\UserInterface;
1314
use Symfony\Component\Security\Http\Authenticator\HttpBasicAuthenticator;
@@ -19,37 +20,7 @@ public function testThrowsLogicExceptionIfCurrentRequestIsNull()
1920
$container = new Container();
2021
$firewallMap = new FirewallMap($container, []);
2122
$requestStack = new RequestStack();
22-
$user = new class() implements UserInterface {
23-
public function getUsername()
24-
{
25-
return 'impersonated';
26-
}
27-
28-
public function getUserIdentifier()
29-
{
30-
return 'impersonated';
31-
}
32-
33-
public function getPassword()
34-
{
35-
return null;
36-
}
37-
38-
public function eraseCredentials()
39-
{
40-
}
41-
42-
public function getRoles()
43-
{
44-
return ['ROLE_USER'];
45-
}
46-
47-
public function getSalt()
48-
{
49-
return null;
50-
}
51-
};
52-
23+
$user = new InMemoryUser('username', 'password');
5324
$userProvider = new InMemoryUserProvider();
5425
$authenticator = new HttpBasicAuthenticator('name', $userProvider);
5526
$request = new Request();

0 commit comments

Comments
 (0)