aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php21
1 files changed, 20 insertions, 1 deletions
diff --git a/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php b/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php
index 19c8698e..116e5f32 100644
--- a/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php
+++ b/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php
@@ -8,8 +8,24 @@ use Wallabag\CoreBundle\Entity\Entry;
8 8
9class EntryControllerTest extends WallabagCoreTestCase 9class EntryControllerTest extends WallabagCoreTestCase
10{ 10{
11 public $downloadImagesEnabled = false;
11 public $url = 'http://www.lemonde.fr/pixels/article/2015/03/28/plongee-dans-l-univers-d-ingress-le-jeu-de-google-aux-frontieres-du-reel_4601155_4408996.html'; 12 public $url = 'http://www.lemonde.fr/pixels/article/2015/03/28/plongee-dans-l-univers-d-ingress-le-jeu-de-google-aux-frontieres-du-reel_4601155_4408996.html';
12 13
14 /**
15 * @after
16 *
17 * Ensure download_images_enabled is disabled after each script
18 */
19 public function tearDownImagesEnabled()
20 {
21 if ($this->downloadImagesEnabled) {
22 $client = static::createClient();
23 $client->getContainer()->get('craue_config')->set('download_images_enabled', 0);
24
25 $this->downloadImagesEnabled = false;
26 }
27 }
28
13 public function testLogin() 29 public function testLogin()
14 { 30 {
15 $client = $this->getClient(); 31 $client = $this->getClient();
@@ -905,6 +921,7 @@ class EntryControllerTest extends WallabagCoreTestCase
905 921
906 public function testNewEntryWithDownloadImagesEnabled() 922 public function testNewEntryWithDownloadImagesEnabled()
907 { 923 {
924 $this->downloadImagesEnabled = true;
908 $this->logInAs('admin'); 925 $this->logInAs('admin');
909 $client = $this->getClient(); 926 $client = $this->getClient();
910 927
@@ -935,7 +952,8 @@ class EntryControllerTest extends WallabagCoreTestCase
935 $this->assertInstanceOf('Wallabag\CoreBundle\Entity\Entry', $entry); 952 $this->assertInstanceOf('Wallabag\CoreBundle\Entity\Entry', $entry);
936 $this->assertEquals($url, $entry->getUrl()); 953 $this->assertEquals($url, $entry->getUrl());
937 $this->assertContains('Perpignan', $entry->getTitle()); 954 $this->assertContains('Perpignan', $entry->getTitle());
938 $this->assertContains('/c4789a7f.jpeg', $entry->getContent()); 955 // instead of checking for the filename (which might change) check that the image is now local
956 $this->assertContains('http://v2.wallabag.org/assets/images/', $entry->getContent());
939 957
940 $client->getContainer()->get('craue_config')->set('download_images_enabled', 0); 958 $client->getContainer()->get('craue_config')->set('download_images_enabled', 0);
941 } 959 }
@@ -945,6 +963,7 @@ class EntryControllerTest extends WallabagCoreTestCase
945 */ 963 */
946 public function testRemoveEntryWithDownloadImagesEnabled() 964 public function testRemoveEntryWithDownloadImagesEnabled()
947 { 965 {
966 $this->downloadImagesEnabled = true;
948 $this->logInAs('admin'); 967 $this->logInAs('admin');
949 $client = $this->getClient(); 968 $client = $this->getClient();
950 969