aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php55
1 files changed, 26 insertions, 29 deletions
diff --git a/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php b/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php
index c37d08cb..64c24a2d 100644
--- a/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php
+++ b/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php
@@ -769,47 +769,44 @@ class EntryRestControllerTest extends WallabagApiTestCase
769 $this->client->request('DELETE', '/api/entries/tags/list?list=' . json_encode($list)); 769 $this->client->request('DELETE', '/api/entries/tags/list?list=' . json_encode($list));
770 } 770 }
771 771
772 public function testPostMassEntriesAction() 772
773 public function testPostEntriesListAction()
773 { 774 {
774 $list = [ 775 $list = [
775 [ 776 'http://www.lemonde.fr/musiques/article/2017/04/23/loin-de-la-politique-le-printemps-de-bourges-retombe-en-enfance_5115862_1654986.html',
776 'url' => 'http://0.0.0.0/entry2', 777 'http://0.0.0.0/entry6',
777 'action' => 'delete',
778 ],
779 [
780 'url' => 'http://www.lemonde.fr/musiques/article/2017/04/23/loin-de-la-politique-le-printemps-de-bourges-retombe-en-enfance_5115862_1654986.html',
781 'action' => 'add',
782 ],
783 [
784 'url' => 'http://0.0.0.0/entry3',
785 'action' => 'delete',
786 ],
787 [
788 'url' => 'http://0.0.0.0/entry6',
789 'action' => 'add',
790 ],
791 ]; 778 ];
792 779
793 $this->client->request('POST', '/api/entries/lists?list='.json_encode($list)); 780 $this->client->request('POST', '/api/entries/lists?urls='.json_encode($list));
794 781
795 $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); 782 $this->assertEquals(200, $this->client->getResponse()->getStatusCode());
796 783
797 $content = json_decode($this->client->getResponse()->getContent(), true); 784 $content = json_decode($this->client->getResponse()->getContent(), true);
798 785
799 $this->assertTrue($content[0]['entry']); 786 $this->assertInternalType('int', $content[0]['entry']);
800 $this->assertEquals('http://0.0.0.0/entry2', $content[0]['url']); 787 $this->assertEquals('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']);
801 $this->assertEquals('delete', $content[0]['action']);
802 788
803 $this->assertInternalType('int', $content[1]['entry']); 789 $this->assertInternalType('int', $content[1]['entry']);
804 $this->assertEquals('http://www.lemonde.fr/musiques/article/2017/04/23/loin-de-la-politique-le-printemps-de-bourges-retombe-en-enfance_5115862_1654986.html', $content[1]['url']); 790 $this->assertEquals('http://0.0.0.0/entry6', $content[1]['url']);
805 $this->assertEquals('add', $content[1]['action']); 791 }
792
793 public function testDeleteEntriesListAction()
794 {
795 $list = [
796 'http://0.0.0.0/entry2',
797 'http://0.0.0.0/entry3',
798 ];
799
800 $this->client->request('DELETE', '/api/entries/list?urls='.json_encode($list));
806 801
807 $this->assertFalse($content[2]['entry']); 802 $this->assertEquals(200, $this->client->getResponse()->getStatusCode());
808 $this->assertEquals('http://0.0.0.0/entry3', $content[2]['url']); 803
809 $this->assertEquals('delete', $content[2]['action']); 804 $content = json_decode($this->client->getResponse()->getContent(), true);
805
806 $this->assertTrue($content[0]['entry']);
807 $this->assertEquals('http://0.0.0.0/entry2', $content[0]['url']);
810 808
811 $this->assertInternalType('int', $content[3]['entry']); 809 $this->assertFalse($content[1]['entry']);
812 $this->assertEquals('http://0.0.0.0/entry6', $content[3]['url']); 810 $this->assertEquals('http://0.0.0.0/entry3', $content[1]['url']);
813 $this->assertEquals('add', $content[3]['action']);
814 } 811 }
815} 812}