diff options
author | WENDLING NICOLAS <nicolas.wendling2@etu.unistra.fr> | 2021-02-16 16:16:41 +0100 |
---|---|---|
committer | Sean Molenaar <SMillerDev@users.noreply.github.com> | 2021-04-08 22:31:21 +0200 |
commit | 615668d6886714719e2d0786626e1f85d202fbf8 (patch) | |
tree | 300fc3d713cf6d8b1a0f207a6e7aca766b45c0b2 /tests/Unit/Service | |
parent | 4133e68c8ec87fd53dc424a4512758acbd4dc7d6 (diff) |
✅ Unary test for itemShare from itemService class
Signed-off-by: Marco Nassabain <marco.nassabain@hotmail.com>
Diffstat (limited to 'tests/Unit/Service')
-rw-r--r-- | tests/Unit/Service/ItemServiceTest.php | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/Unit/Service/ItemServiceTest.php b/tests/Unit/Service/ItemServiceTest.php index f91692cda..ce4e927e2 100644 --- a/tests/Unit/Service/ItemServiceTest.php +++ b/tests/Unit/Service/ItemServiceTest.php @@ -630,4 +630,29 @@ class ItemServiceTest extends TestCase $this->class->purgeOverThreshold(5); } + public function testShareItem() + { + $itemId = 3; + + $this->mapper->expects($this->once()) + ->method('shareItem') + ->with( + $this->equalTo($itemId), + $this->equalTo('john'), + $this->equalTo('jack') + ) + ->will($this->returnValue(new Item())); + + $this->itemService->shareItem($itemId, 'john','jack'); + } + + public function testShareItemDoesNotExist() + { + $this->expectException(ServiceNotFoundException::class); + $this->mapper->expects($this->once()) + ->method('shareItem') + ->will($this->throwException(new DoesNotExistException(''))); + + $this->itemService->shareItem(1, 'john', 'jack'); + } } |