]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php
Fixed french translation
[github/wallabag/wallabag.git] / tests / Wallabag / CoreBundle / Controller / EntryControllerTest.php
index 3b54f0577c1ad8933becad7119247ca14369853e..a74c17d9549372324632edbf5910765c9d6a8087 100644 (file)
@@ -236,6 +236,16 @@ class EntryControllerTest extends WallabagCoreTestCase
         $this->assertEquals(200, $client->getResponse()->getStatusCode());
     }
 
+    public function testUntagged()
+    {
+        $this->logInAs('admin');
+        $client = $this->getClient();
+
+        $client->request('GET', '/untagged/list');
+
+        $this->assertEquals(200, $client->getResponse()->getStatusCode());
+    }
+
     public function testStarred()
     {
         $this->logInAs('admin');
@@ -709,11 +719,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());
     }
 }