diff options
author | Jérémy Benoist <j0k3r@users.noreply.github.com> | 2017-10-23 11:09:17 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-23 11:09:17 +0200 |
commit | 1953a872932a63792293b4aec087880265ba89f7 (patch) | |
tree | fd16599e737fcdaf193c933ef3ec4a4ee248b117 /tests/Wallabag/CoreBundle/Event/Listener | |
parent | d83d25dadec2c38460a32d96f5d2903426fec9d3 (diff) | |
parent | 702f2d67d60ca963492b90dad74cb5f8dcc84e51 (diff) | |
download | wallabag-1953a872932a63792293b4aec087880265ba89f7.tar.gz wallabag-1953a872932a63792293b4aec087880265ba89f7.tar.zst wallabag-1953a872932a63792293b4aec087880265ba89f7.zip |
Merge pull request #3011 from wallabag/2.3
wallabag 2.3.0
Diffstat (limited to 'tests/Wallabag/CoreBundle/Event/Listener')
-rw-r--r-- | tests/Wallabag/CoreBundle/Event/Listener/LocaleListenerTest.php | 28 | ||||
-rw-r--r-- | tests/Wallabag/CoreBundle/Event/Listener/UserLocaleListenerTest.php | 4 |
2 files changed, 16 insertions, 16 deletions
diff --git a/tests/Wallabag/CoreBundle/Event/Listener/LocaleListenerTest.php b/tests/Wallabag/CoreBundle/Event/Listener/LocaleListenerTest.php index 84a54d3a..0dbd9f70 100644 --- a/tests/Wallabag/CoreBundle/Event/Listener/LocaleListenerTest.php +++ b/tests/Wallabag/CoreBundle/Event/Listener/LocaleListenerTest.php | |||
@@ -13,15 +13,6 @@ use Wallabag\CoreBundle\Event\Listener\LocaleListener; | |||
13 | 13 | ||
14 | class LocaleListenerTest extends \PHPUnit_Framework_TestCase | 14 | class LocaleListenerTest extends \PHPUnit_Framework_TestCase |
15 | { | 15 | { |
16 | private function getEvent(Request $request) | ||
17 | { | ||
18 | $kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernelInterface') | ||
19 | ->disableOriginalConstructor() | ||
20 | ->getMock(); | ||
21 | |||
22 | return new GetResponseEvent($kernel, $request, HttpKernelInterface::MASTER_REQUEST); | ||
23 | } | ||
24 | |||
25 | public function testWithoutSession() | 16 | public function testWithoutSession() |
26 | { | 17 | { |
27 | $request = Request::create('/'); | 18 | $request = Request::create('/'); |
@@ -30,7 +21,7 @@ class LocaleListenerTest extends \PHPUnit_Framework_TestCase | |||
30 | $event = $this->getEvent($request); | 21 | $event = $this->getEvent($request); |
31 | 22 | ||
32 | $listener->onKernelRequest($event); | 23 | $listener->onKernelRequest($event); |
33 | $this->assertEquals('en', $request->getLocale()); | 24 | $this->assertSame('en', $request->getLocale()); |
34 | } | 25 | } |
35 | 26 | ||
36 | public function testWithPreviousSession() | 27 | public function testWithPreviousSession() |
@@ -44,7 +35,7 @@ class LocaleListenerTest extends \PHPUnit_Framework_TestCase | |||
44 | $event = $this->getEvent($request); | 35 | $event = $this->getEvent($request); |
45 | 36 | ||
46 | $listener->onKernelRequest($event); | 37 | $listener->onKernelRequest($event); |
47 | $this->assertEquals('fr', $request->getLocale()); | 38 | $this->assertSame('fr', $request->getLocale()); |
48 | } | 39 | } |
49 | 40 | ||
50 | public function testLocaleFromRequestAttribute() | 41 | public function testLocaleFromRequestAttribute() |
@@ -59,8 +50,8 @@ class LocaleListenerTest extends \PHPUnit_Framework_TestCase | |||
59 | $event = $this->getEvent($request); | 50 | $event = $this->getEvent($request); |
60 | 51 | ||
61 | $listener->onKernelRequest($event); | 52 | $listener->onKernelRequest($event); |
62 | $this->assertEquals('en', $request->getLocale()); | 53 | $this->assertSame('en', $request->getLocale()); |
63 | $this->assertEquals('es', $request->getSession()->get('_locale')); | 54 | $this->assertSame('es', $request->getSession()->get('_locale')); |
64 | } | 55 | } |
65 | 56 | ||
66 | public function testSubscribedEvents() | 57 | public function testSubscribedEvents() |
@@ -81,6 +72,15 @@ class LocaleListenerTest extends \PHPUnit_Framework_TestCase | |||
81 | $event | 72 | $event |
82 | ); | 73 | ); |
83 | 74 | ||
84 | $this->assertEquals('fr', $request->getLocale()); | 75 | $this->assertSame('fr', $request->getLocale()); |
76 | } | ||
77 | |||
78 | private function getEvent(Request $request) | ||
79 | { | ||
80 | $kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernelInterface') | ||
81 | ->disableOriginalConstructor() | ||
82 | ->getMock(); | ||
83 | |||
84 | return new GetResponseEvent($kernel, $request, HttpKernelInterface::MASTER_REQUEST); | ||
85 | } | 85 | } |
86 | } | 86 | } |
diff --git a/tests/Wallabag/CoreBundle/Event/Listener/UserLocaleListenerTest.php b/tests/Wallabag/CoreBundle/Event/Listener/UserLocaleListenerTest.php index 45aecc63..5ffe1ca6 100644 --- a/tests/Wallabag/CoreBundle/Event/Listener/UserLocaleListenerTest.php +++ b/tests/Wallabag/CoreBundle/Event/Listener/UserLocaleListenerTest.php | |||
@@ -32,7 +32,7 @@ class UserLocaleListenerTest extends \PHPUnit_Framework_TestCase | |||
32 | 32 | ||
33 | $listener->onInteractiveLogin($event); | 33 | $listener->onInteractiveLogin($event); |
34 | 34 | ||
35 | $this->assertEquals('fr', $session->get('_locale')); | 35 | $this->assertSame('fr', $session->get('_locale')); |
36 | } | 36 | } |
37 | 37 | ||
38 | public function testWithoutLanguage() | 38 | public function testWithoutLanguage() |
@@ -53,6 +53,6 @@ class UserLocaleListenerTest extends \PHPUnit_Framework_TestCase | |||
53 | 53 | ||
54 | $listener->onInteractiveLogin($event); | 54 | $listener->onInteractiveLogin($event); |
55 | 55 | ||
56 | $this->assertEquals('', $session->get('_locale')); | 56 | $this->assertNull($session->get('_locale')); |
57 | } | 57 | } |
58 | } | 58 | } |