diff options
author | Roeland Jago Douma <rullzer@owncloud.com> | 2016-02-05 15:34:30 +0100 |
---|---|---|
committer | Roeland Jago Douma <rullzer@owncloud.com> | 2016-02-06 13:31:54 +0100 |
commit | 3028ec5440a3c4d448bbaf8a6b246391bea22317 (patch) | |
tree | 2b7819a910f5d6ae06efd4f200ce7c347a8c9a64 /tests | |
parent | 5ed56d9edb54bf3f977ea12f44fca9e4b650c72b (diff) | |
download | nextcloud-server-3028ec5440a3c4d448bbaf8a6b246391bea22317.tar.gz nextcloud-server-3028ec5440a3c4d448bbaf8a6b246391bea22317.zip |
Delete expired share when fetched by id
Diffstat (limited to 'tests')
-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 */ |