From bfcdf40a64fd3217803c59c4e2057fc573407595 Mon Sep 17 00:00:00 2001 From: Roeland Jago Douma Date: Fri, 26 Feb 2016 11:38:06 +0100 Subject: Expiration date can only be enforced if default is enabled If the default expiration date is not enebaled it can not be enforced. * Added unit tests --- tests/lib/share20/managertest.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'tests') diff --git a/tests/lib/share20/managertest.php b/tests/lib/share20/managertest.php index 2c40bf65c2c..d388d56ce3d 100644 --- a/tests/lib/share20/managertest.php +++ b/tests/lib/share20/managertest.php @@ -744,12 +744,27 @@ class ManagerTest extends \Test\TestCase { $share = $this->manager->newShare(); $share->setProviderId('foo')->setId('bar'); + $this->config->method('getAppValue') + ->will($this->returnValueMap([ + ['core', 'shareapi_default_expire_date', 'no', 'yes'], + ['core', 'shareapi_enforce_expire_date', 'no', 'yes'], + ])); + + $this->invokePrivate($this->manager, 'validateExpirationDate', [$share]); + } + + public function testvalidateExpirationDateEnforceButNotEnabledAndNotSet() { + $share = $this->manager->newShare(); + $share->setProviderId('foo')->setId('bar'); + $this->config->method('getAppValue') ->will($this->returnValueMap([ ['core', 'shareapi_enforce_expire_date', 'no', 'yes'], ])); $this->invokePrivate($this->manager, 'validateExpirationDate', [$share]); + + $this->assertNull($share->getExpirationDate()); } public function testvalidateExpirationDateEnforceButNotSetNewShare() { -- cgit v1.2.3