diff --git a/lib/private/share20/manager.php b/lib/private/share20/manager.php index 12893c2696..7a10d6cba5 100644 --- a/lib/private/share20/manager.php +++ b/lib/private/share20/manager.php @@ -718,9 +718,9 @@ class Manager implements IManager { * @throws \InvalidArgumentException */ public function deleteShare(\OCP\Share\IShare $share) { - // Just to make sure we have all the info + try { - $share = $this->getShareById($share->getFullId()); + $share->getFullId(); } catch (\UnexpectedValueException $e) { throw new \InvalidArgumentException('Share does not have a full id'); } diff --git a/tests/lib/share20/managertest.php b/tests/lib/share20/managertest.php index 1230c191b6..bb91ed0d51 100644 --- a/tests/lib/share20/managertest.php +++ b/tests/lib/share20/managertest.php @@ -132,16 +132,10 @@ class ManagerTest extends \Test\TestCase { } /** - * @expectedException \OCP\Share\Exceptions\ShareNotFound + * @expectedException \InvalidArgumentException */ public function testDeleteNoShareId() { - $share = $this->getMock('\OCP\Share\IShare'); - - $share - ->expects($this->once()) - ->method('getFullId') - ->with() - ->willReturn(null); + $share = $this->manager->newShare(); $this->manager->deleteShare($share); } @@ -181,7 +175,6 @@ class ManagerTest extends \Test\TestCase { ->setNode($path) ->setTarget('myTarget'); - $manager->expects($this->once())->method('getShareById')->with('prov:42')->willReturn($share); $manager->expects($this->once())->method('deleteChildren')->with($share); $this->defaultProvider @@ -261,7 +254,6 @@ class ManagerTest extends \Test\TestCase { $this->rootFolder->expects($this->never())->method($this->anything()); - $manager->expects($this->once())->method('getShareById')->with('prov:42')->willReturn($share); $manager->expects($this->once())->method('deleteChildren')->with($share); $this->defaultProvider @@ -359,8 +351,6 @@ class ManagerTest extends \Test\TestCase { ->setTarget('myTarget3') ->setParent(43); - $manager->expects($this->once())->method('getShareById')->with('prov:42')->willReturn($share1); - $this->defaultProvider ->method('getChildren') ->will($this->returnValueMap([