summaryrefslogtreecommitdiffstats
path: root/Tests/Http/Firewall
diff options
context:
space:
mode:
authorFabien Bourigault <fabien@vtech.fr>2017-01-02 16:09:26 +0100
committerFabien Bourigault <bourigaultfabien@gmail.com>2017-01-02 16:57:45 +0100
commit27fdeef792e7237be2b16a2d164126276530b0ec (patch)
tree7536a20ceb7f56f72e417bd22d849c403b434f37 /Tests/Http/Firewall
parent90bb3ea494b8f03fa44c3f1114f950898f7d9277 (diff)
downloadsymfony-security-27fdeef792e7237be2b16a2d164126276530b0ec.zip
symfony-security-27fdeef792e7237be2b16a2d164126276530b0ec.tar.gz
symfony-security-27fdeef792e7237be2b16a2d164126276530b0ec.tar.bz2
use authenticated token for json authentication
Diffstat (limited to 'Tests/Http/Firewall')
-rw-r--r--Tests/Http/Firewall/UsernamePasswordJsonAuthenticationListenerTest.php5
1 files changed, 4 insertions, 1 deletions
diff --git a/Tests/Http/Firewall/UsernamePasswordJsonAuthenticationListenerTest.php b/Tests/Http/Firewall/UsernamePasswordJsonAuthenticationListenerTest.php
index b381550..8127e94 100644
--- a/Tests/Http/Firewall/UsernamePasswordJsonAuthenticationListenerTest.php
+++ b/Tests/Http/Firewall/UsernamePasswordJsonAuthenticationListenerTest.php
@@ -17,6 +17,7 @@ use Symfony\Component\HttpKernel\Event\GetResponseEvent;
use Symfony\Component\HttpKernel\KernelInterface;
use Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
+use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
use Symfony\Component\Security\Core\Exception\AuthenticationException;
use Symfony\Component\Security\Core\Security;
use Symfony\Component\Security\Http\Authentication\AuthenticationFailureHandlerInterface;
@@ -38,8 +39,10 @@ class UsernamePasswordJsonAuthenticationListenerTest extends \PHPUnit_Framework_
$tokenStorage = $this->getMockBuilder(TokenStorageInterface::class)->getMock();
$authenticationManager = $this->getMockBuilder(AuthenticationManagerInterface::class)->getMock();
+ $authenticatedToken = $this->getMockBuilder(TokenInterface::class)->getMock();
+
if ($success) {
- $authenticationManager->method('authenticate')->willReturn(true);
+ $authenticationManager->method('authenticate')->willReturn($authenticatedToken);
} else {
$authenticationManager->method('authenticate')->willThrowException(new AuthenticationException());
}