aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--src/Wallabag/ApiBundle/Controller/EntryRestController.php2
-rw-r--r--tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php26
2 files changed, 13 insertions, 15 deletions
diff --git a/src/Wallabag/ApiBundle/Controller/EntryRestController.php b/src/Wallabag/ApiBundle/Controller/EntryRestController.php
index 5ccaa4ef..7590efbb 100644
--- a/src/Wallabag/ApiBundle/Controller/EntryRestController.php
+++ b/src/Wallabag/ApiBundle/Controller/EntryRestController.php
@@ -459,7 +459,6 @@ class EntryRestController extends WallabagRestController
459 459
460 // handle multiple urls 460 // handle multiple urls
461 if (!empty($list)) { 461 if (!empty($list)) {
462 $results = [];
463 foreach ($list as $key => $element) { 462 foreach ($list as $key => $element) {
464 $entry = $this->get('wallabag_core.entry_repository')->findByUrlAndUserId( 463 $entry = $this->get('wallabag_core.entry_repository')->findByUrlAndUserId(
465 $element->url, 464 $element->url,
@@ -517,7 +516,6 @@ class EntryRestController extends WallabagRestController
517 516
518 // handle multiple urls 517 // handle multiple urls
519 if (!empty($list)) { 518 if (!empty($list)) {
520 $results = [];
521 foreach ($list as $key => $element) { 519 foreach ($list as $key => $element) {
522 $entry = $this->get('wallabag_core.entry_repository')->findByUrlAndUserId( 520 $entry = $this->get('wallabag_core.entry_repository')->findByUrlAndUserId(
523 $element->url, 521 $element->url,
diff --git a/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php b/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php
index 638e8bcd..19fb5170 100644
--- a/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php
+++ b/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php
@@ -298,7 +298,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
298 $entry = $this->client->getContainer() 298 $entry = $this->client->getContainer()
299 ->get('doctrine.orm.entity_manager') 299 ->get('doctrine.orm.entity_manager')
300 ->getRepository('WallabagCoreBundle:Entry') 300 ->getRepository('WallabagCoreBundle:Entry')
301 ->findOneByUser(1); 301 ->findOneByUser(1, ['id' => 'asc']);
302 302
303 if (!$entry) { 303 if (!$entry) {
304 $this->markTestSkipped('No content found in db.'); 304 $this->markTestSkipped('No content found in db.');
@@ -719,15 +719,15 @@ class EntryRestControllerTest extends WallabagApiTestCase
719 { 719 {
720 $entry = $this->client->getContainer()->get('doctrine.orm.entity_manager') 720 $entry = $this->client->getContainer()->get('doctrine.orm.entity_manager')
721 ->getRepository('WallabagCoreBundle:Entry') 721 ->getRepository('WallabagCoreBundle:Entry')
722 ->findByUrlAndUserId('http://0.0.0.0/entry2', 1); 722 ->findByUrlAndUserId('http://0.0.0.0/entry4', 1);
723 723
724 $tags = $entry->getTags(); 724 $tags = $entry->getTags();
725 725
726 $this->assertCount(4, $tags); 726 $this->assertCount(2, $tags);
727 727
728 $list = [ 728 $list = [
729 [ 729 [
730 'url' => 'http://0.0.0.0/entry2', 730 'url' => 'http://0.0.0.0/entry4',
731 'tags' => 'new tag 1, new tag 2', 731 'tags' => 'new tag 1, new tag 2',
732 ], 732 ],
733 ]; 733 ];
@@ -739,29 +739,29 @@ class EntryRestControllerTest extends WallabagApiTestCase
739 $content = json_decode($this->client->getResponse()->getContent(), true); 739 $content = json_decode($this->client->getResponse()->getContent(), true);
740 740
741 $this->assertInternalType('int', $content[0]['entry']); 741 $this->assertInternalType('int', $content[0]['entry']);
742 $this->assertEquals('http://0.0.0.0/entry2', $content[0]['url']); 742 $this->assertEquals('http://0.0.0.0/entry4', $content[0]['url']);
743 743
744 $entry = $this->client->getContainer()->get('doctrine.orm.entity_manager') 744 $entry = $this->client->getContainer()->get('doctrine.orm.entity_manager')
745 ->getRepository('WallabagCoreBundle:Entry') 745 ->getRepository('WallabagCoreBundle:Entry')
746 ->findByUrlAndUserId('http://0.0.0.0/entry2', 1); 746 ->findByUrlAndUserId('http://0.0.0.0/entry4', 1);
747 747
748 $tags = $entry->getTags(); 748 $tags = $entry->getTags();
749 $this->assertCount(6, $tags); 749 $this->assertCount(4, $tags);
750 } 750 }
751 751
752 public function testDeleteEntriesTagsListAction() 752 public function testDeleteEntriesTagsListAction()
753 { 753 {
754 $entry = $this->client->getContainer()->get('doctrine.orm.entity_manager') 754 $entry = $this->client->getContainer()->get('doctrine.orm.entity_manager')
755 ->getRepository('WallabagCoreBundle:Entry') 755 ->getRepository('WallabagCoreBundle:Entry')
756 ->findByUrlAndUserId('http://0.0.0.0/entry2', 1); 756 ->findByUrlAndUserId('http://0.0.0.0/entry4', 1);
757 757
758 $tags = $entry->getTags(); 758 $tags = $entry->getTags();
759 759
760 $this->assertCount(6, $tags); 760 $this->assertCount(4, $tags);
761 761
762 $list = [ 762 $list = [
763 [ 763 [
764 'url' => 'http://0.0.0.0/entry2', 764 'url' => 'http://0.0.0.0/entry4',
765 'tags' => 'new tag 1, new tag 2', 765 'tags' => 'new tag 1, new tag 2',
766 ], 766 ],
767 ]; 767 ];
@@ -773,13 +773,13 @@ class EntryRestControllerTest extends WallabagApiTestCase
773 $content = json_decode($this->client->getResponse()->getContent(), true); 773 $content = json_decode($this->client->getResponse()->getContent(), true);
774 774
775 $this->assertInternalType('int', $content[0]['entry']); 775 $this->assertInternalType('int', $content[0]['entry']);
776 $this->assertEquals('http://0.0.0.0/entry2', $content[0]['url']); 776 $this->assertEquals('http://0.0.0.0/entry4', $content[0]['url']);
777 777
778 $entry = $this->client->getContainer()->get('doctrine.orm.entity_manager') 778 $entry = $this->client->getContainer()->get('doctrine.orm.entity_manager')
779 ->getRepository('WallabagCoreBundle:Entry') 779 ->getRepository('WallabagCoreBundle:Entry')
780 ->findByUrlAndUserId('http://0.0.0.0/entry2', 1); 780 ->findByUrlAndUserId('http://0.0.0.0/entry4', 1);
781 781
782 $tags = $entry->getTags(); 782 $tags = $entry->getTags();
783 $this->assertCount(4, $tags); 783 $this->assertCount(2, $tags);
784 } 784 }
785} 785}