diff options
author | Sean Molenaar <sean@seanmolenaar.eu> | 2021-05-14 22:10:29 +0200 |
---|---|---|
committer | Sean Molenaar <SMillerDev@users.noreply.github.com> | 2021-05-16 16:31:16 +0200 |
commit | 2fa2fddc11cf15a594cbbc03ba1b14afa3344f01 (patch) | |
tree | 47ab198e5ebd7fbd5fd8e8413ed8cba7bb01d729 /tests/Unit/Controller/ItemApiControllerTest.php | |
parent | 9f36b3af3fdd9b4a95f349277d00334c5d7b59f2 (diff) |
controller: getRead + all_items is now unread type
Signed-off-by: Sean Molenaar <sean@seanmolenaar.eu>
Diffstat (limited to 'tests/Unit/Controller/ItemApiControllerTest.php')
-rw-r--r-- | tests/Unit/Controller/ItemApiControllerTest.php | 36 |
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(); |