aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/Wallabag
diff options
context:
space:
mode:
authorJeremy Benoist <j0k3r@users.noreply.github.com>2016-08-25 09:30:51 +0200
committerGitHub <noreply@github.com>2016-08-25 09:30:51 +0200
commit60e722040665c836fb9d3c4a35c37aad5c1cba64 (patch)
tree4e90d355a5c12c311dec4d569dfc256ebef110f2 /tests/Wallabag
parenta1ab7d1d32cb69af563fcec4395fce5217f154f7 (diff)
parenteddda878a0ec375fa738e3228a72dd01b23e0fab (diff)
downloadwallabag-60e722040665c836fb9d3c4a35c37aad5c1cba64.tar.gz
wallabag-60e722040665c836fb9d3c4a35c37aad5c1cba64.tar.zst
wallabag-60e722040665c836fb9d3c4a35c37aad5c1cba64.zip
Merge pull request #1904 from wallabag/feature-public-mode
Share entry with a public URL
Diffstat (limited to 'tests/Wallabag')
-rw-r--r--tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php43
1 files changed, 43 insertions, 0 deletions
diff --git a/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php b/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php
index 5c739c78..f9ac28c3 100644
--- a/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php
+++ b/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php
@@ -698,4 +698,47 @@ class EntryControllerTest extends WallabagCoreTestCase
698 $crawler = $client->submit($form, $data); 698 $crawler = $client->submit($form, $data);
699 $this->assertCount(2, $crawler->filter('div[class=entry]')); 699 $this->assertCount(2, $crawler->filter('div[class=entry]'));
700 } 700 }
701
702 public function testCache()
703 {
704 $this->logInAs('admin');
705 $client = $this->getClient();
706
707 $content = $client->getContainer()
708 ->get('doctrine.orm.entity_manager')
709 ->getRepository('WallabagCoreBundle:Entry')
710 ->findOneByUser($this->getLoggedInUserId());
711
712 // no uuid
713 $client->request('GET', '/share/'.$content->getUuid());
714 $this->assertEquals(404, $client->getResponse()->getStatusCode());
715
716 // generating the uuid
717 $client->request('GET', '/share/'.$content->getId());
718 $this->assertEquals(302, $client->getResponse()->getStatusCode());
719
720 // follow link with uuid
721 $crawler = $client->followRedirect();
722 $this->assertEquals(200, $client->getResponse()->getStatusCode());
723 $this->assertContains('max-age=25200', $client->getResponse()->headers->get('cache-control'));
724 $this->assertContains('public', $client->getResponse()->headers->get('cache-control'));
725 $this->assertContains('s-maxage=25200', $client->getResponse()->headers->get('cache-control'));
726 $this->assertNotContains('no-cache', $client->getResponse()->headers->get('cache-control'));
727
728 // sharing is now disabled
729 $client->getContainer()->get('craue_config')->set('share_public', 0);
730 $client->request('GET', '/share/'.$content->getUuid());
731 $this->assertEquals(404, $client->getResponse()->getStatusCode());
732
733 $client->request('GET', '/view/'.$content->getId());
734 $this->assertContains('no-cache', $client->getResponse()->headers->get('cache-control'));
735
736 // removing the share
737 $client->request('GET', '/share/delete/'.$content->getId());
738 $this->assertEquals(302, $client->getResponse()->getStatusCode());
739
740 // share is now disable
741 $client->request('GET', '/share/'.$content->getUuid());
742 $this->assertEquals(404, $client->getResponse()->getStatusCode());
743 }
701} 744}