Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Calviño Sánchez <danxuliu@gmail.com>2020-11-12 11:34:58 +0300
committerDaniel Calviño Sánchez <danxuliu@gmail.com>2020-11-12 13:57:32 +0300
commit70018ddabf5214a1a90320a0bd4fb3273df7493d (patch)
tree33942e0ff78ee030efb9770dc85aa0ed4429b215 /tests/lib/Share20
parent3a53c2b6e57e3be9a0c78fb8c004ab2d00133751 (diff)
Fix unit test for expiration date without date but with default
The expiration date was explicitly given, so it was not testing what it should. Moreover, "link_defaultExpDays" needs to be mapped when testing the default value (even if it will just fallback to the value of "shareapi_expire_after_n_days"). Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Diffstat (limited to 'tests/lib/Share20')
-rw-r--r--tests/lib/Share20/ManagerTest.php12
1 files changed, 5 insertions, 7 deletions
diff --git a/tests/lib/Share20/ManagerTest.php b/tests/lib/Share20/ManagerTest.php
index d6e8081a8c6..822b6a7360e 100644
--- a/tests/lib/Share20/ManagerTest.php
+++ b/tests/lib/Share20/ManagerTest.php
@@ -940,19 +940,17 @@ class ManagerTest extends \Test\TestCase {
}
public function testValidateExpirationDateNoDateDefault() {
- $future = new \DateTime();
- $future->add(new \DateInterval('P3D'));
- $future->setTime(0,0,0);
-
- $expected = clone $future;
-
$share = $this->manager->newShare();
- $share->setExpirationDate($future);
+
+ $expected = new \DateTime();
+ $expected->add(new \DateInterval('P3D'));
+ $expected->setTime(0,0,0);
$this->config->method('getAppValue')
->willReturnMap([
['core', 'shareapi_default_expire_date', 'no', 'yes'],
['core', 'shareapi_expire_after_n_days', '7', '3'],
+ ['core', 'link_defaultExpDays', 3, '3'],
]);
$hookListener = $this->getMockBuilder('Dummy')->setMethods(['listener'])->getMock();