aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/Wallabag/CoreBundle
diff options
context:
space:
mode:
authorJeremy Benoist <jeremy.benoist@gmail.com>2018-07-03 13:55:25 +0200
committerJeremy Benoist <jeremy.benoist@gmail.com>2018-07-03 13:55:25 +0200
commit44043ebe82a22470e2514d05efac324035ee809a (patch)
tree5ea40b62ce665a8bab6a3e280a47f3be11838e27 /tests/Wallabag/CoreBundle
parent11f15430ffc67e30f084cffc8e909ace87ce19e1 (diff)
parente586d65b64089fc1cc230a18c470aae3f45f91a6 (diff)
downloadwallabag-44043ebe82a22470e2514d05efac324035ee809a.tar.gz
wallabag-44043ebe82a22470e2514d05efac324035ee809a.tar.zst
wallabag-44043ebe82a22470e2514d05efac324035ee809a.zip
Merge remote-tracking branch 'origin/master' into 2.4
Diffstat (limited to 'tests/Wallabag/CoreBundle')
-rw-r--r--tests/Wallabag/CoreBundle/Command/CleanDuplicatesCommandTest.php2
-rw-r--r--tests/Wallabag/CoreBundle/Command/ReloadEntryCommandTest.php2
-rw-r--r--tests/Wallabag/CoreBundle/Controller/ConfigControllerTest.php8
-rw-r--r--tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php10
-rw-r--r--tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php1
-rw-r--r--tests/Wallabag/CoreBundle/Helper/DownloadImagesTest.php21
6 files changed, 32 insertions, 12 deletions
diff --git a/tests/Wallabag/CoreBundle/Command/CleanDuplicatesCommandTest.php b/tests/Wallabag/CoreBundle/Command/CleanDuplicatesCommandTest.php
index 38e8dd07..5ca9785d 100644
--- a/tests/Wallabag/CoreBundle/Command/CleanDuplicatesCommandTest.php
+++ b/tests/Wallabag/CoreBundle/Command/CleanDuplicatesCommandTest.php
@@ -60,7 +60,7 @@ class CleanDuplicatesCommandTest extends WallabagCoreTestCase
60 60
61 public function testDuplicate() 61 public function testDuplicate()
62 { 62 {
63 $url = 'http://www.lemonde.fr/sport/visuel/2017/05/05/rondelle-prison-blanchissage-comprendre-le-hockey-sur-glace_5122587_3242.html'; 63 $url = 'https://www.lemonde.fr/sport/visuel/2017/05/05/rondelle-prison-blanchissage-comprendre-le-hockey-sur-glace_5122587_3242.html';
64 $client = $this->getClient(); 64 $client = $this->getClient();
65 $em = $client->getContainer()->get('doctrine.orm.entity_manager'); 65 $em = $client->getContainer()->get('doctrine.orm.entity_manager');
66 66
diff --git a/tests/Wallabag/CoreBundle/Command/ReloadEntryCommandTest.php b/tests/Wallabag/CoreBundle/Command/ReloadEntryCommandTest.php
index 63c068b4..b13f6519 100644
--- a/tests/Wallabag/CoreBundle/Command/ReloadEntryCommandTest.php
+++ b/tests/Wallabag/CoreBundle/Command/ReloadEntryCommandTest.php
@@ -10,7 +10,7 @@ use Wallabag\CoreBundle\Entity\Entry;
10 10
11class ReloadEntryCommandTest extends WallabagCoreTestCase 11class ReloadEntryCommandTest extends WallabagCoreTestCase
12{ 12{
13 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'; 13 public $url = 'https://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';
14 14
15 /** 15 /**
16 * @var entry 16 * @var entry
diff --git a/tests/Wallabag/CoreBundle/Controller/ConfigControllerTest.php b/tests/Wallabag/CoreBundle/Controller/ConfigControllerTest.php
index e4bf0998..e07c57dd 100644
--- a/tests/Wallabag/CoreBundle/Controller/ConfigControllerTest.php
+++ b/tests/Wallabag/CoreBundle/Controller/ConfigControllerTest.php
@@ -742,7 +742,7 @@ class ConfigControllerTest extends WallabagCoreTestCase
742 $em->persist($tag); 742 $em->persist($tag);
743 743
744 $entry = new Entry($user); 744 $entry = new Entry($user);
745 $entry->setUrl('http://www.lemonde.fr/europe/article/2016/10/01/pour-le-psoe-chaque-election-s-est-transformee-en-une-agonie_5006476_3214.html'); 745 $entry->setUrl('https://www.lemonde.fr/europe/article/2016/10/01/pour-le-psoe-chaque-election-s-est-transformee-en-une-agonie_5006476_3214.html');
746 $entry->setContent('Youhou'); 746 $entry->setContent('Youhou');
747 $entry->setTitle('Youhou'); 747 $entry->setTitle('Youhou');
748 $entry->addTag($tag); 748 $entry->addTag($tag);
@@ -827,7 +827,7 @@ class ConfigControllerTest extends WallabagCoreTestCase
827 $em->persist($tag); 827 $em->persist($tag);
828 828
829 $entry = new Entry($user); 829 $entry = new Entry($user);
830 $entry->setUrl('http://www.lemonde.fr/europe/article/2016/10/01/pour-le-psoe-chaque-election-s-est-transformee-en-une-agonie_5006476_3214.html'); 830 $entry->setUrl('https://www.lemonde.fr/europe/article/2016/10/01/pour-le-psoe-chaque-election-s-est-transformee-en-une-agonie_5006476_3214.html');
831 $entry->setContent('Youhou'); 831 $entry->setContent('Youhou');
832 $entry->setTitle('Youhou'); 832 $entry->setTitle('Youhou');
833 $entry->addTag($tag); 833 $entry->addTag($tag);
@@ -845,7 +845,7 @@ class ConfigControllerTest extends WallabagCoreTestCase
845 $em->persist($tagArchived); 845 $em->persist($tagArchived);
846 846
847 $entryArchived = new Entry($user); 847 $entryArchived = new Entry($user);
848 $entryArchived->setUrl('http://www.lemonde.fr/europe/article/2016/10/01/pour-le-psoe-chaque-election-s-est-transformee-en-une-agonie_5006476_3214.html'); 848 $entryArchived->setUrl('https://www.lemonde.fr/europe/article/2016/10/01/pour-le-psoe-chaque-election-s-est-transformee-en-une-agonie_5006476_3214.html');
849 $entryArchived->setContent('Youhou'); 849 $entryArchived->setContent('Youhou');
850 $entryArchived->setTitle('Youhou'); 850 $entryArchived->setTitle('Youhou');
851 $entryArchived->addTag($tagArchived); 851 $entryArchived->addTag($tagArchived);
@@ -903,7 +903,7 @@ class ConfigControllerTest extends WallabagCoreTestCase
903 $em->persist($tag); 903 $em->persist($tag);
904 904
905 $entry = new Entry($user); 905 $entry = new Entry($user);
906 $entry->setUrl('http://www.lemonde.fr/europe/article/2016/10/01/pour-le-psoe-chaque-election-s-est-transformee-en-une-agonie_5006476_3214.html'); 906 $entry->setUrl('https://www.lemonde.fr/europe/article/2016/10/01/pour-le-psoe-chaque-election-s-est-transformee-en-une-agonie_5006476_3214.html');
907 $entry->setContent('Youhou'); 907 $entry->setContent('Youhou');
908 $entry->setTitle('Youhou'); 908 $entry->setTitle('Youhou');
909 $entry->addTag($tag); 909 $entry->addTag($tag);
diff --git a/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php b/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php
index 95482fe4..a436be79 100644
--- a/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php
+++ b/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php
@@ -11,9 +11,9 @@ use Wallabag\CoreBundle\Helper\ContentProxy;
11 11
12class EntryControllerTest extends WallabagCoreTestCase 12class EntryControllerTest extends WallabagCoreTestCase
13{ 13{
14 const AN_URL_CONTAINING_AN_ARTICLE_WITH_IMAGE = 'http://www.lemonde.fr/judo/article/2017/11/11/judo-la-decima-de-teddy-riner_5213605_1556020.html'; 14 const AN_URL_CONTAINING_AN_ARTICLE_WITH_IMAGE = 'https://www.lemonde.fr/judo/article/2017/11/11/judo-la-decima-de-teddy-riner_5213605_1556020.html';
15 public $downloadImagesEnabled = false; 15 public $downloadImagesEnabled = false;
16 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'; 16 public $url = 'https://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';
17 17
18 /** 18 /**
19 * @after 19 * @after
@@ -1143,7 +1143,7 @@ class EntryControllerTest extends WallabagCoreTestCase
1143 $client = $this->getClient(); 1143 $client = $this->getClient();
1144 1144
1145 $entry = new Entry($this->getLoggedInUser()); 1145 $entry = new Entry($this->getLoggedInUser());
1146 $entry->setUrl('http://www.lemonde.fr/incorrect-url/'); 1146 $entry->setUrl('https://www.lemonde.fr/incorrect-url/');
1147 $entry->setHttpStatus(404); 1147 $entry->setHttpStatus(404);
1148 $this->getEntityManager()->persist($entry); 1148 $this->getEntityManager()->persist($entry);
1149 1149
@@ -1342,8 +1342,8 @@ class EntryControllerTest extends WallabagCoreTestCase
1342 null, 1342 null,
1343 ], 1343 ],
1344 'es-ES' => [ 1344 'es-ES' => [
1345 'https://www.muylinux.com/2015/04/17/odf-reino-unido-microsoft-google/', 1345 'https://www.20minutos.es/noticia/3360685/0/gobierno-sanchez-primero-historia-mas-mujeres-que-hombres/',
1346 'es_ES', 1346 'es',
1347 ], 1347 ],
1348 ]; 1348 ];
1349 } 1349 }
diff --git a/tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php b/tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php
index 398592e1..51df8de1 100644
--- a/tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php
+++ b/tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php
@@ -11,7 +11,6 @@ use Symfony\Component\Validator\ConstraintViolation;
11use Symfony\Component\Validator\ConstraintViolationList; 11use Symfony\Component\Validator\ConstraintViolationList;
12use Symfony\Component\Validator\Validator\RecursiveValidator; 12use Symfony\Component\Validator\Validator\RecursiveValidator;
13use Wallabag\CoreBundle\Entity\Entry; 13use Wallabag\CoreBundle\Entity\Entry;
14use Wallabag\CoreBundle\Entity\Tag;
15use Wallabag\CoreBundle\Helper\ContentProxy; 14use Wallabag\CoreBundle\Helper\ContentProxy;
16use Wallabag\CoreBundle\Helper\RuleBasedTagger; 15use Wallabag\CoreBundle\Helper\RuleBasedTagger;
17use Wallabag\UserBundle\Entity\User; 16use Wallabag\UserBundle\Entity\User;
diff --git a/tests/Wallabag/CoreBundle/Helper/DownloadImagesTest.php b/tests/Wallabag/CoreBundle/Helper/DownloadImagesTest.php
index 0e1d296b..51ab1bcd 100644
--- a/tests/Wallabag/CoreBundle/Helper/DownloadImagesTest.php
+++ b/tests/Wallabag/CoreBundle/Helper/DownloadImagesTest.php
@@ -183,4 +183,25 @@ class DownloadImagesTest extends TestCase
183 $this->assertContains('http://wallabag.io/assets/images/9/b/9b0ead26/', $res, 'Content-Type was empty but data is ok for an image'); 183 $this->assertContains('http://wallabag.io/assets/images/9/b/9b0ead26/', $res, 'Content-Type was empty but data is ok for an image');
184 $this->assertContains('DownloadImages: Checking extension (alternative)', $logHandler->getRecords()[3]['message']); 184 $this->assertContains('DownloadImages: Checking extension (alternative)', $logHandler->getRecords()[3]['message']);
185 } 185 }
186
187 public function testProcessImageWithSrcset()
188 {
189 $client = new Client();
190
191 $mock = new Mock([
192 new Response(200, ['content-type' => 'image/jpeg'], Stream::factory(file_get_contents(__DIR__ . '/../fixtures/image-no-content-type.jpg'))),
193 new Response(200, ['content-type' => 'image/jpeg'], Stream::factory(file_get_contents(__DIR__ . '/../fixtures/image-no-content-type.jpg'))),
194 new Response(200, ['content-type' => 'image/jpeg'], Stream::factory(file_get_contents(__DIR__ . '/../fixtures/image-no-content-type.jpg'))),
195 ]);
196
197 $client->getEmitter()->attach($mock);
198
199 $logHandler = new TestHandler();
200 $logger = new Logger('test', [$logHandler]);
201
202 $download = new DownloadImages($client, sys_get_temp_dir() . '/wallabag_test', 'http://wallabag.io/', $logger);
203 $res = $download->processHtml(123, '<p><img class="alignnone wp-image-1153" src="http://piketty.blog.lemonde.fr/files/2017/10/F1FR-530x375.jpg" alt="" width="628" height="444" srcset="http://piketty.blog.lemonde.fr/files/2017/10/F1FR-530x375.jpg 530w, http://piketty.blog.lemonde.fr/files/2017/10/F1FR-768x543.jpg 768w, http://piketty.blog.lemonde.fr/files/2017/10/F1FR-900x636.jpg 900w" sizes="(max-width: 628px) 100vw, 628px" /></p>', 'http://piketty.blog.lemonde.fr/2017/10/12/budget-2018-la-jeunesse-sacrifiee/');
204
205 $this->assertNotContains('http://piketty.blog.lemonde.fr/', $res, 'Image srcset attribute were not replaced');
206 }
186} 207}