diff --git a/src/Symfony/Component/Security/Http/Tests/Firewall/AnonymousAuthenticationListenerTest.php b/src/Symfony/Component/Security/Http/Tests/Firewall/AnonymousAuthenticationListenerTest.php
index <HASH>..<HASH> 100644
--- a/src/Symfony/Component/Security/Http/Tests/Firewall/AnonymousAuthenticationListenerTest.php
+++ b/src/Symfony/Component/Security/Http/Tests/Firewall/AnonymousAuthenticationListenerTest.php
@@ -54,10 +54,9 @@ class AnonymousAuthenticationListenerTest extends \PHPUnit_Framework_TestCase
         $authenticationManager
             ->expects($this->once())
             ->method('authenticate')
-            ->with(self::logicalAnd(
-                       $this->isInstanceOf('Symfony\Component\Security\Core\Authentication\Token\AnonymousToken'),
-                       $this->attributeEqualTo('key', 'TheKey')
-            ))
+            ->with($this->callback(function ($token) {
+                return 'TheKey' === $token->getKey();
+            }))
             ->will($this->returnValue($anonymousToken))
         ;
[Security/Http] Fix test relying on a private property