aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorJeremy Benoist <jeremy.benoist@gmail.com>2018-09-07 13:46:30 +0200
committerJeremy Benoist <jeremy.benoist@gmail.com>2018-09-07 13:46:30 +0200
commit7083c0a21d27e7e1bf45a9807a76844116d61fb8 (patch)
treeb72b5a0516d9114aeeccd6ecdb055ee240bda66a /tests
parent44043ebe82a22470e2514d05efac324035ee809a (diff)
parent495f83c92539444bff7dfd6cd647b7d65a74f949 (diff)
downloadwallabag-7083c0a21d27e7e1bf45a9807a76844116d61fb8.tar.gz
wallabag-7083c0a21d27e7e1bf45a9807a76844116d61fb8.tar.zst
wallabag-7083c0a21d27e7e1bf45a9807a76844116d61fb8.zip
Merge remote-tracking branch 'origin/master' into 2.4
Diffstat (limited to 'tests')
-rw-r--r--tests/Wallabag/ApiBundle/Controller/DeveloperControllerTest.php4
-rw-r--r--tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php30
-rw-r--r--tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php6
-rw-r--r--tests/Wallabag/CoreBundle/Controller/ExportControllerTest.php4
-rw-r--r--tests/Wallabag/CoreBundle/Controller/TagControllerTest.php2
-rw-r--r--tests/Wallabag/CoreBundle/Helper/DownloadImagesTest.php48
-rw-r--r--tests/Wallabag/ImportBundle/Controller/ChromeControllerTest.php2
-rw-r--r--tests/Wallabag/ImportBundle/Controller/FirefoxControllerTest.php10
-rw-r--r--tests/Wallabag/ImportBundle/Controller/InstapaperControllerTest.php4
-rw-r--r--tests/Wallabag/ImportBundle/Controller/PinboardControllerTest.php2
-rw-r--r--tests/Wallabag/ImportBundle/Controller/ReadabilityControllerTest.php2
-rw-r--r--tests/Wallabag/ImportBundle/Controller/WallabagV1ControllerTest.php2
-rw-r--r--tests/Wallabag/ImportBundle/Controller/WallabagV2ControllerTest.php4
-rw-r--r--tests/Wallabag/ImportBundle/fixtures/firefox-bookmarks.json4
-rw-r--r--tests/Wallabag/UserBundle/Mailer/AuthCodeMailerTest.php2
15 files changed, 85 insertions, 41 deletions
diff --git a/tests/Wallabag/ApiBundle/Controller/DeveloperControllerTest.php b/tests/Wallabag/ApiBundle/Controller/DeveloperControllerTest.php
index 35de47f9..f58d1c12 100644
--- a/tests/Wallabag/ApiBundle/Controller/DeveloperControllerTest.php
+++ b/tests/Wallabag/ApiBundle/Controller/DeveloperControllerTest.php
@@ -28,7 +28,7 @@ class DeveloperControllerTest extends WallabagCoreTestCase
28 $this->assertSame(200, $client->getResponse()->getStatusCode()); 28 $this->assertSame(200, $client->getResponse()->getStatusCode());
29 29
30 $newNbClients = $em->getRepository('WallabagApiBundle:Client')->findAll(); 30 $newNbClients = $em->getRepository('WallabagApiBundle:Client')->findAll();
31 $this->assertGreaterThan(count($nbClients), count($newNbClients)); 31 $this->assertGreaterThan(\count($nbClients), \count($newNbClients));
32 32
33 $this->assertGreaterThan(1, $alert = $crawler->filter('.settings ul li strong')->extract(['_text'])); 33 $this->assertGreaterThan(1, $alert = $crawler->filter('.settings ul li strong')->extract(['_text']));
34 $this->assertContains('My app', $alert[0]); 34 $this->assertContains('My app', $alert[0]);
@@ -65,7 +65,7 @@ class DeveloperControllerTest extends WallabagCoreTestCase
65 65
66 $crawler = $client->request('GET', '/developer'); 66 $crawler = $client->request('GET', '/developer');
67 $this->assertSame(200, $client->getResponse()->getStatusCode()); 67 $this->assertSame(200, $client->getResponse()->getStatusCode());
68 $this->assertSame(count($nbClients), $crawler->filter('ul[class=collapsible] li')->count()); 68 $this->assertSame(\count($nbClients), $crawler->filter('ul[class=collapsible] li')->count());
69 } 69 }
70 70
71 public function testDeveloperHowto() 71 public function testDeveloperHowto()
diff --git a/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php b/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php
index 9722986e..58b617f3 100644
--- a/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php
+++ b/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php
@@ -28,7 +28,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
28 28
29 $this->assertSame($entry->getTitle(), $content['title']); 29 $this->assertSame($entry->getTitle(), $content['title']);
30 $this->assertSame($entry->getUrl(), $content['url']); 30 $this->assertSame($entry->getUrl(), $content['url']);
31 $this->assertCount(count($entry->getTags()), $content['tags']); 31 $this->assertCount(\count($entry->getTags()), $content['tags']);
32 $this->assertSame($entry->getUserName(), $content['user_name']); 32 $this->assertSame($entry->getUserName(), $content['user_name']);
33 $this->assertSame($entry->getUserEmail(), $content['user_email']); 33 $this->assertSame($entry->getUserEmail(), $content['user_email']);
34 $this->assertSame($entry->getUserId(), $content['user_id']); 34 $this->assertSame($entry->getUserId(), $content['user_id']);
@@ -127,7 +127,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
127 127
128 $content = json_decode($this->client->getResponse()->getContent(), true); 128 $content = json_decode($this->client->getResponse()->getContent(), true);
129 129
130 $this->assertGreaterThanOrEqual(1, count($content)); 130 $this->assertGreaterThanOrEqual(1, \count($content));
131 $this->assertNotEmpty($content['_embedded']['items']); 131 $this->assertNotEmpty($content['_embedded']['items']);
132 $this->assertGreaterThanOrEqual(1, $content['total']); 132 $this->assertGreaterThanOrEqual(1, $content['total']);
133 $this->assertSame(1, $content['page']); 133 $this->assertSame(1, $content['page']);
@@ -154,7 +154,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
154 154
155 $content = json_decode($this->client->getResponse()->getContent(), true); 155 $content = json_decode($this->client->getResponse()->getContent(), true);
156 156
157 $this->assertGreaterThanOrEqual(1, count($content)); 157 $this->assertGreaterThanOrEqual(1, \count($content));
158 $this->assertArrayHasKey('items', $content['_embedded']); 158 $this->assertArrayHasKey('items', $content['_embedded']);
159 $this->assertGreaterThanOrEqual(0, $content['total']); 159 $this->assertGreaterThanOrEqual(0, $content['total']);
160 $this->assertSame(1, $content['page']); 160 $this->assertSame(1, $content['page']);
@@ -206,7 +206,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
206 206
207 $content = json_decode($this->client->getResponse()->getContent(), true); 207 $content = json_decode($this->client->getResponse()->getContent(), true);
208 208
209 $this->assertGreaterThanOrEqual(1, count($content)); 209 $this->assertGreaterThanOrEqual(1, \count($content));
210 $this->assertArrayHasKey('items', $content['_embedded']); 210 $this->assertArrayHasKey('items', $content['_embedded']);
211 $this->assertGreaterThanOrEqual(1, $content['total']); 211 $this->assertGreaterThanOrEqual(1, $content['total']);
212 $this->assertSame(1, $content['page']); 212 $this->assertSame(1, $content['page']);
@@ -250,7 +250,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
250 250
251 $content = json_decode($this->client->getResponse()->getContent(), true); 251 $content = json_decode($this->client->getResponse()->getContent(), true);
252 252
253 $this->assertGreaterThanOrEqual(1, count($content)); 253 $this->assertGreaterThanOrEqual(1, \count($content));
254 $this->assertNotEmpty($content['_embedded']['items']); 254 $this->assertNotEmpty($content['_embedded']['items']);
255 $this->assertGreaterThanOrEqual(1, $content['total']); 255 $this->assertGreaterThanOrEqual(1, $content['total']);
256 $this->assertSame(1, $content['page']); 256 $this->assertSame(1, $content['page']);
@@ -278,7 +278,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
278 278
279 $content = json_decode($this->client->getResponse()->getContent(), true); 279 $content = json_decode($this->client->getResponse()->getContent(), true);
280 280
281 $this->assertGreaterThanOrEqual(1, count($content)); 281 $this->assertGreaterThanOrEqual(1, \count($content));
282 $this->assertNotEmpty($content['_embedded']['items']); 282 $this->assertNotEmpty($content['_embedded']['items']);
283 $this->assertGreaterThanOrEqual(1, $content['total']); 283 $this->assertGreaterThanOrEqual(1, $content['total']);
284 $this->assertSame(1, $content['page']); 284 $this->assertSame(1, $content['page']);
@@ -305,7 +305,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
305 305
306 $content = json_decode($this->client->getResponse()->getContent(), true); 306 $content = json_decode($this->client->getResponse()->getContent(), true);
307 307
308 $this->assertGreaterThanOrEqual(1, count($content)); 308 $this->assertGreaterThanOrEqual(1, \count($content));
309 $this->assertNotEmpty($content['_embedded']['items']); 309 $this->assertNotEmpty($content['_embedded']['items']);
310 $this->assertGreaterThanOrEqual(1, $content['total']); 310 $this->assertGreaterThanOrEqual(1, $content['total']);
311 $this->assertSame(1, $content['page']); 311 $this->assertSame(1, $content['page']);
@@ -342,7 +342,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
342 342
343 $content = json_decode($this->client->getResponse()->getContent(), true); 343 $content = json_decode($this->client->getResponse()->getContent(), true);
344 344
345 $this->assertGreaterThanOrEqual(1, count($content)); 345 $this->assertGreaterThanOrEqual(1, \count($content));
346 $this->assertNotEmpty($content['_embedded']['items']); 346 $this->assertNotEmpty($content['_embedded']['items']);
347 $this->assertGreaterThanOrEqual(1, $content['total']); 347 $this->assertGreaterThanOrEqual(1, $content['total']);
348 $this->assertSame(1, $content['page']); 348 $this->assertSame(1, $content['page']);
@@ -370,7 +370,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
370 370
371 $content = json_decode($this->client->getResponse()->getContent(), true); 371 $content = json_decode($this->client->getResponse()->getContent(), true);
372 372
373 $this->assertGreaterThanOrEqual(1, count($content)); 373 $this->assertGreaterThanOrEqual(1, \count($content));
374 $this->assertEmpty($content['_embedded']['items']); 374 $this->assertEmpty($content['_embedded']['items']);
375 $this->assertSame(0, $content['total']); 375 $this->assertSame(0, $content['total']);
376 $this->assertSame(1, $content['page']); 376 $this->assertSame(1, $content['page']);
@@ -608,7 +608,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
608 $this->assertSame($entry->getId(), $content['id']); 608 $this->assertSame($entry->getId(), $content['id']);
609 $this->assertSame($entry->getUrl(), $content['url']); 609 $this->assertSame($entry->getUrl(), $content['url']);
610 $this->assertSame('New awesome title', $content['title']); 610 $this->assertSame('New awesome title', $content['title']);
611 $this->assertGreaterThanOrEqual(1, count($content['tags']), 'We force only one tag'); 611 $this->assertGreaterThanOrEqual(1, \count($content['tags']), 'We force only one tag');
612 $this->assertSame(1, $content['user_id']); 612 $this->assertSame(1, $content['user_id']);
613 $this->assertSame('de_AT', $content['language']); 613 $this->assertSame('de_AT', $content['language']);
614 $this->assertSame('http://preview.io/picture.jpg', $content['preview_picture']); 614 $this->assertSame('http://preview.io/picture.jpg', $content['preview_picture']);
@@ -647,7 +647,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
647 647
648 $this->assertSame($entry->getId(), $content['id']); 648 $this->assertSame($entry->getId(), $content['id']);
649 $this->assertSame($entry->getUrl(), $content['url']); 649 $this->assertSame($entry->getUrl(), $content['url']);
650 $this->assertGreaterThanOrEqual(1, count($content['tags']), 'We force only one tag'); 650 $this->assertGreaterThanOrEqual(1, \count($content['tags']), 'We force only one tag');
651 $this->assertEmpty($content['published_by'], 'Authors were not saved because of an array instead of a string'); 651 $this->assertEmpty($content['published_by'], 'Authors were not saved because of an array instead of a string');
652 $this->assertSame($previousContent, $content['content'], 'Ensure content has not moved'); 652 $this->assertSame($previousContent, $content['content'], 'Ensure content has not moved');
653 $this->assertSame($previousLanguage, $content['language'], 'Ensure language has not moved'); 653 $this->assertSame($previousLanguage, $content['language'], 'Ensure language has not moved');
@@ -772,7 +772,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
772 $this->markTestSkipped('No content found in db.'); 772 $this->markTestSkipped('No content found in db.');
773 } 773 }
774 774
775 $nbTags = count($entry->getTags()); 775 $nbTags = \count($entry->getTags());
776 776
777 $newTags = 'tag1,tag2,tag3'; 777 $newTags = 'tag1,tag2,tag3';
778 778
@@ -783,7 +783,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
783 $content = json_decode($this->client->getResponse()->getContent(), true); 783 $content = json_decode($this->client->getResponse()->getContent(), true);
784 784
785 $this->assertArrayHasKey('tags', $content); 785 $this->assertArrayHasKey('tags', $content);
786 $this->assertSame($nbTags + 3, count($content['tags'])); 786 $this->assertSame($nbTags + 3, \count($content['tags']));
787 787
788 $entryDB = $this->client->getContainer() 788 $entryDB = $this->client->getContainer()
789 ->get('doctrine.orm.entity_manager') 789 ->get('doctrine.orm.entity_manager')
@@ -813,7 +813,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
813 } 813 }
814 814
815 // hydrate the tags relations 815 // hydrate the tags relations
816 $nbTags = count($entry->getTags()); 816 $nbTags = \count($entry->getTags());
817 $tag = $entry->getTags()[0]; 817 $tag = $entry->getTags()[0];
818 818
819 $this->client->request('DELETE', '/api/entries/' . $entry->getId() . '/tags/' . $tag->getId() . '.json'); 819 $this->client->request('DELETE', '/api/entries/' . $entry->getId() . '/tags/' . $tag->getId() . '.json');
@@ -823,7 +823,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
823 $content = json_decode($this->client->getResponse()->getContent(), true); 823 $content = json_decode($this->client->getResponse()->getContent(), true);
824 824
825 $this->assertArrayHasKey('tags', $content); 825 $this->assertArrayHasKey('tags', $content);
826 $this->assertSame($nbTags - 1, count($content['tags'])); 826 $this->assertSame($nbTags - 1, \count($content['tags']));
827 } 827 }
828 828
829 public function testSaveIsArchivedAfterPost() 829 public function testSaveIsArchivedAfterPost()
diff --git a/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php b/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php
index a436be79..6a4c775b 100644
--- a/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php
+++ b/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php
@@ -524,7 +524,7 @@ class EntryControllerTest extends WallabagCoreTestCase
524 524
525 $this->assertGreaterThan(1, $title = $crawler->filter('div[id=article] h1')->extract(['_text'])); 525 $this->assertGreaterThan(1, $title = $crawler->filter('div[id=article] h1')->extract(['_text']));
526 $this->assertContains('My updated title hehe :)', $title[0]); 526 $this->assertContains('My updated title hehe :)', $title[0]);
527 $this->assertSame(1, count($stats = $crawler->filter('div[class=tools] ul[class=stats] li a[class=tool]')->extract(['_text']))); 527 $this->assertSame(1, \count($stats = $crawler->filter('div[class=tools] ul[class=stats] li a[class=tool]')->extract(['_text'])));
528 $this->assertNotContains('example.io', trim($stats[0])); 528 $this->assertNotContains('example.io', trim($stats[0]));
529 } 529 }
530 530
@@ -1325,10 +1325,6 @@ class EntryControllerTest extends WallabagCoreTestCase
1325 'http://www.hao123.com/shequ?__noscript__-=1', 1325 'http://www.hao123.com/shequ?__noscript__-=1',
1326 'zh_CN', 1326 'zh_CN',
1327 ], 1327 ],
1328 'de_AT' => [
1329 'https://buy.garmin.com/de-AT/AT/catalog/product/compareResult.ep?compareProduct=112885&compareProduct=36728',
1330 'de_AT',
1331 ],
1332 'ru_RU' => [ 1328 'ru_RU' => [
1333 'http://netler.ru/ikt/windows-error-reporting.htm', 1329 'http://netler.ru/ikt/windows-error-reporting.htm',
1334 'ru_RU', 1330 'ru_RU',
diff --git a/tests/Wallabag/CoreBundle/Controller/ExportControllerTest.php b/tests/Wallabag/CoreBundle/Controller/ExportControllerTest.php
index ab7f23cc..6f3308e5 100644
--- a/tests/Wallabag/CoreBundle/Controller/ExportControllerTest.php
+++ b/tests/Wallabag/CoreBundle/Controller/ExportControllerTest.php
@@ -180,7 +180,7 @@ class ExportControllerTest extends WallabagCoreTestCase
180 180
181 $this->assertGreaterThan(1, $csv); 181 $this->assertGreaterThan(1, $csv);
182 // +1 for title line 182 // +1 for title line
183 $this->assertSame(count($contentInDB) + 1, count($csv)); 183 $this->assertSame(\count($contentInDB) + 1, \count($csv));
184 $this->assertSame('Title;URL;Content;Tags;"MIME Type";Language;"Creation date"', $csv[0]); 184 $this->assertSame('Title;URL;Content;Tags;"MIME Type";Language;"Creation date"', $csv[0]);
185 $this->assertContains($contentInDB[0]['title'], $csv[1]); 185 $this->assertContains($contentInDB[0]['title'], $csv[1]);
186 $this->assertContains($contentInDB[0]['url'], $csv[1]); 186 $this->assertContains($contentInDB[0]['url'], $csv[1]);
@@ -272,7 +272,7 @@ class ExportControllerTest extends WallabagCoreTestCase
272 272
273 $content = new \SimpleXMLElement($client->getResponse()->getContent()); 273 $content = new \SimpleXMLElement($client->getResponse()->getContent());
274 $this->assertGreaterThan(0, $content->count()); 274 $this->assertGreaterThan(0, $content->count());
275 $this->assertSame(count($contentInDB), $content->count()); 275 $this->assertSame(\count($contentInDB), $content->count());
276 $this->assertNotEmpty('id', (string) $content->entry[0]->id); 276 $this->assertNotEmpty('id', (string) $content->entry[0]->id);
277 $this->assertNotEmpty('title', (string) $content->entry[0]->title); 277 $this->assertNotEmpty('title', (string) $content->entry[0]->title);
278 $this->assertNotEmpty('url', (string) $content->entry[0]->url); 278 $this->assertNotEmpty('url', (string) $content->entry[0]->url);
diff --git a/tests/Wallabag/CoreBundle/Controller/TagControllerTest.php b/tests/Wallabag/CoreBundle/Controller/TagControllerTest.php
index 5a973a7e..768f4c07 100644
--- a/tests/Wallabag/CoreBundle/Controller/TagControllerTest.php
+++ b/tests/Wallabag/CoreBundle/Controller/TagControllerTest.php
@@ -98,7 +98,7 @@ class TagControllerTest extends WallabagCoreTestCase
98 $tags[$key] = $tag->getLabel(); 98 $tags[$key] = $tag->getLabel();
99 } 99 }
100 100
101 $this->assertGreaterThanOrEqual(2, count($tags)); 101 $this->assertGreaterThanOrEqual(2, \count($tags));
102 $this->assertNotFalse(array_search('foo2', $tags, true), 'Tag foo2 is assigned to the entry'); 102 $this->assertNotFalse(array_search('foo2', $tags, true), 'Tag foo2 is assigned to the entry');
103 $this->assertNotFalse(array_search('bar2', $tags, true), 'Tag bar2 is assigned to the entry'); 103 $this->assertNotFalse(array_search('bar2', $tags, true), 'Tag bar2 is assigned to the entry');
104 } 104 }
diff --git a/tests/Wallabag/CoreBundle/Helper/DownloadImagesTest.php b/tests/Wallabag/CoreBundle/Helper/DownloadImagesTest.php
index 51ab1bcd..cda5f843 100644
--- a/tests/Wallabag/CoreBundle/Helper/DownloadImagesTest.php
+++ b/tests/Wallabag/CoreBundle/Helper/DownloadImagesTest.php
@@ -204,4 +204,52 @@ class DownloadImagesTest extends TestCase
204 204
205 $this->assertNotContains('http://piketty.blog.lemonde.fr/', $res, 'Image srcset attribute were not replaced'); 205 $this->assertNotContains('http://piketty.blog.lemonde.fr/', $res, 'Image srcset attribute were not replaced');
206 } 206 }
207
208 public function testProcessImageWithTrickySrcset()
209 {
210 $client = new Client();
211
212 $mock = new Mock([
213 new Response(200, ['content-type' => 'image/jpeg'], Stream::factory(file_get_contents(__DIR__ . '/../fixtures/image-no-content-type.jpg'))),
214 new Response(200, ['content-type' => 'image/jpeg'], Stream::factory(file_get_contents(__DIR__ . '/../fixtures/image-no-content-type.jpg'))),
215 new Response(200, ['content-type' => 'image/jpeg'], Stream::factory(file_get_contents(__DIR__ . '/../fixtures/image-no-content-type.jpg'))),
216 ]);
217
218 $client->getEmitter()->attach($mock);
219
220 $logHandler = new TestHandler();
221 $logger = new Logger('test', [$logHandler]);
222
223 $download = new DownloadImages($client, sys_get_temp_dir() . '/wallabag_test', 'http://wallabag.io/', $logger);
224 $res = $download->processHtml(123, '<figure id="post-257260" class="align-none media-257260"><img src="https://cdn.css-tricks.com/wp-content/uploads/2017/08/the-critical-request.png" srcset="https://res.cloudinary.com/css-tricks/image/upload/c_scale,w_1000,f_auto,q_auto/v1501594717/the-critical-request_bqdfaa.png 1000w, https://res.cloudinary.com/css-tricks/image/upload/c_scale,w_200,f_auto,q_auto/v1501594717/the-critical-request_bqdfaa.png 200w" sizes="(min-width: 1850px) calc( (100vw - 555px) / 3 )
225 (min-width: 1251px) calc( (100vw - 530px) / 2 )
226 (min-width: 1086px) calc(100vw - 480px)
227 (min-width: 626px) calc(100vw - 335px)
228 calc(100vw - 30px)" alt="" /></figure>', 'https://css-tricks.com/the-critical-request/');
229
230 $this->assertNotContains('f_auto,q_auto', $res, 'Image srcset attribute were not replaced');
231 }
232
233 public function testProcessImageWithNullPath()
234 {
235 $client = new Client();
236
237 $mock = new Mock([
238 new Response(200, ['content-type' => null], Stream::factory(file_get_contents(__DIR__ . '/../fixtures/image-no-content-type.jpg'))),
239 ]);
240
241 $client->getEmitter()->attach($mock);
242
243 $logHandler = new TestHandler();
244 $logger = new Logger('test', [$logHandler]);
245
246 $download = new DownloadImages($client, sys_get_temp_dir() . '/wallabag_test', 'http://wallabag.io/', $logger);
247
248 $res = $download->processSingleImage(
249 123,
250 null,
251 'https://framablog.org/2018/06/30/engagement-atypique/'
252 );
253 $this->assertFalse($res);
254 }
207} 255}
diff --git a/tests/Wallabag/ImportBundle/Controller/ChromeControllerTest.php b/tests/Wallabag/ImportBundle/Controller/ChromeControllerTest.php
index ddb7a65a..cd3e41e9 100644
--- a/tests/Wallabag/ImportBundle/Controller/ChromeControllerTest.php
+++ b/tests/Wallabag/ImportBundle/Controller/ChromeControllerTest.php
@@ -121,7 +121,7 @@ class ChromeControllerTest extends WallabagCoreTestCase
121 $this->assertInstanceOf('Wallabag\CoreBundle\Entity\Entry', $content); 121 $this->assertInstanceOf('Wallabag\CoreBundle\Entity\Entry', $content);
122 $this->assertNotEmpty($content->getPreviewPicture(), 'Preview picture for http://www.usinenouvelle.com is ok'); 122 $this->assertNotEmpty($content->getPreviewPicture(), 'Preview picture for http://www.usinenouvelle.com is ok');
123 $this->assertNotEmpty($content->getLanguage(), 'Language for http://www.usinenouvelle.com is ok'); 123 $this->assertNotEmpty($content->getLanguage(), 'Language for http://www.usinenouvelle.com is ok');
124 $this->assertSame(1, count($content->getTags())); 124 $this->assertSame(1, \count($content->getTags()));
125 125
126 $createdAt = $content->getCreatedAt(); 126 $createdAt = $content->getCreatedAt();
127 $this->assertSame('2011', $createdAt->format('Y')); 127 $this->assertSame('2011', $createdAt->format('Y'));
diff --git a/tests/Wallabag/ImportBundle/Controller/FirefoxControllerTest.php b/tests/Wallabag/ImportBundle/Controller/FirefoxControllerTest.php
index dc9d9a8f..dc5ed6d0 100644
--- a/tests/Wallabag/ImportBundle/Controller/FirefoxControllerTest.php
+++ b/tests/Wallabag/ImportBundle/Controller/FirefoxControllerTest.php
@@ -122,20 +122,20 @@ class FirefoxControllerTest extends WallabagCoreTestCase
122 $this->assertNotEmpty($content->getMimetype(), 'Mimetype for http://lexpansion.lexpress.fr is ok'); 122 $this->assertNotEmpty($content->getMimetype(), 'Mimetype for http://lexpansion.lexpress.fr is ok');
123 $this->assertNotEmpty($content->getPreviewPicture(), 'Preview picture for http://lexpansion.lexpress.fr is ok'); 123 $this->assertNotEmpty($content->getPreviewPicture(), 'Preview picture for http://lexpansion.lexpress.fr is ok');
124 $this->assertNotEmpty($content->getLanguage(), 'Language for http://lexpansion.lexpress.fr is ok'); 124 $this->assertNotEmpty($content->getLanguage(), 'Language for http://lexpansion.lexpress.fr is ok');
125 $this->assertSame(3, count($content->getTags())); 125 $this->assertSame(3, \count($content->getTags()));
126 126
127 $content = $client->getContainer() 127 $content = $client->getContainer()
128 ->get('doctrine.orm.entity_manager') 128 ->get('doctrine.orm.entity_manager')
129 ->getRepository('WallabagCoreBundle:Entry') 129 ->getRepository('WallabagCoreBundle:Entry')
130 ->findByUrlAndUserId( 130 ->findByUrlAndUserId(
131 'https://stackoverflow.com/questions/15017163/parser-for-exported-bookmarks-html-file-of-google-chrome-and-mozilla-in-java', 131 'https://www.lemonde.fr/disparitions/article/2018/07/05/le-journaliste-et-cineaste-claude-lanzmann-est-mort_5326313_3382.html',
132 $this->getLoggedInUserId() 132 $this->getLoggedInUserId()
133 ); 133 );
134 134
135 $this->assertInstanceOf('Wallabag\CoreBundle\Entity\Entry', $content); 135 $this->assertInstanceOf('Wallabag\CoreBundle\Entity\Entry', $content);
136 $this->assertNotEmpty($content->getMimetype(), 'Mimetype for https://stackoverflow.com is ok'); 136 $this->assertNotEmpty($content->getMimetype(), 'Mimetype for https://www.lemonde.fr is ok');
137 $this->assertNotEmpty($content->getPreviewPicture(), 'Preview picture for https://stackoverflow.com is ok'); 137 $this->assertNotEmpty($content->getPreviewPicture(), 'Preview picture for https://www.lemonde.fr is ok');
138 $this->assertEmpty($content->getLanguage(), 'Language for https://stackoverflow.com is ok'); 138 $this->assertNotEmpty($content->getLanguage(), 'Language for https://www.lemonde.fr is ok');
139 139
140 $createdAt = $content->getCreatedAt(); 140 $createdAt = $content->getCreatedAt();
141 $this->assertSame('2013', $createdAt->format('Y')); 141 $this->assertSame('2013', $createdAt->format('Y'));
diff --git a/tests/Wallabag/ImportBundle/Controller/InstapaperControllerTest.php b/tests/Wallabag/ImportBundle/Controller/InstapaperControllerTest.php
index dacdf488..80bfc3b4 100644
--- a/tests/Wallabag/ImportBundle/Controller/InstapaperControllerTest.php
+++ b/tests/Wallabag/ImportBundle/Controller/InstapaperControllerTest.php
@@ -122,7 +122,7 @@ class InstapaperControllerTest extends WallabagCoreTestCase
122 $this->assertNotEmpty($content->getPreviewPicture(), 'Preview picture for http://www.liberation.fr is ok'); 122 $this->assertNotEmpty($content->getPreviewPicture(), 'Preview picture for http://www.liberation.fr is ok');
123 $this->assertNotEmpty($content->getLanguage(), 'Language for http://www.liberation.fr is ok'); 123 $this->assertNotEmpty($content->getLanguage(), 'Language for http://www.liberation.fr is ok');
124 $this->assertContains('foot', $content->getTags(), 'It includes the "foot" tag'); 124 $this->assertContains('foot', $content->getTags(), 'It includes the "foot" tag');
125 $this->assertSame(1, count($content->getTags())); 125 $this->assertSame(1, \count($content->getTags()));
126 $this->assertInstanceOf(\DateTime::class, $content->getCreatedAt()); 126 $this->assertInstanceOf(\DateTime::class, $content->getCreatedAt());
127 127
128 $content = $client->getContainer() 128 $content = $client->getContainer()
@@ -136,7 +136,7 @@ class InstapaperControllerTest extends WallabagCoreTestCase
136 $this->assertContains('foot', $content->getTags()); 136 $this->assertContains('foot', $content->getTags());
137 $this->assertContains('test_tag', $content->getTags()); 137 $this->assertContains('test_tag', $content->getTags());
138 138
139 $this->assertSame(2, count($content->getTags())); 139 $this->assertSame(2, \count($content->getTags()));
140 } 140 }
141 141
142 public function testImportInstapaperWithFileAndMarkAllAsRead() 142 public function testImportInstapaperWithFileAndMarkAllAsRead()
diff --git a/tests/Wallabag/ImportBundle/Controller/PinboardControllerTest.php b/tests/Wallabag/ImportBundle/Controller/PinboardControllerTest.php
index 1135f32e..80819f45 100644
--- a/tests/Wallabag/ImportBundle/Controller/PinboardControllerTest.php
+++ b/tests/Wallabag/ImportBundle/Controller/PinboardControllerTest.php
@@ -127,7 +127,7 @@ class PinboardControllerTest extends WallabagCoreTestCase
127 $this->assertContains('foot', $tags, 'It includes the "foot" tag'); 127 $this->assertContains('foot', $tags, 'It includes the "foot" tag');
128 $this->assertContains('varnish', $tags, 'It includes the "varnish" tag'); 128 $this->assertContains('varnish', $tags, 'It includes the "varnish" tag');
129 $this->assertContains('php', $tags, 'It includes the "php" tag'); 129 $this->assertContains('php', $tags, 'It includes the "php" tag');
130 $this->assertSame(3, count($tags)); 130 $this->assertSame(3, \count($tags));
131 131
132 $this->assertInstanceOf(\DateTime::class, $content->getCreatedAt()); 132 $this->assertInstanceOf(\DateTime::class, $content->getCreatedAt());
133 $this->assertSame('2016-10-26', $content->getCreatedAt()->format('Y-m-d')); 133 $this->assertSame('2016-10-26', $content->getCreatedAt()->format('Y-m-d'));
diff --git a/tests/Wallabag/ImportBundle/Controller/ReadabilityControllerTest.php b/tests/Wallabag/ImportBundle/Controller/ReadabilityControllerTest.php
index 78816ad8..5619659a 100644
--- a/tests/Wallabag/ImportBundle/Controller/ReadabilityControllerTest.php
+++ b/tests/Wallabag/ImportBundle/Controller/ReadabilityControllerTest.php
@@ -125,7 +125,7 @@ class ReadabilityControllerTest extends WallabagCoreTestCase
125 125
126 $tags = $content->getTags(); 126 $tags = $content->getTags();
127 $this->assertContains('foot', $tags, 'It includes the "foot" tag'); 127 $this->assertContains('foot', $tags, 'It includes the "foot" tag');
128 $this->assertSame(1, count($tags)); 128 $this->assertSame(1, \count($tags));
129 129
130 $this->assertInstanceOf(\DateTime::class, $content->getCreatedAt()); 130 $this->assertInstanceOf(\DateTime::class, $content->getCreatedAt());
131 $this->assertSame('2016-09-08', $content->getCreatedAt()->format('Y-m-d')); 131 $this->assertSame('2016-09-08', $content->getCreatedAt()->format('Y-m-d'));
diff --git a/tests/Wallabag/ImportBundle/Controller/WallabagV1ControllerTest.php b/tests/Wallabag/ImportBundle/Controller/WallabagV1ControllerTest.php
index e0e309b0..c67941a7 100644
--- a/tests/Wallabag/ImportBundle/Controller/WallabagV1ControllerTest.php
+++ b/tests/Wallabag/ImportBundle/Controller/WallabagV1ControllerTest.php
@@ -127,7 +127,7 @@ class WallabagV1ControllerTest extends WallabagCoreTestCase
127 $tags = $content->getTags(); 127 $tags = $content->getTags();
128 $this->assertContains('foot', $tags, 'It includes the "foot" tag'); 128 $this->assertContains('foot', $tags, 'It includes the "foot" tag');
129 $this->assertContains('framabag', $tags, 'It includes the "framabag" tag'); 129 $this->assertContains('framabag', $tags, 'It includes the "framabag" tag');
130 $this->assertSame(2, count($tags)); 130 $this->assertSame(2, \count($tags));
131 131
132 $this->assertInstanceOf(\DateTime::class, $content->getCreatedAt()); 132 $this->assertInstanceOf(\DateTime::class, $content->getCreatedAt());
133 } 133 }
diff --git a/tests/Wallabag/ImportBundle/Controller/WallabagV2ControllerTest.php b/tests/Wallabag/ImportBundle/Controller/WallabagV2ControllerTest.php
index e52b9c85..67490714 100644
--- a/tests/Wallabag/ImportBundle/Controller/WallabagV2ControllerTest.php
+++ b/tests/Wallabag/ImportBundle/Controller/WallabagV2ControllerTest.php
@@ -128,7 +128,7 @@ class WallabagV2ControllerTest extends WallabagCoreTestCase
128 128
129 $tags = $content->getTags(); 129 $tags = $content->getTags();
130 $this->assertContains('foot', $tags, 'It includes the "foot" tag'); 130 $this->assertContains('foot', $tags, 'It includes the "foot" tag');
131 $this->assertSame(1, count($tags)); 131 $this->assertSame(1, \count($tags));
132 132
133 $content = $client->getContainer() 133 $content = $client->getContainer()
134 ->get('doctrine.orm.entity_manager') 134 ->get('doctrine.orm.entity_manager')
@@ -147,7 +147,7 @@ class WallabagV2ControllerTest extends WallabagCoreTestCase
147 $this->assertContains('foot', $tags, 'It includes the "foot" tag'); 147 $this->assertContains('foot', $tags, 'It includes the "foot" tag');
148 $this->assertContains('mediapart', $tags, 'It includes the "mediapart" tag'); 148 $this->assertContains('mediapart', $tags, 'It includes the "mediapart" tag');
149 $this->assertContains('blog', $tags, 'It includes the "blog" tag'); 149 $this->assertContains('blog', $tags, 'It includes the "blog" tag');
150 $this->assertSame(3, count($tags)); 150 $this->assertSame(3, \count($tags));
151 151
152 $this->assertInstanceOf(\DateTime::class, $content->getCreatedAt()); 152 $this->assertInstanceOf(\DateTime::class, $content->getCreatedAt());
153 $this->assertSame('2016-09-08', $content->getCreatedAt()->format('Y-m-d')); 153 $this->assertSame('2016-09-08', $content->getCreatedAt()->format('Y-m-d'));
diff --git a/tests/Wallabag/ImportBundle/fixtures/firefox-bookmarks.json b/tests/Wallabag/ImportBundle/fixtures/firefox-bookmarks.json
index 406b5697..3d90b489 100644
--- a/tests/Wallabag/ImportBundle/fixtures/firefox-bookmarks.json
+++ b/tests/Wallabag/ImportBundle/fixtures/firefox-bookmarks.json
@@ -39,13 +39,13 @@
39 }, 39 },
40 { 40 {
41 "guid": "E385l9vZ_LVn", 41 "guid": "E385l9vZ_LVn",
42 "title": "Parser for Exported Bookmarks HTML file of Google Chrome and Mozilla in Java", 42 "title": "Le journaliste et cinéaste Claude Lanzmann est mort",
43 "index": 1, 43 "index": 1,
44 "dateAdded": 1388166091544000, 44 "dateAdded": 1388166091544000,
45 "lastModified": 1388166091545000, 45 "lastModified": 1388166091545000,
46 "id": 5, 46 "id": 5,
47 "type": "text/x-moz-place", 47 "type": "text/x-moz-place",
48 "uri": "http://stackoverflow.com/questions/15017163/parser-for-exported-bookmarks-html-file-of-google-chrome-and-mozilla-in-java" 48 "uri": "https://www.lemonde.fr/disparitions/article/2018/07/05/le-journaliste-et-cineaste-claude-lanzmann-est-mort_5326313_3382.html"
49 } 49 }
50 ] 50 ]
51 }, 51 },
diff --git a/tests/Wallabag/UserBundle/Mailer/AuthCodeMailerTest.php b/tests/Wallabag/UserBundle/Mailer/AuthCodeMailerTest.php
index f39fa60e..aa176068 100644
--- a/tests/Wallabag/UserBundle/Mailer/AuthCodeMailerTest.php
+++ b/tests/Wallabag/UserBundle/Mailer/AuthCodeMailerTest.php
@@ -13,7 +13,7 @@ final class CountableMemorySpool extends \Swift_MemorySpool implements \Countabl
13{ 13{
14 public function count() 14 public function count()
15 { 15 {
16 return count($this->messages); 16 return \count($this->messages);
17 } 17 }
18 18
19 public function getMessages() 19 public function getMessages()