summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorSean Molenaar <sean@seanmolenaar.eu>2021-05-14 22:10:29 +0200
committerBenjamin Brahmer <info@b-brahmer.de>2021-05-27 19:10:53 +0200
commit2159eccbf199703a60636d517b0645b771e8bb0a (patch)
treed7e3c4d2890c5725b5d93e389f3734678035a527 /tests
parentbfc514e484f45b8ddacc2dabaad516e1db1f534c (diff)
controller: getRead + all_items is now unread type
Signed-off-by: Sean Molenaar <sean@seanmolenaar.eu> Signed-off-by: Benjamin Brahmer <info@b-brahmer.de>
Diffstat (limited to 'tests')
-rw-r--r--tests/Unit/Controller/ItemApiControllerTest.php36
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/Unit/Controller/ItemApiControllerTest.php b/tests/Unit/Controller/ItemApiControllerTest.php
index 85e359705..e5d53a940 100644
--- a/tests/Unit/Controller/ItemApiControllerTest.php
+++ b/tests/Unit/Controller/ItemApiControllerTest.php
@@ -156,6 +156,42 @@ class ItemApiControllerTest extends TestCase
}
+ public function testIndexListensToGetReadOnAllItems()
+ {
+ $item = new Item();
+ $item->setId(5);
+ $item->setGuid('guid');
+ $item->setGuidHash('guidhash');
+ $item->setFeedId(123);
+
+ $this->itemService->expects($this->once())
+ ->method('findAllWithFilters')
+ ->with($this->uid, 6, -1, 0, false, [])
+ ->will($this->returnValue([$item]));
+
+ $response = $this->class->index(3, 0, false);
+
+ $this->assertEquals(['items' => [$item->toApi()]], $response);
+ }
+
+
+ public function testIndexListensToGetReadOnItems()
+ {
+ $item = new Item();
+ $item->setId(5);
+ $item->setGuid('guid');
+ $item->setGuidHash('guidhash');
+ $item->setFeedId(123);
+
+ $this->itemService->expects($this->never())
+ ->method('findAllWithFilters');
+
+ $response = $this->class->index(6, 0, false);
+
+ $this->assertEquals(['message' => 'Setting getRead on an already filtered list is not allowed!'], $response);
+ }
+
+
public function testUpdatedFeed()
{
$item = new Item();