From b55ef51a27e73a30e0829e273cdf111e21a77403 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Tue, 28 Apr 2015 14:56:13 +0200 Subject: Add tests for the correct share id on the call aswell --- tests/lib/share/share.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'tests') diff --git a/tests/lib/share/share.php b/tests/lib/share/share.php index 23274c394c6..3aec11cf6a5 100644 --- a/tests/lib/share/share.php +++ b/tests/lib/share/share.php @@ -1061,16 +1061,19 @@ class Test_Share extends \Test\TestCase { ->with($this->stringStartsWith('http://' . $urlHost . '/ocs/v1.php/cloud/shares'), $this->anything()) ->willReturn(['success' => true, 'result' => json_encode(['ocs' => ['meta' => ['statuscode' => 100]]])]); - $httpHelperMock->expects($this->at(2)) + \OCP\Share::shareItem('test', 'test.txt', \OCP\Share::SHARE_TYPE_REMOTE, $shareWith, \OCP\Constants::PERMISSION_READ); + $shares = \OCP\Share::getItemShared('test', 'test.txt'); + $share = array_shift($shares); + + $httpHelperMock->expects($this->at(0)) ->method('post') - ->with($this->stringStartsWith('https://' . $urlHost . '/ocs/v1.php/cloud/shares'), $this->anything()) + ->with($this->stringStartsWith('https://' . $urlHost . '/ocs/v1.php/cloud/shares/' . $share['id'] . '/unshare'), $this->anything()) ->willReturn(['success' => false, 'result' => 'Exception']); - $httpHelperMock->expects($this->at(3)) + $httpHelperMock->expects($this->at(1)) ->method('post') - ->with($this->stringStartsWith('http://' . $urlHost . '/ocs/v1.php/cloud/shares'), $this->anything()) + ->with($this->stringStartsWith('http://' . $urlHost . '/ocs/v1.php/cloud/shares/' . $share['id'] . '/unshare'), $this->anything()) ->willReturn(['success' => true, 'result' => json_encode(['ocs' => ['meta' => ['statuscode' => 100]]])]); - \OCP\Share::shareItem('test', 'test.txt', \OCP\Share::SHARE_TYPE_REMOTE, $shareWith, \OCP\Constants::PERMISSION_READ); \OCP\Share::unshare('test', 'test.txt', \OCP\Share::SHARE_TYPE_REMOTE, $shareWith); $this->setHttpHelper($oldHttpHelper); } -- cgit v1.2.3