From a7e2218e253138ed53e18b4775dce291c78246c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Fri, 15 Apr 2016 13:42:13 +0200 Subject: Add test and fix migration --- .../CoreBundle/Controller/EntryControllerTest.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'tests/Wallabag') diff --git a/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php b/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php index 5c739c78..3b54f057 100644 --- a/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php +++ b/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php @@ -698,4 +698,22 @@ class EntryControllerTest extends WallabagCoreTestCase $crawler = $client->submit($form, $data); $this->assertCount(2, $crawler->filter('div[class=entry]')); } + + public function testCache() + { + $this->logInAs('admin'); + $client = $this->getClient(); + + $content = $client->getContainer() + ->get('doctrine.orm.entity_manager') + ->getRepository('WallabagCoreBundle:Entry') + ->findOneByUser($this->getLoggedInUserId()); + + $client->request('GET', '/share/'.$content->getUuid()); + $this->assertContains('max-age=25200, public', $client->getResponse()->headers->get('cache-control')); + $this->assertNotContains('no-cache', $client->getResponse()->headers->get('cache-control')); + + $client->request('GET', '/view/'.$content->getId()); + $this->assertContains('no-cache', $client->getResponse()->headers->get('cache-control')); + } } -- cgit v1.2.3 From f1be7af446052c6fed7033664c6c6350f558961b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Tue, 23 Aug 2016 16:49:12 +0200 Subject: Change share entry behavior --- tests/Wallabag/CoreBundle/Command/InstallCommandTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/Wallabag') diff --git a/tests/Wallabag/CoreBundle/Command/InstallCommandTest.php b/tests/Wallabag/CoreBundle/Command/InstallCommandTest.php index c0133af4..07ff2772 100644 --- a/tests/Wallabag/CoreBundle/Command/InstallCommandTest.php +++ b/tests/Wallabag/CoreBundle/Command/InstallCommandTest.php @@ -33,7 +33,7 @@ class InstallCommandTest extends WallabagCoreTestCase } /** - * Ensure next tests will have a clean database + * Ensure next tests will have a clean database. */ public static function tearDownAfterClass() { -- cgit v1.2.3 From eddda878a0ec375fa738e3228a72dd01b23e0fab Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Wed, 24 Aug 2016 22:29:36 +0200 Subject: Update test and some cleanup --- .../CoreBundle/Controller/EntryControllerTest.php | 27 +++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) (limited to 'tests/Wallabag') diff --git a/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php b/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php index 3b54f057..f9ac28c3 100644 --- a/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php +++ b/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php @@ -709,11 +709,36 @@ class EntryControllerTest extends WallabagCoreTestCase ->getRepository('WallabagCoreBundle:Entry') ->findOneByUser($this->getLoggedInUserId()); + // no uuid $client->request('GET', '/share/'.$content->getUuid()); - $this->assertContains('max-age=25200, public', $client->getResponse()->headers->get('cache-control')); + $this->assertEquals(404, $client->getResponse()->getStatusCode()); + + // generating the uuid + $client->request('GET', '/share/'.$content->getId()); + $this->assertEquals(302, $client->getResponse()->getStatusCode()); + + // follow link with uuid + $crawler = $client->followRedirect(); + $this->assertEquals(200, $client->getResponse()->getStatusCode()); + $this->assertContains('max-age=25200', $client->getResponse()->headers->get('cache-control')); + $this->assertContains('public', $client->getResponse()->headers->get('cache-control')); + $this->assertContains('s-maxage=25200', $client->getResponse()->headers->get('cache-control')); $this->assertNotContains('no-cache', $client->getResponse()->headers->get('cache-control')); + // sharing is now disabled + $client->getContainer()->get('craue_config')->set('share_public', 0); + $client->request('GET', '/share/'.$content->getUuid()); + $this->assertEquals(404, $client->getResponse()->getStatusCode()); + $client->request('GET', '/view/'.$content->getId()); $this->assertContains('no-cache', $client->getResponse()->headers->get('cache-control')); + + // removing the share + $client->request('GET', '/share/delete/'.$content->getId()); + $this->assertEquals(302, $client->getResponse()->getStatusCode()); + + // share is now disable + $client->request('GET', '/share/'.$content->getUuid()); + $this->assertEquals(404, $client->getResponse()->getStatusCode()); } } -- cgit v1.2.3