aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php
diff options
context:
space:
mode:
authorJeremy Benoist <jeremy.benoist@gmail.com>2016-10-30 21:30:45 +0100
committerJeremy Benoist <jeremy.benoist@gmail.com>2016-10-30 21:30:45 +0100
commitd1495dd0a456f0e35a09fb68679ee51f8d17bfe4 (patch)
treea819eec38d3d8b880460cbaca42b6e08b073585a /tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php
parent309e13c11b54277626f18616c41f68ae9656a403 (diff)
downloadwallabag-d1495dd0a456f0e35a09fb68679ee51f8d17bfe4.tar.gz
wallabag-d1495dd0a456f0e35a09fb68679ee51f8d17bfe4.tar.zst
wallabag-d1495dd0a456f0e35a09fb68679ee51f8d17bfe4.zip
Ability to enable/disable downloading images
This will speed up the test suite because it won’t download everything when we add new entry… Add a custom test with downloading image enabled
Diffstat (limited to 'tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php')
-rw-r--r--tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php40
1 files changed, 40 insertions, 0 deletions
diff --git a/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php b/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php
index 05113650..514e9d89 100644
--- a/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php
+++ b/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php
@@ -836,4 +836,44 @@ class EntryControllerTest extends WallabagCoreTestCase
836 $client->request('GET', '/share/'.$content->getUuid()); 836 $client->request('GET', '/share/'.$content->getUuid());
837 $this->assertEquals(404, $client->getResponse()->getStatusCode()); 837 $this->assertEquals(404, $client->getResponse()->getStatusCode());
838 } 838 }
839
840 public function testNewEntryWithDownloadImagesEnabled()
841 {
842 $this->logInAs('admin');
843 $client = $this->getClient();
844
845 $url = 'http://www.20minutes.fr/montpellier/1952003-20161030-video-car-tombe-panne-rugbymen-perpignan-improvisent-melee-route';
846 $client->getContainer()->get('craue_config')->set('download_images_enabled', 1);
847
848 $crawler = $client->request('GET', '/new');
849
850 $this->assertEquals(200, $client->getResponse()->getStatusCode());
851
852 $form = $crawler->filter('form[name=entry]')->form();
853
854 $data = [
855 'entry[url]' => $url,
856 ];
857
858 $client->submit($form, $data);
859
860 $this->assertEquals(302, $client->getResponse()->getStatusCode());
861
862 $em = $client->getContainer()
863 ->get('doctrine.orm.entity_manager');
864
865 $entry = $em
866 ->getRepository('WallabagCoreBundle:Entry')
867 ->findByUrlAndUserId($url, $this->getLoggedInUserId());
868
869 $this->assertInstanceOf('Wallabag\CoreBundle\Entity\Entry', $entry);
870 $this->assertEquals($url, $entry->getUrl());
871 $this->assertContains('Perpignan', $entry->getTitle());
872 $this->assertContains('assets/images/8/e/8ec9229a/d9bc0fcd.jpeg', $entry->getContent());
873
874 $em->remove($entry);
875 $em->flush();
876
877 $client->getContainer()->get('craue_config')->set('download_images_enabled', 0);
878 }
839} 879}