diff options
Diffstat (limited to 'tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php')
-rw-r--r-- | tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php b/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php index 5c739c78..a74c17d9 100644 --- a/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php +++ b/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php | |||
@@ -236,6 +236,16 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
236 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | 236 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); |
237 | } | 237 | } |
238 | 238 | ||
239 | public function testUntagged() | ||
240 | { | ||
241 | $this->logInAs('admin'); | ||
242 | $client = $this->getClient(); | ||
243 | |||
244 | $client->request('GET', '/untagged/list'); | ||
245 | |||
246 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | ||
247 | } | ||
248 | |||
239 | public function testStarred() | 249 | public function testStarred() |
240 | { | 250 | { |
241 | $this->logInAs('admin'); | 251 | $this->logInAs('admin'); |
@@ -698,4 +708,47 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
698 | $crawler = $client->submit($form, $data); | 708 | $crawler = $client->submit($form, $data); |
699 | $this->assertCount(2, $crawler->filter('div[class=entry]')); | 709 | $this->assertCount(2, $crawler->filter('div[class=entry]')); |
700 | } | 710 | } |
711 | |||
712 | public function testCache() | ||
713 | { | ||
714 | $this->logInAs('admin'); | ||
715 | $client = $this->getClient(); | ||
716 | |||
717 | $content = $client->getContainer() | ||
718 | ->get('doctrine.orm.entity_manager') | ||
719 | ->getRepository('WallabagCoreBundle:Entry') | ||
720 | ->findOneByUser($this->getLoggedInUserId()); | ||
721 | |||
722 | // no uuid | ||
723 | $client->request('GET', '/share/'.$content->getUuid()); | ||
724 | $this->assertEquals(404, $client->getResponse()->getStatusCode()); | ||
725 | |||
726 | // generating the uuid | ||
727 | $client->request('GET', '/share/'.$content->getId()); | ||
728 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); | ||
729 | |||
730 | // follow link with uuid | ||
731 | $crawler = $client->followRedirect(); | ||
732 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | ||
733 | $this->assertContains('max-age=25200', $client->getResponse()->headers->get('cache-control')); | ||
734 | $this->assertContains('public', $client->getResponse()->headers->get('cache-control')); | ||
735 | $this->assertContains('s-maxage=25200', $client->getResponse()->headers->get('cache-control')); | ||
736 | $this->assertNotContains('no-cache', $client->getResponse()->headers->get('cache-control')); | ||
737 | |||
738 | // sharing is now disabled | ||
739 | $client->getContainer()->get('craue_config')->set('share_public', 0); | ||
740 | $client->request('GET', '/share/'.$content->getUuid()); | ||
741 | $this->assertEquals(404, $client->getResponse()->getStatusCode()); | ||
742 | |||
743 | $client->request('GET', '/view/'.$content->getId()); | ||
744 | $this->assertContains('no-cache', $client->getResponse()->headers->get('cache-control')); | ||
745 | |||
746 | // removing the share | ||
747 | $client->request('GET', '/share/delete/'.$content->getId()); | ||
748 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); | ||
749 | |||
750 | // share is now disable | ||
751 | $client->request('GET', '/share/'.$content->getUuid()); | ||
752 | $this->assertEquals(404, $client->getResponse()->getStatusCode()); | ||
753 | } | ||
701 | } | 754 | } |