diff options
Diffstat (limited to 'tests/lib/share20/managertest.php')
-rw-r--r-- | tests/lib/share20/managertest.php | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/lib/share20/managertest.php b/tests/lib/share20/managertest.php index d93a881a448..55c13f03f8c 100644 --- a/tests/lib/share20/managertest.php +++ b/tests/lib/share20/managertest.php @@ -501,6 +501,33 @@ class ManagerTest extends \Test\TestCase { } /** + * @expectedException \OCP\Share\Exceptions\ShareNotFound + */ + public function testGetExpiredShareById() { + $manager = $this->createManagerMock() + ->setMethods(['deleteShare']) + ->getMock(); + + $date = new \DateTime(); + $date->setTime(0,0,0); + + $share = $this->manager->newShare(); + $share->setExpirationDate($date) + ->setShareType(\OCP\Share::SHARE_TYPE_LINK); + + $this->defaultProvider->expects($this->once()) + ->method('getShareById') + ->with('42') + ->willReturn($share); + + $manager->expects($this->once()) + ->method('deleteShare') + ->with($share); + + $manager->getShareById('default:42'); + } + + /** * @expectedException InvalidArgumentException * @expectedExceptionMessage Passwords are enforced for link shares */ |