diff options
author | Daniel Calviño Sánchez <danxuliu@gmail.com> | 2020-11-12 09:34:58 +0100 |
---|---|---|
committer | backportbot[bot] <backportbot[bot]@users.noreply.github.com> | 2020-11-16 13:16:53 +0000 |
commit | 115a988cd29fcc0d0e629bd815096614d48bf269 (patch) | |
tree | 14f9f728e75d397a0d693ae6bb696e22f57d60eb /tests | |
parent | eaa43d22e29c1b8f8877a78433d9c8dabb9ec4a3 (diff) | |
download | nextcloud-server-115a988cd29fcc0d0e629bd815096614d48bf269.tar.gz nextcloud-server-115a988cd29fcc0d0e629bd815096614d48bf269.zip |
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')
-rw-r--r-- | tests/lib/Share20/ManagerTest.php | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/tests/lib/Share20/ManagerTest.php b/tests/lib/Share20/ManagerTest.php index c7986c5f50a..ad2f536f6da 100644 --- a/tests/lib/Share20/ManagerTest.php +++ b/tests/lib/Share20/ManagerTest.php @@ -937,19 +937,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(); |