@@ -1153,7 +1153,7 @@ public function testValidateExpirationDateInternalEnforceButNotSetNewShare($shar
11531153 }
11541154
11551155 $ expected = new \DateTime ('now ' , $ this ->timezone );
1156- $ expected ->setTime (0 , 0 , 0 );
1156+ $ expected ->setTime (23 , 59 , 59 );
11571157 $ expected ->add (new \DateInterval ('P3D ' ));
11581158
11591159 self ::invokePrivate ($ this ->manager , 'validateExpirationDateInternal ' , [$ share ]);
@@ -1188,7 +1188,7 @@ public function testValidateExpirationDateInternalEnforceRelaxedDefaultButNotSet
11881188 }
11891189
11901190 $ expected = new \DateTime ('now ' , $ this ->timezone );
1191- $ expected ->setTime (0 , 0 , 0 );
1191+ $ expected ->setTime (23 , 59 , 59 );
11921192 $ expected ->add (new \DateInterval ('P1D ' ));
11931193
11941194 self ::invokePrivate ($ this ->manager , 'validateExpirationDateInternal ' , [$ share ]);
@@ -1239,7 +1239,7 @@ public function testValidateExpirationDateInternalEnforceValid($shareType): void
12391239 $ future ->setTime (1 , 2 , 3 );
12401240
12411241 $ expected = clone $ future ;
1242- $ expected ->setTime (0 , 0 , 0 );
1242+ $ expected ->setTime (23 , 59 , 59 );
12431243
12441244 $ share = $ this ->manager ->newShare ();
12451245 $ share ->setShareType ($ shareType );
@@ -1281,7 +1281,7 @@ public function testValidateExpirationDateInternalNoDefault($shareType): void {
12811281 $ date ->setTime (1 , 2 , 3 );
12821282
12831283 $ expected = clone $ date ;
1284- $ expected ->setTime (0 , 0 , 0 );
1284+ $ expected ->setTime (23 , 59 , 59 );
12851285
12861286 $ share = $ this ->manager ->newShare ();
12871287 $ share ->setShareType ($ shareType );
@@ -1325,7 +1325,7 @@ public function testValidateExpirationDateInternalNoDateDefault($shareType): voi
13251325 $ share ->setShareType ($ shareType );
13261326
13271327 $ expected = new \DateTime ('now ' , $ this ->timezone );
1328- $ expected ->setTime (0 , 0 );
1328+ $ expected ->setTime (23 , 59 , 59 );
13291329 $ expected ->add (new \DateInterval ('P3D ' ));
13301330 $ expected ->setTimezone (new \DateTimeZone (date_default_timezone_get ()));
13311331
@@ -1365,7 +1365,7 @@ public function testValidateExpirationDateInternalDefault($shareType): void {
13651365 $ future ->setTime (1 , 2 , 3 );
13661366
13671367 $ expected = clone $ future ;
1368- $ expected ->setTime (0 , 0 );
1368+ $ expected ->setTime (23 , 59 , 59 );
13691369
13701370 $ share = $ this ->manager ->newShare ();
13711371 $ share ->setShareType ($ shareType );
@@ -1404,7 +1404,7 @@ public function testValidateExpirationDateInternalDefault($shareType): void {
14041404 public function testValidateExpirationDateInternalHookModification ($ shareType ): void {
14051405 $ nextWeek = new \DateTime ('now ' , $ this ->timezone );
14061406 $ nextWeek ->add (new \DateInterval ('P7D ' ));
1407- $ nextWeek ->setTime (0 , 0 , 0 );
1407+ $ nextWeek ->setTime (23 , 59 , 59 );
14081408
14091409 $ save = clone $ nextWeek ;
14101410
@@ -1433,7 +1433,7 @@ public function testValidateExpirationDateInternalHookException($shareType): voi
14331433
14341434 $ nextWeek = new \DateTime ();
14351435 $ nextWeek ->add (new \DateInterval ('P7D ' ));
1436- $ nextWeek ->setTime (0 , 0 , 0 );
1436+ $ nextWeek ->setTime (23 , 59 , 59 );
14371437
14381438 $ share = $ this ->manager ->newShare ();
14391439 $ share ->setShareType ($ shareType );
@@ -1532,7 +1532,7 @@ public function testValidateExpirationDateEnforceButNotSetNewShare(): void {
15321532 ]);
15331533
15341534 $ expected = new \DateTime ('now ' , $ this ->timezone );
1535- $ expected ->setTime (0 , 0 , 0 );
1535+ $ expected ->setTime (23 , 59 , 59 );
15361536 $ expected ->add (new \DateInterval ('P3D ' ));
15371537
15381538 self ::invokePrivate ($ this ->manager , 'validateExpirationDateLink ' , [$ share ]);
@@ -1553,7 +1553,7 @@ public function testValidateExpirationDateEnforceRelaxedDefaultButNotSetNewShare
15531553 ]);
15541554
15551555 $ expected = new \DateTime ('now ' , $ this ->timezone );
1556- $ expected ->setTime (0 , 0 , 0 );
1556+ $ expected ->setTime (23 , 59 , 59 );
15571557 $ expected ->add (new \DateInterval ('P1D ' ));
15581558
15591559 self ::invokePrivate ($ this ->manager , 'validateExpirationDateLink ' , [$ share ]);
@@ -1588,7 +1588,7 @@ public function testValidateExpirationDateEnforceValid(): void {
15881588 $ future ->setTime (1 , 2 , 3 );
15891589
15901590 $ expected = clone $ future ;
1591- $ expected ->setTime (0 , 0 , 0 );
1591+ $ expected ->setTime (23 , 59 , 59 );
15921592
15931593 $ share = $ this ->manager ->newShare ();
15941594 $ share ->setExpirationDate ($ future );
@@ -1617,7 +1617,7 @@ public function testValidateExpirationDateNoDefault(): void {
16171617 $ date ->setTime (1 , 2 , 3 );
16181618
16191619 $ expected = clone $ date ;
1620- $ expected ->setTime (0 , 0 );
1620+ $ expected ->setTime (23 , 59 , 59 );
16211621 $ expected ->setTimezone (new \DateTimeZone (date_default_timezone_get ()));
16221622
16231623 $ share = $ this ->manager ->newShare ();
@@ -1654,7 +1654,7 @@ public function testValidateExpirationDateNoDateDefault(): void {
16541654
16551655 $ expected = new \DateTime ('now ' , $ this ->timezone );
16561656 $ expected ->add (new \DateInterval ('P3D ' ));
1657- $ expected ->setTime (0 , 0 );
1657+ $ expected ->setTime (23 , 59 , 59 );
16581658 $ expected ->setTimezone (new \DateTimeZone (date_default_timezone_get ()));
16591659
16601660 $ this ->config ->method ('getAppValue ' )
@@ -1681,7 +1681,7 @@ public function testValidateExpirationDateDefault(): void {
16811681 $ future ->setTime (1 , 2 , 3 );
16821682
16831683 $ expected = clone $ future ;
1684- $ expected ->setTime (0 , 0 );
1684+ $ expected ->setTime (23 , 59 , 59 );
16851685 $ expected ->setTimezone (new \DateTimeZone (date_default_timezone_get ()));
16861686
16871687 $ share = $ this ->manager ->newShare ();
@@ -1712,7 +1712,7 @@ public function testValidateExpirationNegativeOffsetTimezone(): void {
17121712
17131713 $ expected = clone $ future ;
17141714 $ expected ->setTimezone ($ this ->timezone );
1715- $ expected ->setTime (0 , 0 );
1715+ $ expected ->setTime (23 , 59 , 59 );
17161716 $ expected ->setTimezone (new \DateTimeZone (date_default_timezone_get ()));
17171717
17181718 $ share = $ this ->manager ->newShare ();
@@ -1741,7 +1741,7 @@ public function testValidateExpirationDateHookModification(): void {
17411741 $ nextWeek ->add (new \DateInterval ('P7D ' ));
17421742
17431743 $ save = clone $ nextWeek ;
1744- $ save ->setTime (0 , 0 );
1744+ $ save ->setTime (23 , 59 , 59 );
17451745 $ save ->sub (new \DateInterval ('P2D ' ));
17461746 $ save ->setTimezone (new \DateTimeZone (date_default_timezone_get ()));
17471747
@@ -1765,7 +1765,7 @@ public function testValidateExpirationDateHookException(): void {
17651765
17661766 $ nextWeek = new \DateTime ();
17671767 $ nextWeek ->add (new \DateInterval ('P7D ' ));
1768- $ nextWeek ->setTime (0 , 0 , 0 );
1768+ $ nextWeek ->setTime (23 , 59 , 59 );
17691769
17701770 $ share = $ this ->manager ->newShare ();
17711771 $ share ->setExpirationDate ($ nextWeek );
@@ -2425,7 +2425,7 @@ public function testCanShare($expected, $sharingEnabled, $disabledForUser): void
24252425 public function testCreateShareUser (): void {
24262426 /** @var Manager&MockObject $manager */
24272427 $ manager = $ this ->createManagerMock ()
2428- ->onlyMethods (['canShare ' , 'generalCreateChecks ' , 'userCreateChecks ' , 'pathCreateChecks ' ])
2428+ ->onlyMethods (['canShare ' , 'generalCreateChecks ' , 'userCreateChecks ' , 'pathCreateChecks ' , ' validateExpirationDateInternal ' ])
24292429 ->getMock ();
24302430
24312431 $ shareOwner = $ this ->createMock (IUser::class);
@@ -2461,6 +2461,10 @@ public function testCreateShareUser(): void {
24612461 $ manager ->expects ($ this ->once ())
24622462 ->method ('pathCreateChecks ' )
24632463 ->with ($ path );
2464+ $ manager ->expects ($ this ->once ())
2465+ ->method ('validateExpirationDateInternal ' )
2466+ ->with ($ share )
2467+ ->willReturnArgument (0 );
24642468
24652469 $ this ->defaultProvider
24662470 ->expects ($ this ->once ())
@@ -2480,7 +2484,7 @@ public function testCreateShareUser(): void {
24802484
24812485 public function testCreateShareGroup (): void {
24822486 $ manager = $ this ->createManagerMock ()
2483- ->setMethods (['canShare ' , 'generalCreateChecks ' , 'groupCreateChecks ' , 'pathCreateChecks ' ])
2487+ ->setMethods (['canShare ' , 'generalCreateChecks ' , 'groupCreateChecks ' , 'pathCreateChecks ' , ' validateExpirationDateInternal ' ])
24842488 ->getMock ();
24852489
24862490 $ shareOwner = $ this ->createMock (IUser::class);
@@ -2516,6 +2520,10 @@ public function testCreateShareGroup(): void {
25162520 $ manager ->expects ($ this ->once ())
25172521 ->method ('pathCreateChecks ' )
25182522 ->with ($ path );
2523+ $ manager ->expects ($ this ->once ())
2524+ ->method ('validateExpirationDateInternal ' )
2525+ ->with ($ share )
2526+ ->willReturnArgument (0 );
25192527
25202528 $ this ->defaultProvider
25212529 ->expects ($ this ->once ())
@@ -2767,6 +2775,7 @@ public function testCreateShareHookError(): void {
27672775 'generalCreateChecks ' ,
27682776 'userCreateChecks ' ,
27692777 'pathCreateChecks ' ,
2778+ 'validateExpirationDateInternal ' ,
27702779 ])
27712780 ->getMock ();
27722781
@@ -2803,6 +2812,10 @@ public function testCreateShareHookError(): void {
28032812 $ manager ->expects ($ this ->once ())
28042813 ->method ('pathCreateChecks ' )
28052814 ->with ($ path );
2815+ $ manager ->expects ($ this ->once ())
2816+ ->method ('validateExpirationDateInternal ' )
2817+ ->with ($ share )
2818+ ->willReturnArgument (0 );
28062819
28072820 $ share ->expects ($ this ->once ())
28082821 ->method ('setShareOwner ' )
@@ -2827,7 +2840,7 @@ public function testCreateShareHookError(): void {
28272840
28282841 public function testCreateShareOfIncomingFederatedShare (): void {
28292842 $ manager = $ this ->createManagerMock ()
2830- ->setMethods (['canShare ' , 'generalCreateChecks ' , 'userCreateChecks ' , 'pathCreateChecks ' ])
2843+ ->setMethods (['canShare ' , 'generalCreateChecks ' , 'userCreateChecks ' , 'pathCreateChecks ' , ' validateExpirationDateInternal ' ])
28312844 ->getMock ();
28322845
28332846 $ shareOwner = $ this ->createMock (IUser::class);
@@ -2882,6 +2895,10 @@ public function testCreateShareOfIncomingFederatedShare(): void {
28822895 $ manager ->expects ($ this ->once ())
28832896 ->method ('pathCreateChecks ' )
28842897 ->with ($ path );
2898+ $ manager ->expects ($ this ->once ())
2899+ ->method ('validateExpirationDateInternal ' )
2900+ ->with ($ share )
2901+ ->willReturnArgument (0 );
28852902
28862903 $ this ->defaultProvider
28872904 ->expects ($ this ->once ())
0 commit comments