aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php
diff options
context:
space:
mode:
authorJeremy Benoist <jeremy.benoist@gmail.com>2016-11-01 14:49:02 +0100
committerJeremy Benoist <jeremy.benoist@gmail.com>2016-11-01 14:49:02 +0100
commite0597476d1d5f6a4a7d6ea9b76966465f3d22fb8 (patch)
tree65c1ffe6906e9faacca5cbbf814f762d9013551d /tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php
parentaedd6ca0fd212abd07ec59c5fd58ea2ca99198c5 (diff)
downloadwallabag-e0597476d1d5f6a4a7d6ea9b76966465f3d22fb8.tar.gz
wallabag-e0597476d1d5f6a4a7d6ea9b76966465f3d22fb8.tar.zst
wallabag-e0597476d1d5f6a4a7d6ea9b76966465f3d22fb8.zip
Use custom event instead of Doctrine ones
This give us ability to use Entry ID to determine where to store images and it’s then more easy to remove them when we remove the entry.
Diffstat (limited to 'tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php')
-rw-r--r--tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php26
1 files changed, 23 insertions, 3 deletions
diff --git a/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php b/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php
index 514e9d89..4ab06dbf 100644
--- a/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php
+++ b/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php
@@ -869,10 +869,30 @@ class EntryControllerTest extends WallabagCoreTestCase
869 $this->assertInstanceOf('Wallabag\CoreBundle\Entity\Entry', $entry); 869 $this->assertInstanceOf('Wallabag\CoreBundle\Entity\Entry', $entry);
870 $this->assertEquals($url, $entry->getUrl()); 870 $this->assertEquals($url, $entry->getUrl());
871 $this->assertContains('Perpignan', $entry->getTitle()); 871 $this->assertContains('Perpignan', $entry->getTitle());
872 $this->assertContains('assets/images/8/e/8ec9229a/d9bc0fcd.jpeg', $entry->getContent()); 872 $this->assertContains('/d9bc0fcd.jpeg', $entry->getContent());
873 873
874 $em->remove($entry); 874 $client->getContainer()->get('craue_config')->set('download_images_enabled', 0);
875 $em->flush(); 875 }
876
877 /**
878 * @depends testNewEntryWithDownloadImagesEnabled
879 */
880 public function testRemoveEntryWithDownloadImagesEnabled()
881 {
882 $this->logInAs('admin');
883 $client = $this->getClient();
884
885 $url = 'http://www.20minutes.fr/montpellier/1952003-20161030-video-car-tombe-panne-rugbymen-perpignan-improvisent-melee-route';
886 $client->getContainer()->get('craue_config')->set('download_images_enabled', 1);
887
888 $content = $client->getContainer()
889 ->get('doctrine.orm.entity_manager')
890 ->getRepository('WallabagCoreBundle:Entry')
891 ->findByUrlAndUserId($url, $this->getLoggedInUserId());
892
893 $client->request('GET', '/delete/'.$content->getId());
894
895 $this->assertEquals(302, $client->getResponse()->getStatusCode());
876 896
877 $client->getContainer()->get('craue_config')->set('download_images_enabled', 0); 897 $client->getContainer()->get('craue_config')->set('download_images_enabled', 0);
878 } 898 }