aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php47
1 files changed, 39 insertions, 8 deletions
diff --git a/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php b/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php
index 5af7f7e1..d26a56f8 100644
--- a/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php
+++ b/tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php
@@ -144,6 +144,37 @@ class EntryControllerTest extends WallabagCoreTestCase
144 $this->assertEquals('Morgane Tual', $author[0]); 144 $this->assertEquals('Morgane Tual', $author[0]);
145 } 145 }
146 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]);
176 }
177
147 public function testPostNewOkUrlExist() 178 public function testPostNewOkUrlExist()
148 { 179 {
149 $this->logInAs('admin'); 180 $this->logInAs('admin');
@@ -610,7 +641,7 @@ class EntryControllerTest extends WallabagCoreTestCase
610 641
611 $crawler = $client->submit($form, $data); 642 $crawler = $client->submit($form, $data);
612 643
613 $this->assertCount(2, $crawler->filter('div[class=entry]')); 644 $this->assertCount(3, $crawler->filter('div[class=entry]'));
614 } 645 }
615 646
616 public function testFilterOnReadingTimeOnlyLower() 647 public function testFilterOnReadingTimeOnlyLower()
@@ -646,7 +677,7 @@ class EntryControllerTest extends WallabagCoreTestCase
646 677
647 $crawler = $client->submit($form, $data); 678 $crawler = $client->submit($form, $data);
648 679
649 $this->assertCount(4, $crawler->filter('div[class=entry]')); 680 $this->assertCount(5, $crawler->filter('div[class=entry]'));
650 } 681 }
651 682
652 public function testFilterOnCreationDate() 683 public function testFilterOnCreationDate()
@@ -665,7 +696,7 @@ class EntryControllerTest extends WallabagCoreTestCase
665 696
666 $crawler = $client->submit($form, $data); 697 $crawler = $client->submit($form, $data);
667 698
668 $this->assertCount(5, $crawler->filter('div[class=entry]')); 699 $this->assertCount(6, $crawler->filter('div[class=entry]'));
669 700
670 $data = [ 701 $data = [
671 'entry_filter[createdAt][left_date]' => date('d/m/Y'), 702 'entry_filter[createdAt][left_date]' => date('d/m/Y'),
@@ -674,7 +705,7 @@ class EntryControllerTest extends WallabagCoreTestCase
674 705
675 $crawler = $client->submit($form, $data); 706 $crawler = $client->submit($form, $data);
676 707
677 $this->assertCount(5, $crawler->filter('div[class=entry]')); 708 $this->assertCount(6, $crawler->filter('div[class=entry]'));
678 709
679 $data = [ 710 $data = [
680 'entry_filter[createdAt][left_date]' => '01/01/1970', 711 'entry_filter[createdAt][left_date]' => '01/01/1970',
@@ -778,7 +809,7 @@ class EntryControllerTest extends WallabagCoreTestCase
778 $form['entry_filter[previewPicture]']->tick(); 809 $form['entry_filter[previewPicture]']->tick();
779 810
780 $crawler = $client->submit($form); 811 $crawler = $client->submit($form);
781 $this->assertCount(1, $crawler->filter('div[class=entry]')); 812 $this->assertCount(2, $crawler->filter('div[class=entry]'));
782 } 813 }
783 814
784 public function testFilterOnLanguage() 815 public function testFilterOnLanguage()
@@ -793,7 +824,7 @@ class EntryControllerTest extends WallabagCoreTestCase
793 ]; 824 ];
794 825
795 $crawler = $client->submit($form, $data); 826 $crawler = $client->submit($form, $data);
796 $this->assertCount(2, $crawler->filter('div[class=entry]')); 827 $this->assertCount(3, $crawler->filter('div[class=entry]'));
797 828
798 $form = $crawler->filter('button[id=submit-filter]')->form(); 829 $form = $crawler->filter('button[id=submit-filter]')->form();
799 $data = [ 830 $data = [
@@ -1018,7 +1049,7 @@ class EntryControllerTest extends WallabagCoreTestCase
1018 1049
1019 $crawler = $client->submit($form, $data); 1050 $crawler = $client->submit($form, $data);
1020 1051
1021 $this->assertCount(1, $crawler->filter('div[class=entry]')); 1052 $this->assertCount(2, $crawler->filter('div[class=entry]'));
1022 1053
1023 $crawler = $client->request('GET', '/all/list'); 1054 $crawler = $client->request('GET', '/all/list');
1024 $form = $crawler->filter('button[id=submit-filter]')->form(); 1055 $form = $crawler->filter('button[id=submit-filter]')->form();
@@ -1029,7 +1060,7 @@ class EntryControllerTest extends WallabagCoreTestCase
1029 1060
1030 $crawler = $client->submit($form, $data); 1061 $crawler = $client->submit($form, $data);
1031 1062
1032 $this->assertCount(7, $crawler->filter('div[class=entry]')); 1063 $this->assertCount(8, $crawler->filter('div[class=entry]'));
1033 } 1064 }
1034 1065
1035 public function testSearch() 1066 public function testSearch()