|
15 | 15 | use Symfony\Component\Security\Core\Authentication\Provider\SimpleAuthenticationProvider;
|
16 | 16 | use Symfony\Component\Security\Core\Exception\DisabledException;
|
17 | 17 | use Symfony\Component\Security\Core\Exception\LockedException;
|
18 |
| -use Symfony\Component\Security\Core\Exception\UsernameNotFoundException; |
19 | 18 | use Symfony\Component\Security\Core\User\UserChecker;
|
20 | 19 |
|
21 | 20 | class SimpleAuthenticationProviderTest extends TestCase
|
@@ -74,54 +73,6 @@ public function testAuthenticateWhenPostChecksFails()
|
74 | 73 | $provider->authenticate($token);
|
75 | 74 | }
|
76 | 75 |
|
77 |
| - public function testAuthenticateFromString() |
78 |
| - { |
79 |
| - $user = $this->getMockBuilder('Symfony\Component\Security\Core\User\UserInterface')->getMock(); |
80 |
| - |
81 |
| - $token = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock(); |
82 |
| - $token->expects($this->any()) |
83 |
| - ->method('getUser') |
84 |
| - ->will($this->returnValue('foo')); |
85 |
| - |
86 |
| - $authenticator = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\SimpleAuthenticatorInterface')->getMock(); |
87 |
| - $authenticator->expects($this->once()) |
88 |
| - ->method('authenticateToken') |
89 |
| - ->will($this->returnValue($token)); |
90 |
| - |
91 |
| - $userProvider = $this->getMockBuilder('Symfony\Component\Security\Core\User\UserProviderInterface')->getMock(); |
92 |
| - $userProvider->expects($this->once()) |
93 |
| - ->method('loadUserByUsername') |
94 |
| - ->willReturn($this->getMockBuilder('Symfony\Component\Security\Core\User\UserInterface')->getMock()); |
95 |
| - $provider = $this->getProvider($authenticator, $userProvider); |
96 |
| - |
97 |
| - $this->assertSame($token, $provider->authenticate($token)); |
98 |
| - } |
99 |
| - |
100 |
| - /** |
101 |
| - * @expectedException \Symfony\Component\Security\Core\Exception\UsernameNotFoundException |
102 |
| - */ |
103 |
| - public function testUsernameNotFound() |
104 |
| - { |
105 |
| - $user = $this->getMockBuilder('Symfony\Component\Security\Core\User\UserInterface')->getMock(); |
106 |
| - |
107 |
| - $token = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock(); |
108 |
| - $token->expects($this->any()) |
109 |
| - ->method('getUser') |
110 |
| - ->will($this->returnValue('foo')); |
111 |
| - |
112 |
| - $authenticator = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\SimpleAuthenticatorInterface')->getMock(); |
113 |
| - $authenticator->expects($this->once()) |
114 |
| - ->method('authenticateToken') |
115 |
| - ->will($this->returnValue($token)); |
116 |
| - |
117 |
| - $userProvider = $this->getMockBuilder('Symfony\Component\Security\Core\User\UserProviderInterface')->getMock(); |
118 |
| - $userProvider->expects($this->once()) |
119 |
| - ->method('loadUserByUsername') |
120 |
| - ->willThrowException(new UsernameNotFoundException()); |
121 |
| - |
122 |
| - $this->getProvider($authenticator, $userProvider)->authenticate($token); |
123 |
| - } |
124 |
| - |
125 | 76 | public function testAuthenticateSkipsUserChecksForNonUserInterfaceObjects()
|
126 | 77 | {
|
127 | 78 | $token = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')->getMock();
|
|
0 commit comments