summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/Unit/Service/ItemServiceTest.php48
1 files changed, 34 insertions, 14 deletions
diff --git a/tests/Unit/Service/ItemServiceTest.php b/tests/Unit/Service/ItemServiceTest.php
index 410f87904..ff12a53f0 100644
--- a/tests/Unit/Service/ItemServiceTest.php
+++ b/tests/Unit/Service/ItemServiceTest.php
@@ -113,6 +113,17 @@ class ItemServiceTest extends TestCase
$result = $this->class->findAllInFolderAfter($this->user, 2, 20333, true);
$this->assertEquals([], $result);
}
+
+ public function testFindAllNewShared()
+ {
+ $this->mapper->expects($this->once())
+ ->method('findAllSharedAfter')
+ ->with('jack', 20333, true)
+ ->will($this->returnValue([]));
+
+ $result = $this->class->findAllSharedAfter($this->user, 20333, true);
+ $this->assertEquals([], $result);
+ }
public function testFindAllNewItem()
{
@@ -177,23 +188,20 @@ class ItemServiceTest extends TestCase
public function testFindAllShared()
{
- $type = FeedType::SHARED;
- $this->mapper->expects($this->once())
- ->method('findAllShared')
- ->with(
- $this->equalTo(20),
- $this->equalTo(5),
- $this->equalTo(true),
- $this->equalTo(true),
- $this->equalTo('jack'),
- $this->equalTo([])
- )
+ $this->mapper->expects($this->once())
+ ->method('findAllSharedWithUser')
+ ->with('user', 20, 5, true, true, [])
->will($this->returnValue(['val']));
- $result = $this->itemService->findAllItems(
- 3, $type, 20, 5,
- true, true, 'jack'
+ $result = $this->class->findAllSharedWithUserWithFilters(
+ 'user',
+ 20,
+ 5,
+ true,
+ true,
+ []
);
+
$this->assertEquals(['val'], $result);
}
@@ -709,4 +717,16 @@ class ItemServiceTest extends TestCase
$this->class->share('sender', 1, 'recipient');
}
+
+ public function testSharedCount()
+ {
+ $this->mapper->expects($this->once())
+ ->method('findAllFromUser')
+ ->with('user', ['shared_with' => 'user', 'unread' => true])
+ ->will($this->returnValue([new Item(), new Item()]));
+
+ $result = $this->class->sharedWithUser('user');
+
+ $this->assertEquals(2, count($result));
+ }
}