aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/Wallabag/CoreBundle/Event
diff options
context:
space:
mode:
authorJeremy Benoist <jeremy.benoist@gmail.com>2018-10-13 09:24:39 +0200
committerJeremy Benoist <jeremy.benoist@gmail.com>2018-10-13 09:39:00 +0200
commit4d4147b228ac90f329fd2d40dd4fb60cb980328a (patch)
treebb18d67c8ec03bf8abd24dc6ef2138c3f81f6fa5 /tests/Wallabag/CoreBundle/Event
parentbe417ef23685e17a239b1d192a0e9b9f484f1bfe (diff)
downloadwallabag-4d4147b228ac90f329fd2d40dd4fb60cb980328a.tar.gz
wallabag-4d4147b228ac90f329fd2d40dd4fb60cb980328a.tar.zst
wallabag-4d4147b228ac90f329fd2d40dd4fb60cb980328a.zip
Ensure language is valid
- Do not override locale if user has choosen a locale from the login screen. - Add some tests about locale url
Diffstat (limited to 'tests/Wallabag/CoreBundle/Event')
-rw-r--r--tests/Wallabag/CoreBundle/Event/Listener/UserLocaleListenerTest.php23
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}