From 582c4d11facc0c8c97ae14d370b6c4f69b210124 Mon Sep 17 00:00:00 2001 From: Sean Molenaar Date: Mon, 18 Jan 2021 19:56:26 +0100 Subject: Controllers: Fetch feed after creating Signed-off-by: Sean Molenaar --- tests/Unit/Controller/FeedApiControllerTest.php | 8 ++++++++ tests/Unit/Controller/FeedControllerTest.php | 21 +++++++++++++++++++-- 2 files changed, 27 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/Unit/Controller/FeedApiControllerTest.php b/tests/Unit/Controller/FeedApiControllerTest.php index b31d9fd43..a6a1db548 100644 --- a/tests/Unit/Controller/FeedApiControllerTest.php +++ b/tests/Unit/Controller/FeedApiControllerTest.php @@ -198,6 +198,10 @@ class FeedApiControllerTest extends TestCase ->method('create') ->with($this->userID, 'url', 3) ->will($this->returnValue($feeds[0])); + + $this->feedService->expects($this->once()) + ->method('fetch') + ->with($feeds[0]); $this->itemService->expects($this->once()) ->method('getNewestItemId') ->will($this->returnValue(3)); @@ -225,6 +229,10 @@ class FeedApiControllerTest extends TestCase ->method('create') ->with($this->userID, 'ho', 3) ->will($this->returnValue($feeds[0])); + + $this->feedService->expects($this->once()) + ->method('fetch') + ->with($feeds[0]); $this->itemService->expects($this->once()) ->method('getNewestItemId') ->will($this->throwException(new ServiceNotFoundException(''))); diff --git a/tests/Unit/Controller/FeedControllerTest.php b/tests/Unit/Controller/FeedControllerTest.php index 487ef0af1..871b781e0 100644 --- a/tests/Unit/Controller/FeedControllerTest.php +++ b/tests/Unit/Controller/FeedControllerTest.php @@ -187,8 +187,13 @@ class FeedControllerTest extends TestCase } - - private function activeInitMocks($id, $type) + /** + * Configure settings with active mocks + * + * @param $id + * @param $type + */ + private function activeInitMocks($id, $type): void { $this->settings->expects($this->exactly(2)) ->method('getUserValue') @@ -313,6 +318,10 @@ class FeedControllerTest extends TestCase $this->feedService->expects($this->once()) ->method('purgeDeleted') ->with($this->uid, false); + + $this->feedService->expects($this->once()) + ->method('fetch') + ->with($result['feeds'][0]); $this->feedService->expects($this->once()) ->method('create') ->with($this->uid, 'hi', 4, false, 'yo') @@ -337,6 +346,10 @@ class FeedControllerTest extends TestCase $this->feedService->expects($this->once()) ->method('purgeDeleted') ->with($this->uid, false); + + $this->feedService->expects($this->once()) + ->method('fetch') + ->with($result['feeds'][0]); $this->feedService->expects($this->once()) ->method('create') ->with($this->uid, 'hi', null, false, 'yo') @@ -365,6 +378,10 @@ class FeedControllerTest extends TestCase ->with($this->uid, 'hi', 4, false, 'yo') ->will($this->returnValue($result['feeds'][0])); + $this->feedService->expects($this->once()) + ->method('fetch') + ->with($result['feeds'][0]); + $response = $this->class->create('hi', 4, 'yo'); $this->assertEquals($result, $response); -- cgit v1.2.3