diff options
author | Jérémy Benoist <j0k3r@users.noreply.github.com> | 2018-10-15 08:31:42 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-15 08:31:42 +0000 |
commit | 5bb01c034424b56a0a0ae4bc34ae5bb9a514deba (patch) | |
tree | bb18d67c8ec03bf8abd24dc6ef2138c3f81f6fa5 /tests/Wallabag/CoreBundle/Event | |
parent | 43b6f3a8a8173c47475632ca2869f190b552b5d6 (diff) | |
parent | 4d4147b228ac90f329fd2d40dd4fb60cb980328a (diff) | |
download | wallabag-5bb01c034424b56a0a0ae4bc34ae5bb9a514deba.tar.gz wallabag-5bb01c034424b56a0a0ae4bc34ae5bb9a514deba.tar.zst wallabag-5bb01c034424b56a0a0ae4bc34ae5bb9a514deba.zip |
Merge pull request #3216 from wallabag/change-locale-register
Added possibility to change locale from login/register pages
Diffstat (limited to 'tests/Wallabag/CoreBundle/Event')
-rw-r--r-- | tests/Wallabag/CoreBundle/Event/Listener/UserLocaleListenerTest.php | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/Wallabag/CoreBundle/Event/Listener/UserLocaleListenerTest.php b/tests/Wallabag/CoreBundle/Event/Listener/UserLocaleListenerTest.php index 93edfde8..ff0a9602 100644 --- a/tests/Wallabag/CoreBundle/Event/Listener/UserLocaleListenerTest.php +++ b/tests/Wallabag/CoreBundle/Event/Listener/UserLocaleListenerTest.php | |||
@@ -56,4 +56,27 @@ class UserLocaleListenerTest extends TestCase | |||
56 | 56 | ||
57 | $this->assertNull($session->get('_locale')); | 57 | $this->assertNull($session->get('_locale')); |
58 | } | 58 | } |
59 | |||
60 | public function testWithLanguageFromSession() | ||
61 | { | ||
62 | $session = new Session(new MockArraySessionStorage()); | ||
63 | $listener = new UserLocaleListener($session); | ||
64 | $session->set('_locale', 'de'); | ||
65 | |||
66 | $user = new User(); | ||
67 | $user->setEnabled(true); | ||
68 | |||
69 | $config = new Config($user); | ||
70 | $config->setLanguage('fr'); | ||
71 | |||
72 | $user->setConfig($config); | ||
73 | |||
74 | $userToken = new UsernamePasswordToken($user, '', 'test'); | ||
75 | $request = Request::create('/'); | ||
76 | $event = new InteractiveLoginEvent($request, $userToken); | ||
77 | |||
78 | $listener->onInteractiveLogin($event); | ||
79 | |||
80 | $this->assertSame('de', $session->get('_locale')); | ||
81 | } | ||
59 | } | 82 | } |