diff options
author | Jakub Zalas <jakub@zalas.pl> | 2013-05-26 19:00:29 +0100 |
---|---|---|
committer | Jakub Zalas <jakub@zalas.pl> | 2013-06-02 18:27:21 +0100 |
commit | 4b591729a0599a283494e54be234c918ec6a2b9d (patch) | |
tree | 02e50143b2faa3599380766a058e581f0f324582 /Tests | |
parent | f54858561272d81ffb9e431c0032c04ec4365bc6 (diff) | |
download | symfony-security-4b591729a0599a283494e54be234c918ec6a2b9d.zip symfony-security-4b591729a0599a283494e54be234c918ec6a2b9d.tar.gz symfony-security-4b591729a0599a283494e54be234c918ec6a2b9d.tar.bz2 |
[Security] Removed an unnecessary call to sprintf() and added a test case.
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/Http/Firewall/AnonymousAuthenticationListenerTest.php | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/Tests/Http/Firewall/AnonymousAuthenticationListenerTest.php b/Tests/Http/Firewall/AnonymousAuthenticationListenerTest.php index 9e7ea90..73ee821 100644 --- a/Tests/Http/Firewall/AnonymousAuthenticationListenerTest.php +++ b/Tests/Http/Firewall/AnonymousAuthenticationListenerTest.php @@ -59,4 +59,21 @@ class AnonymousAuthenticationListenerTest extends \PHPUnit_Framework_TestCase $listener = new AnonymousAuthenticationListener($context, 'TheKey'); $listener->handle($this->getMock('Symfony\Component\HttpKernel\Event\GetResponseEvent', array(), array(), '', false)); } + + public function testHandledEventIsLogged() + { + if (!interface_exists('Psr\Log\LoggerInterface')) { + $this->markTestSkipped('The "LoggerInterface" is not available'); + } + + $context = $this->getMock('Symfony\Component\Security\Core\SecurityContextInterface'); + $logger = $this->getMock('Psr\Log\LoggerInterface'); + $logger->expects($this->once()) + ->method('info') + ->with('Populated SecurityContext with an anonymous Token') + ; + + $listener = new AnonymousAuthenticationListener($context, 'TheKey', $logger); + $listener->handle($this->getMock('Symfony\Component\HttpKernel\Event\GetResponseEvent', array(), array(), '', false)); + } } |