From 91c034c72f30618ff198e948d9ea21bac2afc6aa Mon Sep 17 00:00:00 2001 From: Marco Nassabain Date: Fri, 26 Feb 2021 00:13:19 +0100 Subject: =?UTF-8?q?=E2=9C=85=20Fix=20ItemController=20share=20tests=20-=20?= =?UTF-8?q?testShare=20-=20testShareDoesNotExist?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Marco Nassabain --- tests/Unit/Controller/ItemControllerTest.php | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) (limited to 'tests/Unit') diff --git a/tests/Unit/Controller/ItemControllerTest.php b/tests/Unit/Controller/ItemControllerTest.php index a35df1552..b2f833868 100644 --- a/tests/Unit/Controller/ItemControllerTest.php +++ b/tests/Unit/Controller/ItemControllerTest.php @@ -131,15 +131,10 @@ class ItemControllerTest extends TestCase public function testShare() { $this->itemService->expects($this->once()) - ->method('checkSharing') - ->with(4, 'bob', 'jackob') - ->will($this->returnValue(0)); + ->method('share') + ->with('user', 4, 'test'); - $this->itemService->expects($this->once()) - ->method('shareItem') - ->with(4, 'bob', 'jackob'); - - $this->controller->share(4, 'bob'); + $this->controller->share(4, 'test'); } @@ -148,16 +143,11 @@ class ItemControllerTest extends TestCase $msg = 'hi'; $this->itemService->expects($this->once()) - ->method('checkSharing') - ->with(4, 'bob', 'jackob') - ->will($this->returnValue(0)); - - $this->itemService->expects($this->once()) - ->method('shareItem') - ->with(4, 'bob', 'jackob') + ->method('share') + ->with('user', 4, 'test') ->will($this->throwException(new ServiceNotFoundException($msg))); - $response = $this->controller->share(4, 'bob'); + $response = $this->controller->share(4, 'test'); $params = json_decode($response->render(), true); $this->assertEquals($response->getStatus(), Http::STATUS_NOT_FOUND); -- cgit v1.2.3