aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/Wallabag/CoreBundle/Controller
diff options
context:
space:
mode:
Diffstat (limited to 'tests/Wallabag/CoreBundle/Controller')
-rw-r--r--tests/Wallabag/CoreBundle/Controller/ConfigControllerTest.php35
-rw-r--r--tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php12
2 files changed, 42 insertions, 5 deletions
diff --git a/tests/Wallabag/CoreBundle/Controller/ConfigControllerTest.php b/tests/Wallabag/CoreBundle/Controller/ConfigControllerTest.php
index d709f4eb..cf9f1e97 100644
--- a/tests/Wallabag/CoreBundle/Controller/ConfigControllerTest.php
+++ b/tests/Wallabag/CoreBundle/Controller/ConfigControllerTest.php
@@ -965,4 +965,39 @@ class ConfigControllerTest extends WallabagCoreTestCase
965 965
966 $client->request('GET', '/config/view-mode'); 966 $client->request('GET', '/config/view-mode');
967 } 967 }
968
969 public function testChangeLocaleWithoutReferer()
970 {
971 $client = $this->getClient();
972
973 $client->request('GET', '/locale/de');
974 $client->followRedirect();
975
976 $this->assertSame('de', $client->getRequest()->getLocale());
977 $this->assertSame('de', $client->getContainer()->get('session')->get('_locale'));
978 }
979
980 public function testChangeLocaleWithReferer()
981 {
982 $client = $this->getClient();
983
984 $client->request('GET', '/login');
985 $client->request('GET', '/locale/de');
986 $client->followRedirect();
987
988 $this->assertSame('de', $client->getRequest()->getLocale());
989 $this->assertSame('de', $client->getContainer()->get('session')->get('_locale'));
990 }
991
992 public function testChangeLocaleToBadLocale()
993 {
994 $client = $this->getClient();
995
996 $client->request('GET', '/login');
997 $client->request('GET', '/locale/yuyuyuyu');
998 $client->followRedirect();
999
1000 $this->assertNotSame('yuyuyuyu', $client->getRequest()->getLocale());
1001 $this->assertNotSame('yuyuyuyu', $client->getContainer()->get('session')->get('_locale'));
1002 }
968} 1003}
diff --git a/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php b/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php
index 0ac119d8..6effe43e 100644
--- a/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php
+++ b/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php
@@ -985,8 +985,13 @@ class EntryControllerTest extends WallabagCoreTestCase
985 $client->request('GET', '/share/' . $content->getId()); 985 $client->request('GET', '/share/' . $content->getId());
986 $this->assertSame(302, $client->getResponse()->getStatusCode()); 986 $this->assertSame(302, $client->getResponse()->getStatusCode());
987 987
988 // follow link with uid 988 $shareUrl = $client->getResponse()->getTargetUrl();
989 $crawler = $client->followRedirect(); 989
990 // use a new client to have a fresh empty session (instead of a logged one from the previous client)
991 $client->restart();
992
993 $client->request('GET', $shareUrl);
994
990 $this->assertSame(200, $client->getResponse()->getStatusCode()); 995 $this->assertSame(200, $client->getResponse()->getStatusCode());
991 $this->assertContains('max-age=25200', $client->getResponse()->headers->get('cache-control')); 996 $this->assertContains('max-age=25200', $client->getResponse()->headers->get('cache-control'));
992 $this->assertContains('public', $client->getResponse()->headers->get('cache-control')); 997 $this->assertContains('public', $client->getResponse()->headers->get('cache-control'));
@@ -1002,9 +1007,6 @@ class EntryControllerTest extends WallabagCoreTestCase
1002 $client->request('GET', '/share/' . $content->getUid()); 1007 $client->request('GET', '/share/' . $content->getUid());
1003 $this->assertSame(404, $client->getResponse()->getStatusCode()); 1008 $this->assertSame(404, $client->getResponse()->getStatusCode());
1004 1009
1005 $client->request('GET', '/view/' . $content->getId());
1006 $this->assertContains('no-cache', $client->getResponse()->headers->get('cache-control'));
1007
1008 // removing the share 1010 // removing the share
1009 $client->request('GET', '/share/delete/' . $content->getId()); 1011 $client->request('GET', '/share/delete/' . $content->getId());
1010 $this->assertSame(302, $client->getResponse()->getStatusCode()); 1012 $this->assertSame(302, $client->getResponse()->getStatusCode());