aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/Wallabag
diff options
context:
space:
mode:
Diffstat (limited to 'tests/Wallabag')
-rw-r--r--tests/Wallabag/ApiBundle/Controller/DeveloperControllerTest.php4
-rw-r--r--tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php64
-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.php35
-rw-r--r--tests/Wallabag/CoreBundle/Controller/ExportControllerTest.php4
-rw-r--r--tests/Wallabag/CoreBundle/Controller/SecurityControllerTest.php12
-rw-r--r--tests/Wallabag/CoreBundle/Controller/TagControllerTest.php2
-rw-r--r--tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php245
-rw-r--r--tests/Wallabag/CoreBundle/Helper/DownloadImagesTest.php69
-rw-r--r--tests/Wallabag/CoreBundle/Tools/UtilsTest.php2
-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.php16
-rw-r--r--tests/Wallabag/ImportBundle/Controller/PinboardControllerTest.php2
-rw-r--r--tests/Wallabag/ImportBundle/Controller/ReadabilityControllerTest.php10
-rw-r--r--tests/Wallabag/ImportBundle/Controller/WallabagV1ControllerTest.php2
-rw-r--r--tests/Wallabag/ImportBundle/Controller/WallabagV2ControllerTest.php12
-rw-r--r--tests/Wallabag/ImportBundle/fixtures/firefox-bookmarks.json4
-rw-r--r--tests/Wallabag/ImportBundle/fixtures/instapaper-export.csv4
-rw-r--r--tests/Wallabag/ImportBundle/fixtures/readability.json4
-rw-r--r--tests/Wallabag/ImportBundle/fixtures/wallabag-v2.json2
-rw-r--r--tests/Wallabag/UserBundle/Mailer/AuthCodeMailerTest.php2
24 files changed, 420 insertions, 99 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 2e9b9305..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']);
@@ -419,7 +419,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
419 public function testPostEntry() 419 public function testPostEntry()
420 { 420 {
421 $this->client->request('POST', '/api/entries.json', [ 421 $this->client->request('POST', '/api/entries.json', [
422 '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', 422 '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',
423 'tags' => 'google', 423 'tags' => 'google',
424 'title' => 'New title for my article', 424 'title' => 'New title for my article',
425 'content' => 'my content', 425 'content' => 'my content',
@@ -434,7 +434,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
434 $content = json_decode($this->client->getResponse()->getContent(), true); 434 $content = json_decode($this->client->getResponse()->getContent(), true);
435 435
436 $this->assertGreaterThan(0, $content['id']); 436 $this->assertGreaterThan(0, $content['id']);
437 $this->assertSame('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', $content['url']); 437 $this->assertSame('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', $content['url']);
438 $this->assertSame(0, $content['is_archived']); 438 $this->assertSame(0, $content['is_archived']);
439 $this->assertSame(0, $content['is_starred']); 439 $this->assertSame(0, $content['is_starred']);
440 $this->assertNull($content['starred_at']); 440 $this->assertNull($content['starred_at']);
@@ -455,7 +455,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
455 { 455 {
456 $em = $this->client->getContainer()->get('doctrine.orm.entity_manager'); 456 $em = $this->client->getContainer()->get('doctrine.orm.entity_manager');
457 $entry = new Entry($em->getReference(User::class, 1)); 457 $entry = new Entry($em->getReference(User::class, 1));
458 $entry->setUrl('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'); 458 $entry->setUrl('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');
459 $entry->setArchived(true); 459 $entry->setArchived(true);
460 $entry->addTag((new Tag())->setLabel('google')); 460 $entry->addTag((new Tag())->setLabel('google'));
461 $entry->addTag((new Tag())->setLabel('apple')); 461 $entry->addTag((new Tag())->setLabel('apple'));
@@ -464,7 +464,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
464 $em->clear(); 464 $em->clear();
465 465
466 $this->client->request('POST', '/api/entries.json', [ 466 $this->client->request('POST', '/api/entries.json', [
467 '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', 467 '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',
468 'archive' => '1', 468 'archive' => '1',
469 'tags' => 'google, apple', 469 'tags' => 'google, apple',
470 ]); 470 ]);
@@ -474,7 +474,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
474 $content = json_decode($this->client->getResponse()->getContent(), true); 474 $content = json_decode($this->client->getResponse()->getContent(), true);
475 475
476 $this->assertGreaterThan(0, $content['id']); 476 $this->assertGreaterThan(0, $content['id']);
477 $this->assertSame('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', $content['url']); 477 $this->assertSame('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', $content['url']);
478 $this->assertSame(1, $content['is_archived']); 478 $this->assertSame(1, $content['is_archived']);
479 $this->assertSame(0, $content['is_starred']); 479 $this->assertSame(0, $content['is_starred']);
480 $this->assertCount(3, $content['tags']); 480 $this->assertCount(3, $content['tags']);
@@ -519,7 +519,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
519 { 519 {
520 $now = new \DateTime(); 520 $now = new \DateTime();
521 $this->client->request('POST', '/api/entries.json', [ 521 $this->client->request('POST', '/api/entries.json', [
522 'url' => 'http://www.lemonde.fr/idees/article/2016/02/08/preserver-la-liberte-d-expression-sur-les-reseaux-sociaux_4861503_3232.html', 522 'url' => 'https://www.lemonde.fr/idees/article/2016/02/08/preserver-la-liberte-d-expression-sur-les-reseaux-sociaux_4861503_3232.html',
523 'archive' => '1', 523 'archive' => '1',
524 'starred' => '1', 524 'starred' => '1',
525 ]); 525 ]);
@@ -529,7 +529,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
529 $content = json_decode($this->client->getResponse()->getContent(), true); 529 $content = json_decode($this->client->getResponse()->getContent(), true);
530 530
531 $this->assertGreaterThan(0, $content['id']); 531 $this->assertGreaterThan(0, $content['id']);
532 $this->assertSame('http://www.lemonde.fr/idees/article/2016/02/08/preserver-la-liberte-d-expression-sur-les-reseaux-sociaux_4861503_3232.html', $content['url']); 532 $this->assertSame('https://www.lemonde.fr/idees/article/2016/02/08/preserver-la-liberte-d-expression-sur-les-reseaux-sociaux_4861503_3232.html', $content['url']);
533 $this->assertSame(1, $content['is_archived']); 533 $this->assertSame(1, $content['is_archived']);
534 $this->assertSame(1, $content['is_starred']); 534 $this->assertSame(1, $content['is_starred']);
535 $this->assertGreaterThanOrEqual($now->getTimestamp(), (new \DateTime($content['starred_at']))->getTimestamp()); 535 $this->assertGreaterThanOrEqual($now->getTimestamp(), (new \DateTime($content['starred_at']))->getTimestamp());
@@ -539,7 +539,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
539 public function testPostArchivedAndStarredEntryWithoutQuotes() 539 public function testPostArchivedAndStarredEntryWithoutQuotes()
540 { 540 {
541 $this->client->request('POST', '/api/entries.json', [ 541 $this->client->request('POST', '/api/entries.json', [
542 'url' => 'http://www.lemonde.fr/idees/article/2016/02/08/preserver-la-liberte-d-expression-sur-les-reseaux-sociaux_4861503_3232.html', 542 'url' => 'https://www.lemonde.fr/idees/article/2016/02/08/preserver-la-liberte-d-expression-sur-les-reseaux-sociaux_4861503_3232.html',
543 'archive' => 0, 543 'archive' => 0,
544 'starred' => 1, 544 'starred' => 1,
545 ]); 545 ]);
@@ -549,7 +549,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
549 $content = json_decode($this->client->getResponse()->getContent(), true); 549 $content = json_decode($this->client->getResponse()->getContent(), true);
550 550
551 $this->assertGreaterThan(0, $content['id']); 551 $this->assertGreaterThan(0, $content['id']);
552 $this->assertSame('http://www.lemonde.fr/idees/article/2016/02/08/preserver-la-liberte-d-expression-sur-les-reseaux-sociaux_4861503_3232.html', $content['url']); 552 $this->assertSame('https://www.lemonde.fr/idees/article/2016/02/08/preserver-la-liberte-d-expression-sur-les-reseaux-sociaux_4861503_3232.html', $content['url']);
553 $this->assertSame(0, $content['is_archived']); 553 $this->assertSame(0, $content['is_archived']);
554 $this->assertSame(1, $content['is_starred']); 554 $this->assertSame(1, $content['is_starred']);
555 } 555 }
@@ -557,7 +557,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
557 public function testPostEntryWithOriginUrl() 557 public function testPostEntryWithOriginUrl()
558 { 558 {
559 $this->client->request('POST', '/api/entries.json', [ 559 $this->client->request('POST', '/api/entries.json', [
560 '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', 560 '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',
561 'tags' => 'google', 561 'tags' => 'google',
562 'title' => 'New title for my article', 562 'title' => 'New title for my article',
563 'content' => 'my content', 563 'content' => 'my content',
@@ -573,7 +573,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
573 $content = json_decode($this->client->getResponse()->getContent(), true); 573 $content = json_decode($this->client->getResponse()->getContent(), true);
574 574
575 $this->assertGreaterThan(0, $content['id']); 575 $this->assertGreaterThan(0, $content['id']);
576 $this->assertSame('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', $content['url']); 576 $this->assertSame('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', $content['url']);
577 $this->assertSame('http://mysource.tld', $content['origin_url']); 577 $this->assertSame('http://mysource.tld', $content['origin_url']);
578 } 578 }
579 579
@@ -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()
@@ -1013,7 +1013,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
1013 public function testReloadEntry() 1013 public function testReloadEntry()
1014 { 1014 {
1015 $this->client->request('POST', '/api/entries.json', [ 1015 $this->client->request('POST', '/api/entries.json', [
1016 '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', 1016 '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',
1017 'archive' => '1', 1017 'archive' => '1',
1018 'tags' => 'google, apple', 1018 'tags' => 'google, apple',
1019 ]); 1019 ]);
@@ -1117,7 +1117,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
1117 public function testPostEntriesListAction() 1117 public function testPostEntriesListAction()
1118 { 1118 {
1119 $list = [ 1119 $list = [
1120 'http://www.lemonde.fr/musiques/article/2017/04/23/loin-de-la-politique-le-printemps-de-bourges-retombe-en-enfance_5115862_1654986.html', 1120 'https://www.lemonde.fr/musiques/article/2017/04/23/loin-de-la-politique-le-printemps-de-bourges-retombe-en-enfance_5115862_1654986.html',
1121 'http://0.0.0.0/entry2', 1121 'http://0.0.0.0/entry2',
1122 ]; 1122 ];
1123 1123
@@ -1128,7 +1128,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
1128 $content = json_decode($this->client->getResponse()->getContent(), true); 1128 $content = json_decode($this->client->getResponse()->getContent(), true);
1129 1129
1130 $this->assertInternalType('int', $content[0]['entry']); 1130 $this->assertInternalType('int', $content[0]['entry']);
1131 $this->assertSame('http://www.lemonde.fr/musiques/article/2017/04/23/loin-de-la-politique-le-printemps-de-bourges-retombe-en-enfance_5115862_1654986.html', $content[0]['url']); 1131 $this->assertSame('https://www.lemonde.fr/musiques/article/2017/04/23/loin-de-la-politique-le-printemps-de-bourges-retombe-en-enfance_5115862_1654986.html', $content[0]['url']);
1132 1132
1133 $this->assertInternalType('int', $content[1]['entry']); 1133 $this->assertInternalType('int', $content[1]['entry']);
1134 $this->assertSame('http://0.0.0.0/entry2', $content[1]['url']); 1134 $this->assertSame('http://0.0.0.0/entry2', $content[1]['url']);
@@ -1209,14 +1209,14 @@ class EntryRestControllerTest extends WallabagApiTestCase
1209 $entry = new Entry($em->getReference(User::class, 1)); 1209 $entry = new Entry($em->getReference(User::class, 1));
1210 $entry->setTitle('Antoine de Caunes : « Je veux avoir le droit de tâtonner »'); 1210 $entry->setTitle('Antoine de Caunes : « Je veux avoir le droit de tâtonner »');
1211 $entry->setContent('hihi'); 1211 $entry->setContent('hihi');
1212 $entry->setUrl('http://www.lemonde.fr/m-perso/article/2017/06/25/antoine-de-caunes-je-veux-avoir-le-droit-de-tatonner_5150728_4497916.html'); 1212 $entry->setUrl('https://www.lemonde.fr/m-perso/article/2017/06/25/antoine-de-caunes-je-veux-avoir-le-droit-de-tatonner_5150728_4497916.html');
1213 $entry->setPublishedAt(new \DateTime('2017-06-26T07:46:02+0200')); 1213 $entry->setPublishedAt(new \DateTime('2017-06-26T07:46:02+0200'));
1214 $em->persist($entry); 1214 $em->persist($entry);
1215 $em->flush(); 1215 $em->flush();
1216 $em->clear(); 1216 $em->clear();
1217 1217
1218 $this->client->request('POST', '/api/entries.json', [ 1218 $this->client->request('POST', '/api/entries.json', [
1219 'url' => 'http://www.lemonde.fr/m-perso/article/2017/06/25/antoine-de-caunes-je-veux-avoir-le-droit-de-tatonner_5150728_4497916.html', 1219 'url' => 'https://www.lemonde.fr/m-perso/article/2017/06/25/antoine-de-caunes-je-veux-avoir-le-droit-de-tatonner_5150728_4497916.html',
1220 ]); 1220 ]);
1221 1221
1222 $this->assertSame(200, $this->client->getResponse()->getStatusCode()); 1222 $this->assertSame(200, $this->client->getResponse()->getStatusCode());
@@ -1224,6 +1224,6 @@ class EntryRestControllerTest extends WallabagApiTestCase
1224 $content = json_decode($this->client->getResponse()->getContent(), true); 1224 $content = json_decode($this->client->getResponse()->getContent(), true);
1225 1225
1226 $this->assertGreaterThan(0, $content['id']); 1226 $this->assertGreaterThan(0, $content['id']);
1227 $this->assertSame('http://www.lemonde.fr/m-perso/article/2017/06/25/antoine-de-caunes-je-veux-avoir-le-droit-de-tatonner_5150728_4497916.html', $content['url']); 1227 $this->assertSame('https://www.lemonde.fr/m-perso/article/2017/06/25/antoine-de-caunes-je-veux-avoir-le-droit-de-tatonner_5150728_4497916.html', $content['url']);
1228 } 1228 }
1229} 1229}
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 12788366..bf0068b4 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
@@ -174,7 +174,7 @@ class EntryControllerTest extends WallabagCoreTestCase
174 174
175 public function testPostWithMultipleAuthors() 175 public function testPostWithMultipleAuthors()
176 { 176 {
177 $url = 'http://www.liberation.fr/planete/2017/04/05/donald-trump-et-xi-jinping-tentative-de-flirt-en-floride_1560768'; 177 $url = 'https://www.liberation.fr/planete/2017/04/05/donald-trump-et-xi-jinping-tentative-de-flirt-en-floride_1560768';
178 $this->logInAs('admin'); 178 $this->logInAs('admin');
179 $client = $this->getClient(); 179 $client = $this->getClient();
180 180
@@ -197,6 +197,7 @@ class EntryControllerTest extends WallabagCoreTestCase
197 ->getRepository('WallabagCoreBundle:Entry') 197 ->getRepository('WallabagCoreBundle:Entry')
198 ->findByUrlAndUserId($url, $this->getLoggedInUserId()); 198 ->findByUrlAndUserId($url, $this->getLoggedInUserId());
199 199
200 $this->assertInstanceOf('Wallabag\CoreBundle\Entity\Entry', $content);
200 $authors = $content->getPublishedBy(); 201 $authors = $content->getPublishedBy();
201 $this->assertSame('2017-04-05 19:26:13', $content->getPublishedAt()->format('Y-m-d H:i:s')); 202 $this->assertSame('2017-04-05 19:26:13', $content->getPublishedAt()->format('Y-m-d H:i:s'));
202 $this->assertSame('fr', $content->getLanguage()); 203 $this->assertSame('fr', $content->getLanguage());
@@ -524,7 +525,7 @@ class EntryControllerTest extends WallabagCoreTestCase
524 525
525 $this->assertGreaterThan(1, $title = $crawler->filter('div[id=article] h1')->extract(['_text'])); 526 $this->assertGreaterThan(1, $title = $crawler->filter('div[id=article] h1')->extract(['_text']));
526 $this->assertContains('My updated title hehe :)', $title[0]); 527 $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']))); 528 $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])); 529 $this->assertNotContains('example.io', trim($stats[0]));
529 } 530 }
530 531
@@ -1143,7 +1144,7 @@ class EntryControllerTest extends WallabagCoreTestCase
1143 $client = $this->getClient(); 1144 $client = $this->getClient();
1144 1145
1145 $entry = new Entry($this->getLoggedInUser()); 1146 $entry = new Entry($this->getLoggedInUser());
1146 $entry->setUrl('http://www.lemonde.fr/incorrect-url/'); 1147 $entry->setUrl('https://www.lemonde.fr/incorrect-url/');
1147 $entry->setHttpStatus(404); 1148 $entry->setHttpStatus(404);
1148 $this->getEntityManager()->persist($entry); 1149 $this->getEntityManager()->persist($entry);
1149 1150
@@ -1309,12 +1310,12 @@ class EntryControllerTest extends WallabagCoreTestCase
1309 'https://www.pravda.ru/world/09-06-2017/1337283-qatar-0/', 1310 'https://www.pravda.ru/world/09-06-2017/1337283-qatar-0/',
1310 'ru', 1311 'ru',
1311 ], 1312 ],
1312 'fr-FR' => [ 1313 'fr' => [
1313 'https://www.zataz.com/90-des-dossiers-medicaux-des-coreens-du-sud-vendus-a-des-entreprises-privees/', 1314 'https://fr.wikipedia.org/wiki/Wallabag',
1314 'fr_FR', 1315 'fr',
1315 ], 1316 ],
1316 'de' => [ 1317 'de' => [
1317 'http://www.bild.de/politik/ausland/theresa-may/wahlbeben-grossbritannien-analyse-52108924.bild.html', 1318 'https://www.bild.de/politik/ausland/theresa-may/wahlbeben-grossbritannien-analyse-52108924.bild.html',
1318 'de', 1319 'de',
1319 ], 1320 ],
1320 'it' => [ 1321 'it' => [
@@ -1325,16 +1326,12 @@ class EntryControllerTest extends WallabagCoreTestCase
1325 'http://www.hao123.com/shequ?__noscript__-=1', 1326 'http://www.hao123.com/shequ?__noscript__-=1',
1326 'zh_CN', 1327 'zh_CN',
1327 ], 1328 ],
1328 'de_AT' => [ 1329 'ru' => [
1329 'https://buy.garmin.com/de-AT/AT/catalog/product/compareResult.ep?compareProduct=112885&compareProduct=36728', 1330 'https://www.kp.ru/daily/26879.7/3921982/',
1330 'de_AT', 1331 'ru',
1331 ],
1332 'ru_RU' => [
1333 'http://netler.ru/ikt/windows-error-reporting.htm',
1334 'ru_RU',
1335 ], 1332 ],
1336 'pt_BR' => [ 1333 'pt_BR' => [
1337 'http://precodoscombustiveis.com.br/postos/cidade/4121/pr/maringa', 1334 'https://politica.estadao.com.br/noticias/eleicoes,campanha-catatonica,70002491983',
1338 'pt_BR', 1335 'pt_BR',
1339 ], 1336 ],
1340 'fucked_list_of_languages' => [ 1337 'fucked_list_of_languages' => [
@@ -1342,8 +1339,8 @@ class EntryControllerTest extends WallabagCoreTestCase
1342 null, 1339 null,
1343 ], 1340 ],
1344 'es-ES' => [ 1341 'es-ES' => [
1345 'https://www.muylinux.com/2015/04/17/odf-reino-unido-microsoft-google/', 1342 'https://www.20minutos.es/noticia/3360685/0/gobierno-sanchez-primero-historia-mas-mujeres-que-hombres/',
1346 'es_ES', 1343 'es',
1347 ], 1344 ],
1348 ]; 1345 ];
1349 } 1346 }
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/SecurityControllerTest.php b/tests/Wallabag/CoreBundle/Controller/SecurityControllerTest.php
index 2cf596d4..395208a2 100644
--- a/tests/Wallabag/CoreBundle/Controller/SecurityControllerTest.php
+++ b/tests/Wallabag/CoreBundle/Controller/SecurityControllerTest.php
@@ -6,6 +6,16 @@ use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
6 6
7class SecurityControllerTest extends WallabagCoreTestCase 7class SecurityControllerTest extends WallabagCoreTestCase
8{ 8{
9 public function testLoginWithEmail()
10 {
11 $this->logInAsUsingHttp('bigboss@wallabag.org');
12 $client = $this->getClient();
13 $client->followRedirects();
14
15 $crawler = $client->request('GET', '/config');
16 $this->assertContains('config.form_rss.description', $crawler->filter('body')->extract(['_text'])[0]);
17 }
18
9 public function testLoginWithout2Factor() 19 public function testLoginWithout2Factor()
10 { 20 {
11 $this->logInAs('admin'); 21 $this->logInAs('admin');
@@ -81,7 +91,7 @@ class SecurityControllerTest extends WallabagCoreTestCase
81 } 91 }
82 92
83 $client->followRedirects(); 93 $client->followRedirects();
84 $crawler = $client->request('GET', '/register'); 94 $client->request('GET', '/register');
85 $this->assertContains('registration.submit', $client->getResponse()->getContent()); 95 $this->assertContains('registration.submit', $client->getResponse()->getContent());
86 } 96 }
87} 97}
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/ContentProxyTest.php b/tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php
index 398592e1..3f3c60d0 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;
@@ -532,6 +531,250 @@ class ContentProxyTest extends TestCase
532 $this->assertSame('1.1.1.1', $entry->getDomainName()); 531 $this->assertSame('1.1.1.1', $entry->getDomainName());
533 } 532 }
534 533
534 public function testWebsiteWithValidUTF8Title_doNothing()
535 {
536 // You can use https://www.online-toolz.com/tools/text-hex-convertor.php to convert UTF-8 text <=> hex
537 // See http://graphemica.com for more info about the characters
538 // '😻ℤz' (U+1F63B or F09F98BB; U+2124 or E284A4; U+007A or 7A) in hexadecimal and UTF-8
539 $actualTitle = $this->hexToStr('F09F98BB' . 'E284A4' . '7A');
540
541 $tagger = $this->getTaggerMock();
542 $tagger->expects($this->once())
543 ->method('tag');
544
545 $graby = $this->getMockBuilder('Graby\Graby')
546 ->setMethods(['fetchContent'])
547 ->disableOriginalConstructor()
548 ->getMock();
549
550 $graby->expects($this->any())
551 ->method('fetchContent')
552 ->willReturn([
553 'html' => false,
554 'title' => $actualTitle,
555 'url' => '',
556 'content_type' => 'text/html',
557 'language' => '',
558 ]);
559
560 $proxy = new ContentProxy($graby, $tagger, $this->getValidator(), $this->getLogger(), $this->fetchingErrorMessage);
561 $entry = new Entry(new User());
562 $proxy->updateEntry($entry, 'http://0.0.0.0');
563
564 // '😻ℤz' (U+1F63B or F09F98BB; U+2124 or E284A4; U+007A or 7A) in hexadecimal and UTF-8
565 $expectedTitle = 'F09F98BB' . 'E284A4' . '7A';
566 $this->assertSame($expectedTitle, $this->strToHex($entry->getTitle()));
567 }
568
569 public function testWebsiteWithInvalidUTF8Title_removeInvalidCharacter()
570 {
571 // See http://graphemica.com for more info about the characters
572 // 'a€b' (61;80;62) in hexadecimal and WINDOWS-1252 - but 80 is a invalid UTF-8 character.
573 // The correct UTF-8 € character (U+20AC) is E282AC
574 $actualTitle = $this->hexToStr('61' . '80' . '62');
575
576 $tagger = $this->getTaggerMock();
577 $tagger->expects($this->once())
578 ->method('tag');
579
580 $graby = $this->getMockBuilder('Graby\Graby')
581 ->setMethods(['fetchContent'])
582 ->disableOriginalConstructor()
583 ->getMock();
584
585 $graby->expects($this->any())
586 ->method('fetchContent')
587 ->willReturn([
588 'html' => false,
589 'title' => $actualTitle,
590 'url' => '',
591 'content_type' => 'text/html',
592 'language' => '',
593 ]);
594
595 $proxy = new ContentProxy($graby, $tagger, $this->getValidator(), $this->getLogger(), $this->fetchingErrorMessage);
596 $entry = new Entry(new User());
597 $proxy->updateEntry($entry, 'http://0.0.0.0');
598
599 // 'ab' (61;62) because all invalid UTF-8 character (like 80) are removed
600 $expectedTitle = '61' . '62';
601 $this->assertSame($expectedTitle, $this->strToHex($entry->getTitle()));
602 }
603
604 public function testPdfWithUTF16BETitle_convertToUTF8()
605 {
606 // See http://graphemica.com for more info about the characters
607 // '😻' (U+1F63B;D83DDE3B) in hexadecimal and as UTF16BE
608 $actualTitle = $this->hexToStr('D83DDE3B');
609
610 $tagger = $this->getTaggerMock();
611 $tagger->expects($this->once())
612 ->method('tag');
613
614 $graby = $this->getMockBuilder('Graby\Graby')
615 ->setMethods(['fetchContent'])
616 ->disableOriginalConstructor()
617 ->getMock();
618
619 $graby->expects($this->any())
620 ->method('fetchContent')
621 ->willReturn([
622 'html' => false,
623 'title' => $actualTitle,
624 'url' => '',
625 'content_type' => 'application/pdf',
626 'language' => '',
627 ]);
628
629 $proxy = new ContentProxy($graby, $tagger, $this->getValidator(), $this->getLogger(), $this->fetchingErrorMessage);
630 $entry = new Entry(new User());
631 $proxy->updateEntry($entry, 'http://0.0.0.0');
632
633 // '😻' (U+1F63B or F09F98BB) in hexadecimal and UTF-8
634 $expectedTitle = 'F09F98BB';
635 $this->assertSame($expectedTitle, $this->strToHex($entry->getTitle()));
636 }
637
638 public function testPdfWithUTF8Title_doNothing()
639 {
640 // See http://graphemica.com for more info about the characters
641 // '😻' (U+1F63B;D83DDE3B) in hexadecimal and as UTF8
642 $actualTitle = $this->hexToStr('F09F98BB');
643
644 $tagger = $this->getTaggerMock();
645 $tagger->expects($this->once())
646 ->method('tag');
647
648 $graby = $this->getMockBuilder('Graby\Graby')
649 ->setMethods(['fetchContent'])
650 ->disableOriginalConstructor()
651 ->getMock();
652
653 $graby->expects($this->any())
654 ->method('fetchContent')
655 ->willReturn([
656 'html' => false,
657 'title' => $actualTitle,
658 'url' => '',
659 'content_type' => 'application/pdf',
660 'language' => '',
661 ]);
662
663 $proxy = new ContentProxy($graby, $tagger, $this->getValidator(), $this->getLogger(), $this->fetchingErrorMessage);
664 $entry = new Entry(new User());
665 $proxy->updateEntry($entry, 'http://0.0.0.0');
666
667 // '😻' (U+1F63B or F09F98BB) in hexadecimal and UTF-8
668 $expectedTitle = 'F09F98BB';
669 $this->assertSame($expectedTitle, $this->strToHex($entry->getTitle()));
670 }
671
672 public function testPdfWithWINDOWS1252Title_convertToUTF8()
673 {
674 // See http://graphemica.com for more info about the characters
675 // '€' (80) in hexadecimal and WINDOWS-1252
676 $actualTitle = $this->hexToStr('80');
677
678 $tagger = $this->getTaggerMock();
679 $tagger->expects($this->once())
680 ->method('tag');
681
682 $graby = $this->getMockBuilder('Graby\Graby')
683 ->setMethods(['fetchContent'])
684 ->disableOriginalConstructor()
685 ->getMock();
686
687 $graby->expects($this->any())
688 ->method('fetchContent')
689 ->willReturn([
690 'html' => false,
691 'title' => $actualTitle,
692 'url' => '',
693 'content_type' => 'application/pdf',
694 'language' => '',
695 ]);
696
697 $proxy = new ContentProxy($graby, $tagger, $this->getValidator(), $this->getLogger(), $this->fetchingErrorMessage);
698 $entry = new Entry(new User());
699 $proxy->updateEntry($entry, 'http://0.0.0.0');
700
701 // '€' (U+20AC or E282AC) in hexadecimal and UTF-8
702 $expectedTitle = 'E282AC';
703 $this->assertSame($expectedTitle, $this->strToHex($entry->getTitle()));
704 }
705
706 public function testPdfWithInvalidCharacterInTitle_removeInvalidCharacter()
707 {
708 // See http://graphemica.com for more info about the characters
709 // '😻ℤ�z' (U+1F63B or F09F98BB; U+2124 or E284A4; invalid character 81; U+007A or 7A) in hexadecimal and UTF-8
710 // 0x81 is not a valid character for UTF16, UTF8 and WINDOWS-1252
711 $actualTitle = $this->hexToStr('F09F98BB' . 'E284A4' . '81' . '7A');
712
713 $tagger = $this->getTaggerMock();
714 $tagger->expects($this->once())
715 ->method('tag');
716
717 $graby = $this->getMockBuilder('Graby\Graby')
718 ->setMethods(['fetchContent'])
719 ->disableOriginalConstructor()
720 ->getMock();
721
722 $graby->expects($this->any())
723 ->method('fetchContent')
724 ->willReturn([
725 'html' => false,
726 'title' => $actualTitle,
727 'url' => '',
728 'content_type' => 'application/pdf',
729 'language' => '',
730 ]);
731
732 $proxy = new ContentProxy($graby, $tagger, $this->getValidator(), $this->getLogger(), $this->fetchingErrorMessage);
733 $entry = new Entry(new User());
734 $proxy->updateEntry($entry, 'http://0.0.0.0');
735
736 // '😻ℤz' (U+1F63B or F09F98BB; U+2124 or E284A4; U+007A or 7A) in hexadecimal and UTF-8
737 // the 0x81 (represented by �) is invalid for UTF16, UTF8 and WINDOWS-1252 and is removed
738 $expectedTitle = 'F09F98BB' . 'E284A4' . '7A';
739 $this->assertSame($expectedTitle, $this->strToHex($entry->getTitle()));
740 }
741
742 /**
743 * https://stackoverflow.com/a/18506801.
744 *
745 * @param $string
746 *
747 * @return string
748 */
749 private function strToHex($string)
750 {
751 $hex = '';
752 for ($i = 0; $i < \strlen($string); ++$i) {
753 $ord = \ord($string[$i]);
754 $hexCode = dechex($ord);
755 $hex .= substr('0' . $hexCode, -2);
756 }
757
758 return strtoupper($hex);
759 }
760
761 /**
762 * https://stackoverflow.com/a/18506801.
763 *
764 * @param $hex
765 *
766 * @return string
767 */
768 private function hexToStr($hex)
769 {
770 $string = '';
771 for ($i = 0; $i < \strlen($hex) - 1; $i += 2) {
772 $string .= \chr(hexdec($hex[$i] . $hex[$i + 1]));
773 }
774
775 return $string;
776 }
777
535 private function getTaggerMock() 778 private function getTaggerMock()
536 { 779 {
537 return $this->getMockBuilder(RuleBasedTagger::class) 780 return $this->getMockBuilder(RuleBasedTagger::class)
diff --git a/tests/Wallabag/CoreBundle/Helper/DownloadImagesTest.php b/tests/Wallabag/CoreBundle/Helper/DownloadImagesTest.php
index 0e1d296b..cda5f843 100644
--- a/tests/Wallabag/CoreBundle/Helper/DownloadImagesTest.php
+++ b/tests/Wallabag/CoreBundle/Helper/DownloadImagesTest.php
@@ -183,4 +183,73 @@ 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 }
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 }
186} 255}
diff --git a/tests/Wallabag/CoreBundle/Tools/UtilsTest.php b/tests/Wallabag/CoreBundle/Tools/UtilsTest.php
index 347589dc..952d076d 100644
--- a/tests/Wallabag/CoreBundle/Tools/UtilsTest.php
+++ b/tests/Wallabag/CoreBundle/Tools/UtilsTest.php
@@ -13,7 +13,7 @@ class UtilsTest extends TestCase
13 */ 13 */
14 public function testCorrectWordsCountForDifferentLanguages($text, $expectedCount) 14 public function testCorrectWordsCountForDifferentLanguages($text, $expectedCount)
15 { 15 {
16 static::assertEquals((float) $expectedCount, Utils::getReadingTime($text)); 16 static::assertSame((float) $expectedCount, Utils::getReadingTime($text));
17 } 17 }
18 18
19 public function examples() 19 public function examples()
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 9b887cbb..7390fa88 100644
--- a/tests/Wallabag/ImportBundle/Controller/InstapaperControllerTest.php
+++ b/tests/Wallabag/ImportBundle/Controller/InstapaperControllerTest.php
@@ -114,29 +114,31 @@ class InstapaperControllerTest extends WallabagCoreTestCase
114 ->get('doctrine.orm.entity_manager') 114 ->get('doctrine.orm.entity_manager')
115 ->getRepository('WallabagCoreBundle:Entry') 115 ->getRepository('WallabagCoreBundle:Entry')
116 ->findByUrlAndUserId( 116 ->findByUrlAndUserId(
117 'http://www.liberation.fr/societe/2012/12/06/baumettes-un-tour-en-cellule_865551', 117 'https://www.liberation.fr/societe/2012/12/06/baumettes-un-tour-en-cellule_865551',
118 $this->getLoggedInUserId() 118 $this->getLoggedInUserId()
119 ); 119 );
120 120
121 $this->assertNotEmpty($content->getMimetype(), 'Mimetype for http://www.liberation.fr is ok'); 121 $this->assertInstanceOf('Wallabag\CoreBundle\Entity\Entry', $content);
122 $this->assertNotEmpty($content->getPreviewPicture(), 'Preview picture for http://www.liberation.fr is ok'); 122
123 $this->assertNotEmpty($content->getLanguage(), 'Language for http://www.liberation.fr is ok'); 123 $this->assertNotEmpty($content->getMimetype(), 'Mimetype for https://www.liberation.fr is ok');
124 $this->assertNotEmpty($content->getPreviewPicture(), 'Preview picture for https://www.liberation.fr is ok');
125 $this->assertNotEmpty($content->getLanguage(), 'Language for https://www.liberation.fr is ok');
124 $this->assertContains('foot', $content->getTags(), 'It includes the "foot" tag'); 126 $this->assertContains('foot', $content->getTags(), 'It includes the "foot" tag');
125 $this->assertSame(1, count($content->getTags())); 127 $this->assertSame(1, \count($content->getTags()));
126 $this->assertInstanceOf(\DateTime::class, $content->getCreatedAt()); 128 $this->assertInstanceOf(\DateTime::class, $content->getCreatedAt());
127 129
128 $content = $client->getContainer() 130 $content = $client->getContainer()
129 ->get('doctrine.orm.entity_manager') 131 ->get('doctrine.orm.entity_manager')
130 ->getRepository('WallabagCoreBundle:Entry') 132 ->getRepository('WallabagCoreBundle:Entry')
131 ->findByUrlAndUserId( 133 ->findByUrlAndUserId(
132 'https://www.20minutes.fr/high-tech/2077615-20170531-dis-donc-donald-trump-quoi-exactement-covfefe', 134 'https://www.20minutes.fr/high-tech/2077615-20170531-quoi-exactement-tweet-covfefe-donald-trump-persiste-signe',
133 $this->getLoggedInUserId() 135 $this->getLoggedInUserId()
134 ); 136 );
135 137
136 $this->assertContains('foot', $content->getTags()); 138 $this->assertContains('foot', $content->getTags());
137 $this->assertContains('test_tag', $content->getTags()); 139 $this->assertContains('test_tag', $content->getTags());
138 140
139 $this->assertSame(2, count($content->getTags())); 141 $this->assertSame(2, \count($content->getTags()));
140 } 142 }
141 143
142 public function testImportInstapaperWithFileAndMarkAllAsRead() 144 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 fcb9dfab..5619659a 100644
--- a/tests/Wallabag/ImportBundle/Controller/ReadabilityControllerTest.php
+++ b/tests/Wallabag/ImportBundle/Controller/ReadabilityControllerTest.php
@@ -111,7 +111,7 @@ class ReadabilityControllerTest extends WallabagCoreTestCase
111 ->get('doctrine.orm.entity_manager') 111 ->get('doctrine.orm.entity_manager')
112 ->getRepository('WallabagCoreBundle:Entry') 112 ->getRepository('WallabagCoreBundle:Entry')
113 ->findByUrlAndUserId( 113 ->findByUrlAndUserId(
114 'https://www.zataz.com/90-des-dossiers-medicaux-des-coreens-du-sud-vendus-a-des-entreprises-privees/', 114 'https://www.20minutes.fr/bordeaux/2120479-20170823-bordeaux-poche-chocolatine-association-traduit-etudiants-etrangers-mots-sud-ouest',
115 $this->getLoggedInUserId() 115 $this->getLoggedInUserId()
116 ); 116 );
117 117
@@ -119,13 +119,13 @@ class ReadabilityControllerTest extends WallabagCoreTestCase
119 $this->assertContains('flashes.import.notice.summary', $body[0]); 119 $this->assertContains('flashes.import.notice.summary', $body[0]);
120 120
121 $this->assertInstanceOf('Wallabag\CoreBundle\Entity\Entry', $content); 121 $this->assertInstanceOf('Wallabag\CoreBundle\Entity\Entry', $content);
122 $this->assertNotEmpty($content->getMimetype(), 'Mimetype for http://www.zataz.com is ok'); 122 $this->assertNotEmpty($content->getMimetype(), 'Mimetype for https://www.20minutes.fr is ok');
123 $this->assertNotEmpty($content->getPreviewPicture(), 'Preview picture for http://www.zataz.com is ok'); 123 $this->assertNotEmpty($content->getPreviewPicture(), 'Preview picture for https://www.20minutes.fr is ok');
124 $this->assertNotEmpty($content->getLanguage(), 'Language for http://www.zataz.com is ok'); 124 $this->assertNotEmpty($content->getLanguage(), 'Language for https://www.20minutes.fr is ok');
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..822656ba 100644
--- a/tests/Wallabag/ImportBundle/Controller/WallabagV2ControllerTest.php
+++ b/tests/Wallabag/ImportBundle/Controller/WallabagV2ControllerTest.php
@@ -115,20 +115,20 @@ class WallabagV2ControllerTest extends WallabagCoreTestCase
115 ->get('doctrine.orm.entity_manager') 115 ->get('doctrine.orm.entity_manager')
116 ->getRepository('WallabagCoreBundle:Entry') 116 ->getRepository('WallabagCoreBundle:Entry')
117 ->findByUrlAndUserId( 117 ->findByUrlAndUserId(
118 'http://www.liberation.fr/planete/2015/10/26/refugies-l-ue-va-creer-100-000-places-d-accueil-dans-les-balkans_1408867', 118 'https://www.liberation.fr/planete/2015/10/26/refugies-l-ue-va-creer-100-000-places-d-accueil-dans-les-balkans_1408867',
119 $this->getLoggedInUserId() 119 $this->getLoggedInUserId()
120 ); 120 );
121 121
122 $this->assertInstanceOf('Wallabag\CoreBundle\Entity\Entry', $content); 122 $this->assertInstanceOf('Wallabag\CoreBundle\Entity\Entry', $content);
123 123
124 // empty because it wasn't re-imported 124 // empty because it wasn't re-imported
125 $this->assertEmpty($content->getMimetype(), 'Mimetype for http://www.liberation.fr is empty'); 125 $this->assertEmpty($content->getMimetype(), 'Mimetype for https://www.liberation.fr is empty');
126 $this->assertEmpty($content->getPreviewPicture(), 'Preview picture for http://www.liberation.fr is empty'); 126 $this->assertEmpty($content->getPreviewPicture(), 'Preview picture for https://www.liberation.fr is empty');
127 $this->assertEmpty($content->getLanguage(), 'Language for http://www.liberation.fr is empty'); 127 $this->assertEmpty($content->getLanguage(), 'Language for https://www.liberation.fr is empty');
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/ImportBundle/fixtures/instapaper-export.csv b/tests/Wallabag/ImportBundle/fixtures/instapaper-export.csv
index 06d018e0..5380bf2c 100644
--- a/tests/Wallabag/ImportBundle/fixtures/instapaper-export.csv
+++ b/tests/Wallabag/ImportBundle/fixtures/instapaper-export.csv
@@ -1,5 +1,5 @@
1URL,Title,Selection,Folder 1URL,Title,Selection,Folder
2http://www.liberation.fr/societe/2012/12/06/baumettes-un-tour-en-cellule_865551,Baumettes : un tour en cellule,,Unread 2https://www.liberation.fr/societe/2012/12/06/baumettes-un-tour-en-cellule_865551,Baumettes : un tour en cellule,,Unread
3https://redditblog.com/2016/09/20/amp-and-reactredux/,AMP and React+Redux: Why Not?,,Archive 3https://redditblog.com/2016/09/20/amp-and-reactredux/,AMP and React+Redux: Why Not?,,Archive
4https://medium.com/@the_minh/why-foursquare-swarm-is-still-my-favourite-social-network-e38228493e6c,Why Foursquare / Swarm is still my favourite social network,,Starred 4https://medium.com/@the_minh/why-foursquare-swarm-is-still-my-favourite-social-network-e38228493e6c,Why Foursquare / Swarm is still my favourite social network,,Starred
5https://www.20minutes.fr/high-tech/2077615-20170531-dis-donc-donald-trump-quoi-exactement-covfefe,"Dis donc Donald Trump, c'est quoi exactement «covfefe»?",,test_tag 5https://www.20minutes.fr/high-tech/2077615-20170531-quoi-exactement-tweet-covfefe-donald-trump-persiste-signe,"Dis donc Donald Trump, c'est quoi exactement «covfefe»?",,test_tag
diff --git a/tests/Wallabag/ImportBundle/fixtures/readability.json b/tests/Wallabag/ImportBundle/fixtures/readability.json
index ba7be5bf..f71b8d19 100644
--- a/tests/Wallabag/ImportBundle/fixtures/readability.json
+++ b/tests/Wallabag/ImportBundle/fixtures/readability.json
@@ -21,8 +21,8 @@
21 "archive": 0, 21 "archive": 0,
22 "date_added": "2016-09-08T11:55:58+0200", 22 "date_added": "2016-09-08T11:55:58+0200",
23 "favorite": 0, 23 "favorite": 0,
24 "article__title": "90% des dossiers médicaux des Coréens du sud vendus à des entreprises privées - ZATAZ", 24 "article__title": "Bordeaux: Poche, chocolatine… Une association traduit aux étudiants étrangers les mots du Sud-Ouest",
25 "article__url": "https://www.zataz.com/90-des-dossiers-medicaux-des-coreens-du-sud-vendus-a-des-entreprises-privees/" 25 "article__url": "https://www.20minutes.fr/bordeaux/2120479-20170823-bordeaux-poche-chocolatine-association-traduit-etudiants-etrangers-mots-sud-ouest"
26 } 26 }
27 ], 27 ],
28 "recommendations": [] 28 "recommendations": []
diff --git a/tests/Wallabag/ImportBundle/fixtures/wallabag-v2.json b/tests/Wallabag/ImportBundle/fixtures/wallabag-v2.json
index 63c44cf9..a2142f90 100644
--- a/tests/Wallabag/ImportBundle/fixtures/wallabag-v2.json
+++ b/tests/Wallabag/ImportBundle/fixtures/wallabag-v2.json
@@ -21,7 +21,7 @@
21 { 21 {
22 "id": 22, 22 "id": 22,
23 "title": "Réfugiés: l'UE va créer 100 000 places d'accueil dans les Balkans", 23 "title": "Réfugiés: l'UE va créer 100 000 places d'accueil dans les Balkans",
24 "url": "http://www.liberation.fr/planete/2015/10/26/refugies-l-ue-va-creer-100-000-places-d-accueil-dans-les-balkans_1408867", 24 "url": "https://www.liberation.fr/planete/2015/10/26/refugies-l-ue-va-creer-100-000-places-d-accueil-dans-les-balkans_1408867",
25 "is_archived": false, 25 "is_archived": false,
26 "created_at": "2016-09-08T11:55:58+0200", 26 "created_at": "2016-09-08T11:55:58+0200",
27 "updated_at": "2016-09-08T11:57:16+0200", 27 "updated_at": "2016-09-08T11:57:16+0200",
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()