File tree Expand file tree Collapse file tree 1 file changed +36
-0
lines changed
Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Original file line number Diff line number Diff line change 1+ <?php
2+
3+ /*
4+ * This file is part of the Symfony package.
5+ *
6+ * (c) Fabien Potencier <fabien@symfony.com>
7+ *
8+ * For the full copyright and license information, please view the LICENSE
9+ * file that was distributed with this source code.
10+ */
11+
12+ namespace Symfony \Component \Security \Http \Tests \EventListener ;
13+
14+ use PHPUnit \Framework \TestCase ;
15+ use Symfony \Component \HttpFoundation \Exception \SessionNotFoundException ;
16+ use Symfony \Component \HttpFoundation \Request ;
17+ use Symfony \Component \HttpFoundation \RequestStack ;
18+ use Symfony \Component \Security \Csrf \TokenStorage \SessionTokenStorage ;
19+ use Symfony \Component \Security \Http \Event \LogoutEvent ;
20+ use Symfony \Component \Security \Http \EventListener \CsrfTokenClearingLogoutListener ;
21+
22+ class CsrfTokenClearingLogoutListenerTest extends TestCase
23+ {
24+ public function testSkipsClearingSessionTokenStorageOnStatelessRequest ()
25+ {
26+ try {
27+ (new CsrfTokenClearingLogoutListener (
28+ new SessionTokenStorage (new RequestStack ())
29+ ))->onLogout (new LogoutEvent (new Request (), null ));
30+ } catch (SessionNotFoundException ) {
31+ $ this ->fail ('clear() must not be called if the request is not associated with a session instance ' );
32+ }
33+
34+ $ this ->addToAssertionCount (1 );
35+ }
36+ }
You can’t perform that action at this time.
0 commit comments