diff options
Diffstat (limited to 'tests')
6 files changed, 208 insertions, 12 deletions
diff --git a/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php b/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php index 95c64501..b0d4c4e1 100644 --- a/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php +++ b/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php | |||
@@ -36,6 +36,25 @@ class EntryRestControllerTest extends WallabagApiTestCase | |||
36 | $this->assertSame('application/json', $this->client->getResponse()->headers->get('Content-Type')); | 36 | $this->assertSame('application/json', $this->client->getResponse()->headers->get('Content-Type')); |
37 | } | 37 | } |
38 | 38 | ||
39 | public function testGetOneEntryWithOriginUrl() | ||
40 | { | ||
41 | $entry = $this->client->getContainer() | ||
42 | ->get('doctrine.orm.entity_manager') | ||
43 | ->getRepository('WallabagCoreBundle:Entry') | ||
44 | ->findOneBy(['user' => 1, 'url' => 'http://0.0.0.0/entry2']); | ||
45 | |||
46 | if (!$entry) { | ||
47 | $this->markTestSkipped('No content found in db.'); | ||
48 | } | ||
49 | |||
50 | $this->client->request('GET', '/api/entries/' . $entry->getId() . '.json'); | ||
51 | $this->assertSame(200, $this->client->getResponse()->getStatusCode()); | ||
52 | |||
53 | $content = json_decode($this->client->getResponse()->getContent(), true); | ||
54 | |||
55 | $this->assertSame($entry->getOriginUrl(), $content['origin_url']); | ||
56 | } | ||
57 | |||
39 | public function testExportEntry() | 58 | public function testExportEntry() |
40 | { | 59 | { |
41 | $entry = $this->client->getContainer() | 60 | $entry = $this->client->getContainer() |
@@ -421,6 +440,7 @@ class EntryRestControllerTest extends WallabagApiTestCase | |||
421 | $this->assertSame('New title for my article', $content['title']); | 440 | $this->assertSame('New title for my article', $content['title']); |
422 | $this->assertSame(1, $content['user_id']); | 441 | $this->assertSame(1, $content['user_id']); |
423 | $this->assertCount(2, $content['tags']); | 442 | $this->assertCount(2, $content['tags']); |
443 | $this->assertNull($content['origin_url']); | ||
424 | $this->assertSame('my content', $content['content']); | 444 | $this->assertSame('my content', $content['content']); |
425 | $this->assertSame('de', $content['language']); | 445 | $this->assertSame('de', $content['language']); |
426 | $this->assertSame('2016-09-08T11:55:58+0200', $content['published_at']); | 446 | $this->assertSame('2016-09-08T11:55:58+0200', $content['published_at']); |
@@ -531,6 +551,29 @@ class EntryRestControllerTest extends WallabagApiTestCase | |||
531 | $this->assertSame(1, $content['is_starred']); | 551 | $this->assertSame(1, $content['is_starred']); |
532 | } | 552 | } |
533 | 553 | ||
554 | public function testPostEntryWithOriginUrl() | ||
555 | { | ||
556 | $this->client->request('POST', '/api/entries.json', [ | ||
557 | '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', | ||
558 | 'tags' => 'google', | ||
559 | 'title' => 'New title for my article', | ||
560 | 'content' => 'my content', | ||
561 | 'language' => 'de', | ||
562 | 'published_at' => '2016-09-08T11:55:58+0200', | ||
563 | 'authors' => 'bob,helen', | ||
564 | 'public' => 1, | ||
565 | 'origin_url' => 'http://mysource.tld', | ||
566 | ]); | ||
567 | |||
568 | $this->assertSame(200, $this->client->getResponse()->getStatusCode()); | ||
569 | |||
570 | $content = json_decode($this->client->getResponse()->getContent(), true); | ||
571 | |||
572 | $this->assertGreaterThan(0, $content['id']); | ||
573 | $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']); | ||
574 | $this->assertSame('http://mysource.tld', $content['origin_url']); | ||
575 | } | ||
576 | |||
534 | public function testPatchEntry() | 577 | public function testPatchEntry() |
535 | { | 578 | { |
536 | $entry = $this->client->getContainer() | 579 | $entry = $this->client->getContainer() |
@@ -607,6 +650,91 @@ class EntryRestControllerTest extends WallabagApiTestCase | |||
607 | $this->assertSame($previousLanguage, $content['language'], 'Ensure language has not moved'); | 650 | $this->assertSame($previousLanguage, $content['language'], 'Ensure language has not moved'); |
608 | } | 651 | } |
609 | 652 | ||
653 | public function testPatchEntryWithOriginUrl() | ||
654 | { | ||
655 | $entry = $this->client->getContainer() | ||
656 | ->get('doctrine.orm.entity_manager') | ||
657 | ->getRepository('WallabagCoreBundle:Entry') | ||
658 | ->findOneByUser(1); | ||
659 | |||
660 | if (!$entry) { | ||
661 | $this->markTestSkipped('No content found in db.'); | ||
662 | } | ||
663 | |||
664 | $previousContent = $entry->getContent(); | ||
665 | $previousLanguage = $entry->getLanguage(); | ||
666 | |||
667 | $this->client->request('PATCH', '/api/entries/' . $entry->getId() . '.json', [ | ||
668 | 'title' => 'Another awesome title just for profit', | ||
669 | 'origin_url' => 'https://myawesomesource.example.com', | ||
670 | ]); | ||
671 | |||
672 | $this->assertSame(200, $this->client->getResponse()->getStatusCode()); | ||
673 | |||
674 | $content = json_decode($this->client->getResponse()->getContent(), true); | ||
675 | |||
676 | $this->assertSame($entry->getId(), $content['id']); | ||
677 | $this->assertSame($entry->getUrl(), $content['url']); | ||
678 | $this->assertSame('https://myawesomesource.example.com', $content['origin_url']); | ||
679 | $this->assertEmpty($content['published_by'], 'Authors were not saved because of an array instead of a string'); | ||
680 | $this->assertSame($previousContent, $content['content'], 'Ensure content has not moved'); | ||
681 | $this->assertSame($previousLanguage, $content['language'], 'Ensure language has not moved'); | ||
682 | } | ||
683 | |||
684 | public function testPatchEntryRemoveOriginUrl() | ||
685 | { | ||
686 | $entry = $this->client->getContainer() | ||
687 | ->get('doctrine.orm.entity_manager') | ||
688 | ->getRepository('WallabagCoreBundle:Entry') | ||
689 | ->findOneByUser(1); | ||
690 | |||
691 | if (!$entry) { | ||
692 | $this->markTestSkipped('No content found in db.'); | ||
693 | } | ||
694 | |||
695 | $previousContent = $entry->getContent(); | ||
696 | $previousLanguage = $entry->getLanguage(); | ||
697 | $previousTitle = $entry->getTitle(); | ||
698 | |||
699 | $this->client->request('PATCH', '/api/entries/' . $entry->getId() . '.json', [ | ||
700 | 'origin_url' => '', | ||
701 | ]); | ||
702 | |||
703 | $this->assertSame(200, $this->client->getResponse()->getStatusCode()); | ||
704 | |||
705 | $content = json_decode($this->client->getResponse()->getContent(), true); | ||
706 | |||
707 | $this->assertSame($entry->getId(), $content['id']); | ||
708 | $this->assertSame($entry->getUrl(), $content['url']); | ||
709 | $this->assertEmpty($content['origin_url']); | ||
710 | $this->assertEmpty($content['published_by'], 'Authors were not saved because of an array instead of a string'); | ||
711 | $this->assertSame($previousContent, $content['content'], 'Ensure content has not moved'); | ||
712 | $this->assertSame($previousLanguage, $content['language'], 'Ensure language has not moved'); | ||
713 | $this->assertSame($previousTitle, $content['title'], 'Ensure title has not moved'); | ||
714 | } | ||
715 | |||
716 | public function testPatchEntryNullOriginUrl() | ||
717 | { | ||
718 | $entry = $this->client->getContainer() | ||
719 | ->get('doctrine.orm.entity_manager') | ||
720 | ->getRepository('WallabagCoreBundle:Entry') | ||
721 | ->findOneByUser(1); | ||
722 | |||
723 | if (!$entry) { | ||
724 | $this->markTestSkipped('No content found in db.'); | ||
725 | } | ||
726 | |||
727 | $this->client->request('PATCH', '/api/entries/' . $entry->getId() . '.json', [ | ||
728 | 'origin_url' => null, | ||
729 | ]); | ||
730 | |||
731 | $this->assertSame(200, $this->client->getResponse()->getStatusCode()); | ||
732 | |||
733 | $content = json_decode($this->client->getResponse()->getContent(), true); | ||
734 | |||
735 | $this->assertNull($content['origin_url']); | ||
736 | } | ||
737 | |||
610 | public function testGetTagsEntry() | 738 | public function testGetTagsEntry() |
611 | { | 739 | { |
612 | $entry = $this->client->getContainer() | 740 | $entry = $this->client->getContainer() |
@@ -855,7 +983,7 @@ class EntryRestControllerTest extends WallabagApiTestCase | |||
855 | 983 | ||
856 | $content = json_decode($this->client->getResponse()->getContent(), true); | 984 | $content = json_decode($this->client->getResponse()->getContent(), true); |
857 | 985 | ||
858 | $this->assertSame(false, $content['exists']); | 986 | $this->assertFalse($content['exists']); |
859 | } | 987 | } |
860 | 988 | ||
861 | public function testGetEntriesExistsWithNoUrl() | 989 | public function testGetEntriesExistsWithNoUrl() |
diff --git a/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php b/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php index ca275b32..4ac4548b 100644 --- a/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php +++ b/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php | |||
@@ -9,6 +9,7 @@ use Wallabag\CoreBundle\Entity\SiteCredential; | |||
9 | 9 | ||
10 | class EntryControllerTest extends WallabagCoreTestCase | 10 | class EntryControllerTest extends WallabagCoreTestCase |
11 | { | 11 | { |
12 | 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'; | ||
12 | public $downloadImagesEnabled = false; | 13 | public $downloadImagesEnabled = false; |
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'; | 14 | 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'; |
14 | 15 | ||
@@ -136,6 +137,8 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
136 | $this->logInAs('admin'); | 137 | $this->logInAs('admin'); |
137 | $client = $this->getClient(); | 138 | $client = $this->getClient(); |
138 | 139 | ||
140 | $client->getContainer()->get('craue_config')->set('store_article_headers', 1); | ||
141 | |||
139 | $crawler = $client->request('GET', '/new'); | 142 | $crawler = $client->request('GET', '/new'); |
140 | 143 | ||
141 | $this->assertSame(200, $client->getResponse()->getStatusCode()); | 144 | $this->assertSame(200, $client->getResponse()->getStatusCode()); |
@@ -161,9 +164,10 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
161 | $this->assertSame($this->url, $content->getUrl()); | 164 | $this->assertSame($this->url, $content->getUrl()); |
162 | $this->assertContains('Google', $content->getTitle()); | 165 | $this->assertContains('Google', $content->getTitle()); |
163 | $this->assertSame('fr', $content->getLanguage()); | 166 | $this->assertSame('fr', $content->getLanguage()); |
164 | $this->assertSame('2015-03-28 15:37:39', $content->getPublishedAt()->format('Y-m-d H:i:s')); | 167 | $this->assertSame('2015-03-28 11:43:19', $content->getPublishedAt()->format('Y-m-d H:i:s')); |
165 | $this->assertSame('Morgane Tual', $author[0]); | 168 | $this->assertSame('Morgane Tual', $author[0]); |
166 | $this->assertArrayHasKey('x-varnish1', $content->getHeaders()); | 169 | $this->assertArrayHasKey('x-varnish1', $content->getHeaders()); |
170 | $client->getContainer()->get('craue_config')->set('store_article_headers', 0); | ||
167 | } | 171 | } |
168 | 172 | ||
169 | public function testPostWithMultipleAuthors() | 173 | public function testPostWithMultipleAuthors() |
@@ -474,6 +478,40 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
474 | 478 | ||
475 | $data = [ | 479 | $data = [ |
476 | 'entry[title]' => 'My updated title hehe :)', | 480 | 'entry[title]' => 'My updated title hehe :)', |
481 | 'entry[origin_url]' => 'https://example.io', | ||
482 | ]; | ||
483 | |||
484 | $client->submit($form, $data); | ||
485 | |||
486 | $this->assertSame(302, $client->getResponse()->getStatusCode()); | ||
487 | |||
488 | $crawler = $client->followRedirect(); | ||
489 | |||
490 | $this->assertGreaterThan(1, $title = $crawler->filter('div[id=article] h1')->extract(['_text'])); | ||
491 | $this->assertContains('My updated title hehe :)', $title[0]); | ||
492 | $this->assertGreaterThan(1, $stats = $crawler->filter('div[class=tools] ul[class=stats] li a[class=tool]')->extract(['_text'])); | ||
493 | $this->assertContains('example.io', trim($stats[1])); | ||
494 | } | ||
495 | |||
496 | public function testEditRemoveOriginUrl() | ||
497 | { | ||
498 | $this->logInAs('admin'); | ||
499 | $client = $this->getClient(); | ||
500 | |||
501 | $entry = new Entry($this->getLoggedInUser()); | ||
502 | $entry->setUrl($this->url); | ||
503 | $this->getEntityManager()->persist($entry); | ||
504 | $this->getEntityManager()->flush(); | ||
505 | |||
506 | $crawler = $client->request('GET', '/edit/' . $entry->getId()); | ||
507 | |||
508 | $this->assertSame(200, $client->getResponse()->getStatusCode()); | ||
509 | |||
510 | $form = $crawler->filter('button[type=submit]')->form(); | ||
511 | |||
512 | $data = [ | ||
513 | 'entry[title]' => 'My updated title hehe :)', | ||
514 | 'entry[origin_url]' => '', | ||
477 | ]; | 515 | ]; |
478 | 516 | ||
479 | $client->submit($form, $data); | 517 | $client->submit($form, $data); |
@@ -482,8 +520,10 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
482 | 520 | ||
483 | $crawler = $client->followRedirect(); | 521 | $crawler = $client->followRedirect(); |
484 | 522 | ||
485 | $this->assertGreaterThan(1, $alert = $crawler->filter('div[id=article] h1')->extract(['_text'])); | 523 | $this->assertGreaterThan(1, $title = $crawler->filter('div[id=article] h1')->extract(['_text'])); |
486 | $this->assertContains('My updated title hehe :)', $alert[0]); | 524 | $this->assertContains('My updated title hehe :)', $title[0]); |
525 | $this->assertSame(1, count($stats = $crawler->filter('div[class=tools] ul[class=stats] li a[class=tool]')->extract(['_text']))); | ||
526 | $this->assertNotContains('example.io', trim($stats[0])); | ||
487 | } | 527 | } |
488 | 528 | ||
489 | public function testToggleArchive() | 529 | public function testToggleArchive() |
@@ -977,7 +1017,7 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
977 | $this->logInAs('admin'); | 1017 | $this->logInAs('admin'); |
978 | $client = $this->getClient(); | 1018 | $client = $this->getClient(); |
979 | 1019 | ||
980 | $url = 'http://www.20minutes.fr/montpellier/1952003-20161030-video-car-tombe-panne-rugbymen-perpignan-improvisent-melee-route'; | 1020 | $url = self::An_URL_CONTAINING_AN_ARTICLE_WITH_IMAGE; |
981 | $client->getContainer()->get('craue_config')->set('download_images_enabled', 1); | 1021 | $client->getContainer()->get('craue_config')->set('download_images_enabled', 1); |
982 | 1022 | ||
983 | $crawler = $client->request('GET', '/new'); | 1023 | $crawler = $client->request('GET', '/new'); |
@@ -1003,9 +1043,9 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
1003 | 1043 | ||
1004 | $this->assertInstanceOf('Wallabag\CoreBundle\Entity\Entry', $entry); | 1044 | $this->assertInstanceOf('Wallabag\CoreBundle\Entity\Entry', $entry); |
1005 | $this->assertSame($url, $entry->getUrl()); | 1045 | $this->assertSame($url, $entry->getUrl()); |
1006 | $this->assertContains('Perpignan', $entry->getTitle()); | 1046 | $this->assertContains('Judo', $entry->getTitle()); |
1007 | // instead of checking for the filename (which might change) check that the image is now local | 1047 | // instead of checking for the filename (which might change) check that the image is now local |
1008 | $this->assertContains($client->getContainer()->getParameter('domain_name') . '/assets/images/', $entry->getContent()); | 1048 | $this->assertContains(rtrim($client->getContainer()->getParameter('domain_name'), '/') . '/assets/images/', $entry->getContent()); |
1009 | 1049 | ||
1010 | $client->getContainer()->get('craue_config')->set('download_images_enabled', 0); | 1050 | $client->getContainer()->get('craue_config')->set('download_images_enabled', 0); |
1011 | } | 1051 | } |
@@ -1019,7 +1059,7 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
1019 | $this->logInAs('admin'); | 1059 | $this->logInAs('admin'); |
1020 | $client = $this->getClient(); | 1060 | $client = $this->getClient(); |
1021 | 1061 | ||
1022 | $url = 'http://www.20minutes.fr/montpellier/1952003-20161030-video-car-tombe-panne-rugbymen-perpignan-improvisent-melee-route'; | 1062 | $url = self::An_URL_CONTAINING_AN_ARTICLE_WITH_IMAGE; |
1023 | $client->getContainer()->get('craue_config')->set('download_images_enabled', 1); | 1063 | $client->getContainer()->get('craue_config')->set('download_images_enabled', 1); |
1024 | 1064 | ||
1025 | $crawler = $client->request('GET', '/new'); | 1065 | $crawler = $client->request('GET', '/new'); |
diff --git a/tests/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilderTest.php b/tests/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilderTest.php index 5d6a29fe..5aee9f5c 100644 --- a/tests/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilderTest.php +++ b/tests/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilderTest.php | |||
@@ -68,7 +68,7 @@ class GrabySiteConfigBuilderTest extends \PHPUnit_Framework_TestCase | |||
68 | $config = $this->builder->buildForHost('www.example.com'); | 68 | $config = $this->builder->buildForHost('www.example.com'); |
69 | 69 | ||
70 | $this->assertSame('example.com', $config->getHost()); | 70 | $this->assertSame('example.com', $config->getHost()); |
71 | $this->assertSame(true, $config->requiresLogin()); | 71 | $this->assertTrue($config->requiresLogin()); |
72 | $this->assertSame('http://www.example.com/login', $config->getLoginUri()); | 72 | $this->assertSame('http://www.example.com/login', $config->getLoginUri()); |
73 | $this->assertSame('login', $config->getUsernameField()); | 73 | $this->assertSame('login', $config->getUsernameField()); |
74 | $this->assertSame('password', $config->getPasswordField()); | 74 | $this->assertSame('password', $config->getPasswordField()); |
diff --git a/tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php b/tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php index f94c2137..5c99e461 100644 --- a/tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php +++ b/tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php | |||
@@ -51,7 +51,7 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase | |||
51 | $this->assertEmpty($entry->getMimetype()); | 51 | $this->assertEmpty($entry->getMimetype()); |
52 | $this->assertEmpty($entry->getLanguage()); | 52 | $this->assertEmpty($entry->getLanguage()); |
53 | $this->assertSame(0.0, $entry->getReadingTime()); | 53 | $this->assertSame(0.0, $entry->getReadingTime()); |
54 | $this->assertSame(null, $entry->getDomainName()); | 54 | $this->assertNull($entry->getDomainName()); |
55 | } | 55 | } |
56 | 56 | ||
57 | public function testWithEmptyContent() | 57 | public function testWithEmptyContent() |
@@ -311,7 +311,7 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase | |||
311 | $tagger->expects($this->once()) | 311 | $tagger->expects($this->once()) |
312 | ->method('tag'); | 312 | ->method('tag'); |
313 | 313 | ||
314 | $proxy = new ContentProxy((new Graby()), $tagger, $this->getValidator(), $this->getLogger(), $this->fetchingErrorMessage); | 314 | $proxy = new ContentProxy((new Graby()), $tagger, $this->getValidator(), $this->getLogger(), $this->fetchingErrorMessage, true); |
315 | $entry = new Entry(new User()); | 315 | $entry = new Entry(new User()); |
316 | $proxy->updateEntry( | 316 | $proxy->updateEntry( |
317 | $entry, | 317 | $entry, |
@@ -341,6 +341,7 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase | |||
341 | $this->assertContains('Jeremy', $entry->getPublishedBy()); | 341 | $this->assertContains('Jeremy', $entry->getPublishedBy()); |
342 | $this->assertContains('Nico', $entry->getPublishedBy()); | 342 | $this->assertContains('Nico', $entry->getPublishedBy()); |
343 | $this->assertContains('Thomas', $entry->getPublishedBy()); | 343 | $this->assertContains('Thomas', $entry->getPublishedBy()); |
344 | $this->assertNotNull($entry->getHeaders(), 'Headers are stored, so value is not null'); | ||
344 | $this->assertContains('no-cache', $entry->getHeaders()); | 345 | $this->assertContains('no-cache', $entry->getHeaders()); |
345 | } | 346 | } |
346 | 347 | ||
diff --git a/tests/Wallabag/CoreBundle/Twig/WallabagExtensionTest.php b/tests/Wallabag/CoreBundle/Twig/WallabagExtensionTest.php index ceec4b37..82336060 100644 --- a/tests/Wallabag/CoreBundle/Twig/WallabagExtensionTest.php +++ b/tests/Wallabag/CoreBundle/Twig/WallabagExtensionTest.php | |||
@@ -30,4 +30,31 @@ class WallabagExtensionTest extends \PHPUnit_Framework_TestCase | |||
30 | $this->assertSame('lemonde.fr', $extension->removeWww('lemonde.fr')); | 30 | $this->assertSame('lemonde.fr', $extension->removeWww('lemonde.fr')); |
31 | $this->assertSame('gist.github.com', $extension->removeWww('gist.github.com')); | 31 | $this->assertSame('gist.github.com', $extension->removeWww('gist.github.com')); |
32 | } | 32 | } |
33 | |||
34 | public function testRemoveSchemeAndWww() | ||
35 | { | ||
36 | $entryRepository = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository') | ||
37 | ->disableOriginalConstructor() | ||
38 | ->getMock(); | ||
39 | |||
40 | $tagRepository = $this->getMockBuilder('Wallabag\CoreBundle\Repository\TagRepository') | ||
41 | ->disableOriginalConstructor() | ||
42 | ->getMock(); | ||
43 | |||
44 | $tokenStorage = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface') | ||
45 | ->disableOriginalConstructor() | ||
46 | ->getMock(); | ||
47 | |||
48 | $translator = $this->getMockBuilder('Symfony\Component\Translation\TranslatorInterface') | ||
49 | ->disableOriginalConstructor() | ||
50 | ->getMock(); | ||
51 | |||
52 | $extension = new WallabagExtension($entryRepository, $tagRepository, $tokenStorage, 0, $translator); | ||
53 | |||
54 | $this->assertSame('lemonde.fr', $extension->removeSchemeAndWww('www.lemonde.fr')); | ||
55 | $this->assertSame('lemonde.fr', $extension->removeSchemeAndWww('http://lemonde.fr')); | ||
56 | $this->assertSame('lemonde.fr', $extension->removeSchemeAndWww('https://www.lemonde.fr')); | ||
57 | $this->assertSame('gist.github.com', $extension->removeSchemeAndWww('https://gist.github.com')); | ||
58 | $this->assertSame('ftp://gist.github.com', $extension->removeSchemeAndWww('ftp://gist.github.com')); | ||
59 | } | ||
33 | } | 60 | } |
diff --git a/tests/Wallabag/ImportBundle/Controller/FirefoxControllerTest.php b/tests/Wallabag/ImportBundle/Controller/FirefoxControllerTest.php index 933fffa2..dc9d9a8f 100644 --- a/tests/Wallabag/ImportBundle/Controller/FirefoxControllerTest.php +++ b/tests/Wallabag/ImportBundle/Controller/FirefoxControllerTest.php | |||
@@ -114,7 +114,7 @@ class FirefoxControllerTest 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://lexpansion.lexpress.fr/high-tech/orange-offre-un-meilleur-reseau-mobile-que-bouygues-et-sfr-free-derriere_1811554.html', | 117 | 'https://lexpansion.lexpress.fr/high-tech/orange-offre-un-meilleur-reseau-mobile-que-bouygues-et-sfr-free-derriere_1811554.html', |
118 | $this->getLoggedInUserId() | 118 | $this->getLoggedInUserId() |
119 | ); | 119 | ); |
120 | 120 | ||