diff options
author | Marco Nassabain <marco.nassabain@hotmail.com> | 2021-02-07 22:26:49 +0100 |
---|---|---|
committer | Sean Molenaar <SMillerDev@users.noreply.github.com> | 2021-04-08 22:31:21 +0200 |
commit | 4133e68c8ec87fd53dc424a4512758acbd4dc7d6 (patch) | |
tree | c34d2956b1d26412280bfea8f743d8199c76852b /tests | |
parent | 54aa8b527099edb409099335638382dbf754f36b (diff) |
✅ Update tests to contain share data
Signed-off-by: Marco Nassabain <marco.nassabain@hotmail.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Unit/Controller/FeedControllerTest.php | 14 | ||||
-rw-r--r-- | tests/Unit/Controller/ItemControllerTest.php | 27 | ||||
-rw-r--r-- | tests/Unit/Db/ItemTest.php | 7 |
3 files changed, 43 insertions, 5 deletions
diff --git a/tests/Unit/Controller/FeedControllerTest.php b/tests/Unit/Controller/FeedControllerTest.php index fde821088..5713cb932 100644 --- a/tests/Unit/Controller/FeedControllerTest.php +++ b/tests/Unit/Controller/FeedControllerTest.php @@ -137,7 +137,8 @@ class FeedControllerTest extends TestCase 'feeds' => [ ['a feed'], ], - 'starred' => 4 + 'starred' => 4, + // 'shared' => 3 // TODO: uncomment when implemented ]; $this->feedService->expects($this->once()) ->method('findAllForUser') @@ -151,6 +152,11 @@ class FeedControllerTest extends TestCase ->method('starred') ->with($this->uid) ->will($this->returnValue([1, 2, 3, 4])); + // TODO: uncomment when implemented + // $this->itemService->expects($this->once()) + // ->method('shared') + // ->with($this->equalTo($this->user)) + // ->will($this->returnValue($result['shared'])); $response = $this->class->index(); @@ -165,6 +171,7 @@ class FeedControllerTest extends TestCase ['a feed'], ], 'starred' => 2, + // 'shared' => 3, // TODO: uncomment when implemented 'newestItemId' => 5 ]; $this->feedService->expects($this->once()) @@ -179,6 +186,11 @@ class FeedControllerTest extends TestCase ->method('starred') ->with($this->uid) ->will($this->returnValue([1, 2])); + // TODO: uncomment when implemented + // $this->itemService->expects($this->once()) + // ->method('shared') + // ->with($this->equalTo($this->user)) + // ->will($this->returnValue($result['shared'])); $response = $this->class->index(); diff --git a/tests/Unit/Controller/ItemControllerTest.php b/tests/Unit/Controller/ItemControllerTest.php index c64cd9330..db3b5234b 100644 --- a/tests/Unit/Controller/ItemControllerTest.php +++ b/tests/Unit/Controller/ItemControllerTest.php @@ -231,7 +231,8 @@ class ItemControllerTest extends TestCase 'items' => [new Item()], 'feeds' => $feeds, 'newestItemId' => $this->newestItemId, - 'starred' => 3 + 'starred' => 3, + // 'shared' => 99 // TODO: uncomment when implement shared ]; $this->itemsApiExpects(2, ListType::FEED, '0'); @@ -251,6 +252,12 @@ class ItemControllerTest extends TestCase ->with('user') ->will($this->returnValue([1, 2, 3])); + // TODO: uncomment when implemented + // $this->itemService->expects($this->once()) + // ->method('shared') + // ->with($this->equalTo($this->user)) + // ->will($this->returnValue($result['shared'])); + $this->itemService->expects($this->once()) ->method('findAllInFeedWithFilters') ->with('user', 2, 3, 0, false, false, []) @@ -268,7 +275,8 @@ class ItemControllerTest extends TestCase 'items' => [new Item()], 'feeds' => $feeds, 'newestItemId' => $this->newestItemId, - 'starred' => 3 + 'starred' => 3, + // 'shared' => 99 // TODO: uncomment when implemented ]; $this->itemsApiExpects(2, ListType::FOLDER, '0'); @@ -288,6 +296,12 @@ class ItemControllerTest extends TestCase ->with('user') ->will($this->returnValue([1, 2, 3])); + // TODO: uncomment when implemented + // $this->itemService->expects($this->once()) + // ->method('shared') + // ->with($this->equalTo($this->user)) + // ->will($this->returnValue($result['shared'])); + $this->itemService->expects($this->once()) ->method('findAllInFolderWithFilters') ->with('user', 2, 3, 0, false, false, []) @@ -412,7 +426,8 @@ class ItemControllerTest extends TestCase 'items' => [new Item()], 'feeds' => $feeds, 'newestItemId' => $this->newestItemId, - 'starred' => 3 + 'starred' => 3, + // 'shared' => 99 // TODO: uncomment when implemented ]; $this->settings->expects($this->once()) @@ -435,6 +450,12 @@ class ItemControllerTest extends TestCase ->with('user') ->will($this->returnValue([1, 2, 3])); + // TODO: uncomment when implemented + // $this->itemService->expects($this->once()) + // ->method('shared') + // ->with($this->equalTo($this->user)) + // ->will($this->returnValue($result['shared'])); + $this->itemService->expects($this->once()) ->method('findAllInFeedAfter') ->with('user', 2, 3, false) diff --git a/tests/Unit/Db/ItemTest.php b/tests/Unit/Db/ItemTest.php index 4f9de59d3..75880c8a7 100644 --- a/tests/Unit/Db/ItemTest.php +++ b/tests/Unit/Db/ItemTest.php @@ -200,6 +200,8 @@ class ItemTest extends TestCase $item->setStarred(true); $item->setLastModified(321); $item->setCategories(['food']); + $item->setSharedBy('jack'); + $item->setSharedWith('mclovin'); $this->assertEquals( [ @@ -223,7 +225,10 @@ class ItemTest extends TestCase 'rtl' => true, 'intro' => 'this is a test', 'fingerprint' => 'fingerprint', - 'categories' => ['food'] + 'categories' => ['food'], + 'sharedBy' => 'jack', + 'sharedWith' => 'mclovin', + 'isShared' => true, ], $item->jsonSerialize() ); } |