]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php
Add test and fix migration
[github/wallabag/wallabag.git] / tests / Wallabag / CoreBundle / Controller / EntryControllerTest.php
index 5c739c78a3349f167f49c2d273971e31cd453526..3b54f0577c1ad8933becad7119247ca14369853e 100644 (file)
@@ -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'));
+    }
 }