summaryrefslogtreecommitdiffstats
path: root/tests/Unit/Service
diff options
context:
space:
mode:
authorSean Molenaar <sean@seanmolenaar.eu>2020-12-16 22:30:19 +0100
committerSean Molenaar <SMillerDev@users.noreply.github.com>2020-12-17 10:35:23 +0100
commit11f5904dd58cbcb45e0e3e6c466f187e30323155 (patch)
tree17e7cd35948b161a0e567dec94bb9aecbe64d895 /tests/Unit/Service
parent7bebaab86e2676466eb9d104ec1a57cd9634c0b4 (diff)
Fix mapper->find and empty user sessions
Signed-off-by: Sean Molenaar <sean@seanmolenaar.eu>
Diffstat (limited to 'tests/Unit/Service')
-rw-r--r--tests/Unit/Service/FeedServiceTest.php38
-rw-r--r--tests/Unit/Service/ServiceTest.php8
2 files changed, 23 insertions, 23 deletions
diff --git a/tests/Unit/Service/FeedServiceTest.php b/tests/Unit/Service/FeedServiceTest.php
index 769453459..961d5d5e7 100644
--- a/tests/Unit/Service/FeedServiceTest.php
+++ b/tests/Unit/Service/FeedServiceTest.php
@@ -349,7 +349,7 @@ class FeedServiceTest extends TestCase
$fetchReturn = [$feed, $items];
$this->feedMapper->expects($this->exactly(2))
- ->method('find')
+ ->method('findFromUser')
->with($this->user, $feed->getId())
->will($this->returnValue($feed));
$this->fetcher->expects($this->once())
@@ -408,7 +408,7 @@ class FeedServiceTest extends TestCase
$fetchReturn = [$feed, $items];
$this->feedMapper->expects($this->exactly(2))
- ->method('find')
+ ->method('findFromUser')
->with($this->user, $feed->getId())
->will($this->returnValue($feed));
$this->fetcher->expects($this->once())
@@ -498,7 +498,7 @@ class FeedServiceTest extends TestCase
$fetchReturn = [$feed, $items];
$this->feedMapper->expects($this->exactly(2))
- ->method('find')
+ ->method('findFromUser')
->will($this->returnValue($feed));
$this->fetcher->expects($this->once())
->method('fetch')
@@ -536,7 +536,7 @@ class FeedServiceTest extends TestCase
$fetchReturn = [$feed, $items];
$this->feedMapper->expects($this->exactly(2))
- ->method('find')
+ ->method('findFromUser')
->will($this->returnValue($feed));
$this->fetcher->expects($this->once())
->method('fetch')
@@ -577,7 +577,7 @@ class FeedServiceTest extends TestCase
$items = [$item];
$this->feedMapper->expects($this->any())
- ->method('find')
+ ->method('findFromUser')
->will($this->returnValue($existingFeed));
$this->fetcher->expects($this->once())
@@ -612,7 +612,7 @@ class FeedServiceTest extends TestCase
$ex = new ReadErrorException('hi');
$this->feedMapper->expects($this->exactly(2))
- ->method('find')
+ ->method('findFromUser')
->with($this->user, $feed->getId())
->willReturnOnConsecutiveCalls($feed, $expectedFeed);
$this->fetcher->expects($this->once())
@@ -640,7 +640,7 @@ class FeedServiceTest extends TestCase
$ex = new DoesNotExistException('');
$this->feedMapper->expects($this->exactly(1))
- ->method('find')
+ ->method('findFromUser')
->with($this->user, $feed->getId())
->will($this->throwException($ex));
@@ -660,7 +660,7 @@ class FeedServiceTest extends TestCase
$ex = new DoesNotExistException('');
$this->feedMapper->expects($this->exactly(1))
- ->method('find')
+ ->method('findFromUser')
->with($this->user, $feed->getId())
->will($this->returnValue($feed));
@@ -699,7 +699,7 @@ class FeedServiceTest extends TestCase
$ex = new DoesNotExistException('');
$this->feedMapper->expects($this->exactly(2))
- ->method('find')
+ ->method('findFromUser')
->with($this->user, $feed->getId())
->willReturnOnConsecutiveCalls($feed, $this->throwException($ex));
$this->feedMapper->expects($this->exactly(1))
@@ -731,7 +731,7 @@ class FeedServiceTest extends TestCase
$feed->setPreventUpdate(true);
$this->feedMapper->expects($this->once())
- ->method('find')
+ ->method('findFromUser')
->with($this->user, $feed->getId())
->will($this->returnValue($feed));
$this->fetcher->expects($this->never())
@@ -750,7 +750,7 @@ class FeedServiceTest extends TestCase
$feed->setUrl('http://example.com');
$this->feedMapper->expects($this->once())
- ->method('find')
+ ->method('findFromUser')
->with($this->user, $feed->getId())
->will($this->returnValue($feed));
$this->fetcher->expects($this->once())
@@ -771,7 +771,7 @@ class FeedServiceTest extends TestCase
$feed->setId($feedId);
$this->feedMapper->expects($this->once())
- ->method('find')
+ ->method('findFromUser')
->with($this->user, $feedId)
->will($this->returnValue($feed));
@@ -796,7 +796,7 @@ class FeedServiceTest extends TestCase
$feed->setId($feedId);
$this->feedMapper->expects($this->once())
- ->method('find')
+ ->method('findFromUser')
->with($this->equalTo($this->user), $this->equalTo($feedId))
->will($this->returnValue($feed));
@@ -968,7 +968,7 @@ class FeedServiceTest extends TestCase
$feed2->setDeletedAt($this->time);
$this->feedMapper->expects($this->once())
- ->method('find')
+ ->method('findFromUser')
->with($this->equalTo($this->user), $this->equalTo($id))
->will($this->returnValue($feed));
$this->feedMapper->expects($this->once())
@@ -987,7 +987,7 @@ class FeedServiceTest extends TestCase
$feed2->setDeletedAt(0);
$this->feedMapper->expects($this->once())
- ->method('find')
+ ->method('findFromUser')
->with($this->equalTo($this->user), $this->equalTo($id))
->will($this->returnValue($feed));
$this->feedMapper->expects($this->once())
@@ -1064,7 +1064,7 @@ class FeedServiceTest extends TestCase
{
$feed = Feed::fromRow(['id' => 3]);
$this->feedMapper->expects($this->once())
- ->method('find')
+ ->method('findFromUser')
->with(
$this->equalTo($this->user),
$this->equalTo($feed->getId())
@@ -1092,7 +1092,7 @@ class FeedServiceTest extends TestCase
);
$feed2 = Feed::fromRow(['id' => 3]);
$this->feedMapper->expects($this->exactly(2))
- ->method('find')
+ ->method('findFromUser')
->with(
$this->equalTo($this->user),
$this->equalTo($feed->getId())
@@ -1116,7 +1116,7 @@ class FeedServiceTest extends TestCase
$this->expectException('OCA\News\Service\Exceptions\ServiceNotFoundException');
$feed = Feed::fromRow(['id' => 3]);
$this->feedMapper->expects($this->once())
- ->method('find')
+ ->method('findFromUser')
->will($this->throwException(new DoesNotExistException('')));
$this->feedService->patch(3, $this->user);
@@ -1127,7 +1127,7 @@ class FeedServiceTest extends TestCase
{
$feed = Feed::fromRow(['id' => 3, 'pinned' => false]);
$this->feedMapper->expects($this->once())
- ->method('find')
+ ->method('findFromUser')
->with($this->user, $feed->getId())
->will($this->returnValue($feed));
diff --git a/tests/Unit/Service/ServiceTest.php b/tests/Unit/Service/ServiceTest.php
index 4b6c6b03d..ce4e2e61f 100644
--- a/tests/Unit/Service/ServiceTest.php
+++ b/tests/Unit/Service/ServiceTest.php
@@ -73,7 +73,7 @@ class ServiceTest extends TestCase
->method('delete')
->with($this->equalTo($folder));
$this->mapper->expects($this->once())
- ->method('find')
+ ->method('findFromUser')
->with($this->equalTo($user), $this->equalTo($id))
->will($this->returnValue($folder));
@@ -87,7 +87,7 @@ class ServiceTest extends TestCase
$user = 'ken';
$this->mapper->expects($this->once())
- ->method('find')
+ ->method('findFromUser')
->with($this->equalTo($user), $this->equalTo($id))
->will($this->returnValue(new Feed()));
@@ -100,7 +100,7 @@ class ServiceTest extends TestCase
$ex = new DoesNotExistException('hi');
$this->mapper->expects($this->once())
- ->method('find')
+ ->method('findFromUser')
->will($this->throwException($ex));
$this->expectException(ServiceNotFoundException::class);
@@ -113,7 +113,7 @@ class ServiceTest extends TestCase
$ex = new MultipleObjectsReturnedException('hi');
$this->mapper->expects($this->once())
- ->method('find')
+ ->method('findFromUser')
->will($this->throwException($ex));
$this->expectException(ServiceNotFoundException::class);