[Pkg-owncloud-commits] [owncloud] 58/74: Consolidate if statement, and update unit test
David Prévot
taffit at moszumanska.debian.org
Tue Dec 2 22:04:38 UTC 2014
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository owncloud.
commit b96b601017a822079dfdc656663514674a8c5e38
Author: Miguel Prokop <miguel.prokop at vtu.com>
Date: Fri Nov 21 13:31:56 2014 +0100
Consolidate if statement, and update unit test
---
lib/private/share/helper.php | 6 ++----
tests/lib/share/helper.php | 6 ++----
2 files changed, 4 insertions(+), 8 deletions(-)
diff --git a/lib/private/share/helper.php b/lib/private/share/helper.php
index 1ebcdb5..6bbb101 100644
--- a/lib/private/share/helper.php
+++ b/lib/private/share/helper.php
@@ -204,10 +204,8 @@ class Helper extends \OC\Share\Constants {
} else {
$expires = $userExpireDate;
}
- } else {
- if ($defaultExpires && !empty($defaultExpireSettings['enforceExpireDate'])) {
- $expires = $defaultExpires;
- }
+ } else if ($defaultExpires && !empty($defaultExpireSettings['enforceExpireDate'])) {
+ $expires = $defaultExpires;
}
return $expires;
diff --git a/tests/lib/share/helper.php b/tests/lib/share/helper.php
index 3675074..32dcb4d 100644
--- a/tests/lib/share/helper.php
+++ b/tests/lib/share/helper.php
@@ -27,8 +27,8 @@ class Test_Share_Helper extends PHPUnit_Framework_TestCase {
array(array('defaultExpireDateSet' => false), 2000000000, 2000010000, 2000010000),
// no default expire date and no user defined expire date, return false
array(array('defaultExpireDateSet' => false), 2000000000, null, false),
- // unenforced expire data and no user defined expire date, take default expire date
- array(array('defaultExpireDateSet' => true, 'expireAfterDays' => 1, 'enforceExpireDate' => false), 2000000000, null, 2000086400),
+ // unenforced expire data and no user defined expire date, return false (because the default is not enforced)
+ array(array('defaultExpireDateSet' => true, 'expireAfterDays' => 1, 'enforceExpireDate' => false), 2000000000, null, false),
// enforced expire date and no user defined expire date, take default expire date
array(array('defaultExpireDateSet' => true, 'expireAfterDays' => 1, 'enforceExpireDate' => true), 2000000000, null, 2000086400),
// unenforced expire date and user defined date > default expire date, take users expire date
@@ -49,6 +49,4 @@ class Test_Share_Helper extends PHPUnit_Framework_TestCase {
$result = \OC\Share\Helper::calculateExpireDate($defaultExpireSettings, $creationTime, $userExpireDate);
$this->assertSame($expected, $result);
}
-
-
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git
More information about the Pkg-owncloud-commits
mailing list