Skip to content

Commit dbaf5f5

Browse files
committed
test(share): Update expiration date tests for end-of-day time
Update expected values in ManagerTest to reflect the new behavior where share expiration dates are set to 23:59:59 instead of 00:00:00. Signed-off-by: nfebe <fenn25.fn@gmail.com>
1 parent 723314c commit dbaf5f5

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

apps/files_sharing/tests/Controller/ShareAPIControllerTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -773,7 +773,7 @@ public static function dataGetShare(): array {
773773
$data['Folder shared with group'] = [$share, $expected, true];
774774

775775
// File shared by link with Expire
776-
$expire = \DateTime::createFromFormat('Y-m-d h:i:s', '2000-01-02 01:02:03');
776+
$expire = \DateTime::createFromFormat('Y-m-d H:i:s', '2000-01-02 23:59:59');
777777
$share = [
778778
'101',
779779
IShare::TYPE_LINK,
@@ -807,7 +807,7 @@ public static function dataGetShare(): array {
807807
'file_target' => 'target',
808808
'file_parent' => 3,
809809
'token' => 'token',
810-
'expiration' => '2000-01-02 00:00:00',
810+
'expiration' => '2000-01-02 23:59:59',
811811
'permissions' => 4,
812812
'attributes' => null,
813813
'stime' => 5,

tests/lib/Share20/ManagerTest.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1199,7 +1199,7 @@ public function testValidateExpirationDateInternalEnforceButNotSetNewShare($shar
11991199
}
12001200

12011201
$expected = new \DateTime('now', $this->timezone);
1202-
$expected->setTime(0, 0, 0);
1202+
$expected->setTime(23, 59, 59);
12031203
$expected->add(new \DateInterval('P3D'));
12041204

12051205
self::invokePrivate($this->manager, 'validateExpirationDateInternal', [$share]);
@@ -1232,7 +1232,7 @@ public function testValidateExpirationDateInternalEnforceRelaxedDefaultButNotSet
12321232
}
12331233

12341234
$expected = new \DateTime('now', $this->timezone);
1235-
$expected->setTime(0, 0, 0);
1235+
$expected->setTime(23, 59, 59);
12361236
$expected->add(new \DateInterval('P1D'));
12371237

12381238
self::invokePrivate($this->manager, 'validateExpirationDateInternal', [$share]);
@@ -1279,7 +1279,7 @@ public function testValidateExpirationDateInternalEnforceValid($shareType): void
12791279
$future->setTime(1, 2, 3);
12801280

12811281
$expected = clone $future;
1282-
$expected->setTime(0, 0, 0);
1282+
$expected->setTime(23, 59, 59);
12831283

12841284
$share = $this->manager->newShare();
12851285
$share->setShareType($shareType);
@@ -1319,7 +1319,7 @@ public function testValidateExpirationDateInternalNoDefault($shareType): void {
13191319
$date->setTime(1, 2, 3);
13201320

13211321
$expected = clone $date;
1322-
$expected->setTime(0, 0, 0);
1322+
$expected->setTime(23, 59, 59);
13231323

13241324
$share = $this->manager->newShare();
13251325
$share->setShareType($shareType);
@@ -1562,7 +1562,7 @@ public function testValidateExpirationDateEnforceButNotSetNewShare(): void {
15621562
]);
15631563

15641564
$expected = new \DateTime('now', $this->timezone);
1565-
$expected->setTime(0, 0, 0);
1565+
$expected->setTime(23, 59, 59);
15661566
$expected->add(new \DateInterval('P3D'));
15671567

15681568
self::invokePrivate($this->manager, 'validateExpirationDateLink', [$share]);
@@ -1587,7 +1587,7 @@ public function testValidateExpirationDateEnforceRelaxedDefaultButNotSetNewShare
15871587
]);
15881588

15891589
$expected = new \DateTime('now', $this->timezone);
1590-
$expected->setTime(0, 0, 0);
1590+
$expected->setTime(23, 59, 59);
15911591
$expected->add(new \DateInterval('P1D'));
15921592

15931593
self::invokePrivate($this->manager, 'validateExpirationDateLink', [$share]);
@@ -1626,7 +1626,7 @@ public function testValidateExpirationDateEnforceValid(): void {
16261626
$future->setTime(1, 2, 3);
16271627

16281628
$expected = clone $future;
1629-
$expected->setTime(0, 0, 0);
1629+
$expected->setTime(23, 59, 59);
16301630

16311631
$share = $this->manager->newShare();
16321632
$share->setExpirationDate($future);

0 commit comments

Comments
 (0)