]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php
Skipping PostgreSQL test that drop database
[github/wallabag/wallabag.git] / src / Wallabag / CoreBundle / Tests / Controller / EntryControllerTest.php
index e9c85a17225fffedadc3bab17e79c562ba347c17..0bd7d4fe66de9d09076b0842a9bbc783c9a27d77 100644 (file)
@@ -3,7 +3,6 @@
 namespace Wallabag\CoreBundle\Tests\Controller;
 
 use Wallabag\CoreBundle\Tests\WallabagCoreTestCase;
-use Doctrine\ORM\AbstractQuery;
 
 class EntryControllerTest extends WallabagCoreTestCase
 {
@@ -32,6 +31,31 @@ class EntryControllerTest extends WallabagCoreTestCase
         $this->assertCount(1, $crawler->filter('button[type=submit]'));
     }
 
+    public function testPostNewViaBookmarklet()
+    {
+        $this->logInAs('admin');
+        $client = $this->getClient();
+
+        $crawler = $client->request('GET', '/');
+
+        $this->assertCount(4, $crawler->filter('div[class=entry]'));
+
+        // Good URL
+        $crawler = $client->request('GET', '/bookmarklet', array('url' => $this->url));
+        $this->assertEquals(302, $client->getResponse()->getStatusCode());
+        $crawler = $client->followRedirect();
+        $crawler = $client->request('GET', '/');
+        $this->assertCount(5, $crawler->filter('div[class=entry]'));
+
+        $em = $client->getContainer()
+            ->get('doctrine.orm.entity_manager');
+        $entry = $em
+            ->getRepository('WallabagCoreBundle:Entry')
+            ->findOneByUrl($this->url);
+        $em->remove($entry);
+        $em->flush();
+    }
+
     public function testPostNewEmpty()
     {
         $this->logInAs('admin');
@@ -50,6 +74,9 @@ class EntryControllerTest extends WallabagCoreTestCase
         $this->assertEquals('This value should not be blank.', $alert[0]);
     }
 
+    /**
+     * This test will require an internet connection
+     */
     public function testPostNewOk()
     {
         $this->logInAs('admin');
@@ -95,6 +122,9 @@ class EntryControllerTest extends WallabagCoreTestCase
         $this->assertEquals(200, $client->getResponse()->getStatusCode());
     }
 
+    /**
+     * @depends testPostNewOk
+     */
     public function testView()
     {
         $this->logInAs('admin');