diff options
author | Nicolas Lœuillet <nicolas@loeuillet.org> | 2017-04-18 13:12:28 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-04-18 13:12:28 +0200 |
commit | 64f1d8f77a75332b731124c5ebab4bed7a512081 (patch) | |
tree | 41b087f24db4f4fce2e94a811d8554c91637d137 /tests/Wallabag | |
parent | c5ba478dc326ee43c5861fc170d1121b6224d847 (diff) | |
parent | e9c80c99bda57905e481dc7eb7748a3b5c0d9ac9 (diff) | |
download | wallabag-64f1d8f77a75332b731124c5ebab4bed7a512081.tar.gz wallabag-64f1d8f77a75332b731124c5ebab4bed7a512081.tar.zst wallabag-64f1d8f77a75332b731124c5ebab4bed7a512081.zip |
Merge pull request #3024 from wallabag/store-date
Added publication date and author
Diffstat (limited to 'tests/Wallabag')
-rw-r--r-- | tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php | 51 |
1 files changed, 43 insertions, 8 deletions
diff --git a/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php b/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php index 3eb6d47f..d26a56f8 100644 --- a/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php +++ b/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php | |||
@@ -135,9 +135,44 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
135 | ->getRepository('WallabagCoreBundle:Entry') | 135 | ->getRepository('WallabagCoreBundle:Entry') |
136 | ->findByUrlAndUserId($this->url, $this->getLoggedInUserId()); | 136 | ->findByUrlAndUserId($this->url, $this->getLoggedInUserId()); |
137 | 137 | ||
138 | $author = $content->getPublishedBy(); | ||
139 | |||
138 | $this->assertInstanceOf('Wallabag\CoreBundle\Entity\Entry', $content); | 140 | $this->assertInstanceOf('Wallabag\CoreBundle\Entity\Entry', $content); |
139 | $this->assertEquals($this->url, $content->getUrl()); | 141 | $this->assertEquals($this->url, $content->getUrl()); |
140 | $this->assertContains('Google', $content->getTitle()); | 142 | $this->assertContains('Google', $content->getTitle()); |
143 | $this->assertEquals('2015-03-28 15:37:39', $content->getPublishedAt()->format('Y-m-d H:i:s')); | ||
144 | $this->assertEquals('Morgane Tual', $author[0]); | ||
145 | } | ||
146 | |||
147 | public function testPostWithMultipleAuthors() | ||
148 | { | ||
149 | $url = 'http://www.liberation.fr/planete/2017/04/05/donald-trump-et-xi-jinping-tentative-de-flirt-en-floride_1560768'; | ||
150 | $this->logInAs('admin'); | ||
151 | $client = $this->getClient(); | ||
152 | |||
153 | $crawler = $client->request('GET', '/new'); | ||
154 | |||
155 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); | ||
156 | |||
157 | $form = $crawler->filter('form[name=entry]')->form(); | ||
158 | |||
159 | $data = [ | ||
160 | 'entry[url]' => $url, | ||
161 | ]; | ||
162 | |||
163 | $client->submit($form, $data); | ||
164 | |||
165 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); | ||
166 | |||
167 | $content = $client->getContainer() | ||
168 | ->get('doctrine.orm.entity_manager') | ||
169 | ->getRepository('WallabagCoreBundle:Entry') | ||
170 | ->findByUrlAndUserId($url, $this->getLoggedInUserId()); | ||
171 | |||
172 | $authors = $content->getPublishedBy(); | ||
173 | $this->assertEquals('2017-04-05 19:26:13', $content->getPublishedAt()->format('Y-m-d H:i:s')); | ||
174 | $this->assertEquals('Raphaël Balenieri, correspondant à Pékin', $authors[0]); | ||
175 | $this->assertEquals('Frédéric Autran, correspondant à New York', $authors[1]); | ||
141 | } | 176 | } |
142 | 177 | ||
143 | public function testPostNewOkUrlExist() | 178 | public function testPostNewOkUrlExist() |
@@ -606,7 +641,7 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
606 | 641 | ||
607 | $crawler = $client->submit($form, $data); | 642 | $crawler = $client->submit($form, $data); |
608 | 643 | ||
609 | $this->assertCount(2, $crawler->filter('div[class=entry]')); | 644 | $this->assertCount(3, $crawler->filter('div[class=entry]')); |
610 | } | 645 | } |
611 | 646 | ||
612 | public function testFilterOnReadingTimeOnlyLower() | 647 | public function testFilterOnReadingTimeOnlyLower() |
@@ -642,7 +677,7 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
642 | 677 | ||
643 | $crawler = $client->submit($form, $data); | 678 | $crawler = $client->submit($form, $data); |
644 | 679 | ||
645 | $this->assertCount(4, $crawler->filter('div[class=entry]')); | 680 | $this->assertCount(5, $crawler->filter('div[class=entry]')); |
646 | } | 681 | } |
647 | 682 | ||
648 | public function testFilterOnCreationDate() | 683 | public function testFilterOnCreationDate() |
@@ -661,7 +696,7 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
661 | 696 | ||
662 | $crawler = $client->submit($form, $data); | 697 | $crawler = $client->submit($form, $data); |
663 | 698 | ||
664 | $this->assertCount(5, $crawler->filter('div[class=entry]')); | 699 | $this->assertCount(6, $crawler->filter('div[class=entry]')); |
665 | 700 | ||
666 | $data = [ | 701 | $data = [ |
667 | 'entry_filter[createdAt][left_date]' => date('d/m/Y'), | 702 | 'entry_filter[createdAt][left_date]' => date('d/m/Y'), |
@@ -670,7 +705,7 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
670 | 705 | ||
671 | $crawler = $client->submit($form, $data); | 706 | $crawler = $client->submit($form, $data); |
672 | 707 | ||
673 | $this->assertCount(5, $crawler->filter('div[class=entry]')); | 708 | $this->assertCount(6, $crawler->filter('div[class=entry]')); |
674 | 709 | ||
675 | $data = [ | 710 | $data = [ |
676 | 'entry_filter[createdAt][left_date]' => '01/01/1970', | 711 | 'entry_filter[createdAt][left_date]' => '01/01/1970', |
@@ -774,7 +809,7 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
774 | $form['entry_filter[previewPicture]']->tick(); | 809 | $form['entry_filter[previewPicture]']->tick(); |
775 | 810 | ||
776 | $crawler = $client->submit($form); | 811 | $crawler = $client->submit($form); |
777 | $this->assertCount(1, $crawler->filter('div[class=entry]')); | 812 | $this->assertCount(2, $crawler->filter('div[class=entry]')); |
778 | } | 813 | } |
779 | 814 | ||
780 | public function testFilterOnLanguage() | 815 | public function testFilterOnLanguage() |
@@ -789,7 +824,7 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
789 | ]; | 824 | ]; |
790 | 825 | ||
791 | $crawler = $client->submit($form, $data); | 826 | $crawler = $client->submit($form, $data); |
792 | $this->assertCount(2, $crawler->filter('div[class=entry]')); | 827 | $this->assertCount(3, $crawler->filter('div[class=entry]')); |
793 | 828 | ||
794 | $form = $crawler->filter('button[id=submit-filter]')->form(); | 829 | $form = $crawler->filter('button[id=submit-filter]')->form(); |
795 | $data = [ | 830 | $data = [ |
@@ -1014,7 +1049,7 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
1014 | 1049 | ||
1015 | $crawler = $client->submit($form, $data); | 1050 | $crawler = $client->submit($form, $data); |
1016 | 1051 | ||
1017 | $this->assertCount(1, $crawler->filter('div[class=entry]')); | 1052 | $this->assertCount(2, $crawler->filter('div[class=entry]')); |
1018 | 1053 | ||
1019 | $crawler = $client->request('GET', '/all/list'); | 1054 | $crawler = $client->request('GET', '/all/list'); |
1020 | $form = $crawler->filter('button[id=submit-filter]')->form(); | 1055 | $form = $crawler->filter('button[id=submit-filter]')->form(); |
@@ -1025,7 +1060,7 @@ class EntryControllerTest extends WallabagCoreTestCase | |||
1025 | 1060 | ||
1026 | $crawler = $client->submit($form, $data); | 1061 | $crawler = $client->submit($form, $data); |
1027 | 1062 | ||
1028 | $this->assertCount(7, $crawler->filter('div[class=entry]')); | 1063 | $this->assertCount(8, $crawler->filter('div[class=entry]')); |
1029 | } | 1064 | } |
1030 | 1065 | ||
1031 | public function testSearch() | 1066 | public function testSearch() |