summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorSean Molenaar <sean@seanmolenaar.eu>2021-01-18 19:56:26 +0100
committerSean Molenaar <SMillerDev@users.noreply.github.com>2021-01-18 20:15:13 +0100
commit582c4d11facc0c8c97ae14d370b6c4f69b210124 (patch)
tree6fea68f1918e2f05ca140e716cf18b3d7d8993c2 /tests
parent8e0a8fc1d2d0f92ea7f02795eb144f3a8a977d80 (diff)
Controllers: Fetch feed after creating
Signed-off-by: Sean Molenaar <sean@seanmolenaar.eu>
Diffstat (limited to 'tests')
-rw-r--r--tests/Unit/Controller/FeedApiControllerTest.php8
-rw-r--r--tests/Unit/Controller/FeedControllerTest.php21
2 files changed, 27 insertions, 2 deletions
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);