use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage;
use Symfony\Component\Security\Core\Authentication\Token\Storage\UsageTrackingTokenStorage;
use Symfony\Component\Security\Http\Firewall\ContextListener;
class RegisterTokenUsageTrackingPassTest extends TestCase
{ public function testTokenStorageIsUntrackedIfSessionIsMissing() { $container =
new ContainerBuilder();
$container->
register('security.untracked_token_storage', TokenStorage::
class);
$compilerPass =
new RegisterTokenUsageTrackingPass();
$compilerPass->
process($container);
$this->
assertTrue($container->
hasAlias('security.token_storage'
));
$this->
assertEquals(new Alias('security.untracked_token_storage', true
),
$container->
getAlias('security.token_storage'
));
} public function testContextListenerIsNotModifiedIfTokenStorageDoesNotSupportUsageTracking() { $container =
new ContainerBuilder();
$container->
setParameter('security.token_storage.class', TokenStorage::
class);