@@ -1165,7 +1165,7 @@ public function testValidateExpirationDateInternalEnforceButNotSetNewShare($shar
11651165 }
11661166
11671167 $ expected = new \DateTime ('now ' , $ this ->timezone );
1168- $ expected ->setTime (0 , 0 , 0 );
1168+ $ expected ->setTime (23 , 59 , 59 );
11691169 $ expected ->add (new \DateInterval ('P3D ' ));
11701170
11711171 self ::invokePrivate ($ this ->manager , 'validateExpirationDateInternal ' , [$ share ]);
@@ -1198,7 +1198,7 @@ public function testValidateExpirationDateInternalEnforceRelaxedDefaultButNotSet
11981198 }
11991199
12001200 $ expected = new \DateTime ('now ' , $ this ->timezone );
1201- $ expected ->setTime (0 , 0 , 0 );
1201+ $ expected ->setTime (23 , 59 , 59 );
12021202 $ expected ->add (new \DateInterval ('P1D ' ));
12031203
12041204 self ::invokePrivate ($ this ->manager , 'validateExpirationDateInternal ' , [$ share ]);
@@ -1245,7 +1245,7 @@ public function testValidateExpirationDateInternalEnforceValid($shareType): void
12451245 $ future ->setTime (1 , 2 , 3 );
12461246
12471247 $ expected = clone $ future ;
1248- $ expected ->setTime (0 , 0 , 0 );
1248+ $ expected ->setTime (23 , 59 , 59 );
12491249
12501250 $ share = $ this ->manager ->newShare ();
12511251 $ share ->setShareType ($ shareType );
@@ -1285,7 +1285,7 @@ public function testValidateExpirationDateInternalNoDefault($shareType): void {
12851285 $ date ->setTime (1 , 2 , 3 );
12861286
12871287 $ expected = clone $ date ;
1288- $ expected ->setTime (0 , 0 , 0 );
1288+ $ expected ->setTime (23 , 59 , 59 );
12891289
12901290 $ share = $ this ->manager ->newShare ();
12911291 $ 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
@@ -1363,7 +1363,7 @@ public function testValidateExpirationDateInternalDefault($shareType): void {
13631363 $ future ->setTime (1 , 2 , 3 );
13641364
13651365 $ expected = clone $ future ;
1366- $ expected ->setTime (0 , 0 );
1366+ $ expected ->setTime (23 , 59 , 59 );
13671367
13681368 $ share = $ this ->manager ->newShare ();
13691369 $ share ->setShareType ($ shareType );
@@ -1400,7 +1400,7 @@ public function testValidateExpirationDateInternalDefault($shareType): void {
14001400 public function testValidateExpirationDateInternalHookModification ($ shareType ): void {
14011401 $ nextWeek = new \DateTime ('now ' , $ this ->timezone );
14021402 $ nextWeek ->add (new \DateInterval ('P7D ' ));
1403- $ nextWeek ->setTime (0 , 0 , 0 );
1403+ $ nextWeek ->setTime (23 , 59 , 59 );
14041404
14051405 $ save = clone $ nextWeek ;
14061406
@@ -1427,7 +1427,7 @@ public function testValidateExpirationDateInternalHookException($shareType): voi
14271427
14281428 $ nextWeek = new \DateTime ();
14291429 $ nextWeek ->add (new \DateInterval ('P7D ' ));
1430- $ nextWeek ->setTime (0 , 0 , 0 );
1430+ $ nextWeek ->setTime (23 , 59 , 59 );
14311431
14321432 $ share = $ this ->manager ->newShare ();
14331433 $ share ->setShareType ($ shareType );
@@ -1528,7 +1528,7 @@ public function testValidateExpirationDateEnforceButNotSetNewShare(): void {
15281528 ]);
15291529
15301530 $ expected = new \DateTime ('now ' , $ this ->timezone );
1531- $ expected ->setTime (0 , 0 , 0 );
1531+ $ expected ->setTime (23 , 59 , 59 );
15321532 $ expected ->add (new \DateInterval ('P3D ' ));
15331533
15341534 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 ]);
@@ -1592,7 +1592,7 @@ public function testValidateExpirationDateEnforceValid(): void {
15921592 $ future ->setTime (1 , 2 , 3 );
15931593
15941594 $ expected = clone $ future ;
1595- $ expected ->setTime (0 , 0 , 0 );
1595+ $ expected ->setTime (23 , 59 , 59 );
15961596
15971597 $ share = $ this ->manager ->newShare ();
15981598 $ share ->setExpirationDate ($ future );
@@ -1625,7 +1625,7 @@ public function testValidateExpirationDateNoDefault(): void {
16251625 $ date ->setTime (1 , 2 , 3 );
16261626
16271627 $ expected = clone $ date ;
1628- $ expected ->setTime (0 , 0 );
1628+ $ expected ->setTime (23 , 59 , 59 );
16291629 $ expected ->setTimezone (new \DateTimeZone (date_default_timezone_get ()));
16301630
16311631 $ share = $ this ->manager ->newShare ();
@@ -1662,7 +1662,7 @@ public function testValidateExpirationDateNoDateDefault(): void {
16621662
16631663 $ expected = new \DateTime ('now ' , $ this ->timezone );
16641664 $ expected ->add (new \DateInterval ('P3D ' ));
1665- $ expected ->setTime (0 , 0 );
1665+ $ expected ->setTime (23 , 59 , 59 );
16661666 $ expected ->setTimezone (new \DateTimeZone (date_default_timezone_get ()));
16671667
16681668 $ this ->config ->method ('getAppValue ' )
@@ -1694,7 +1694,7 @@ public function testValidateExpirationDateDefault(): void {
16941694 $ future ->setTime (1 , 2 , 3 );
16951695
16961696 $ expected = clone $ future ;
1697- $ expected ->setTime (0 , 0 );
1697+ $ expected ->setTime (23 , 59 , 59 );
16981698 $ expected ->setTimezone (new \DateTimeZone (date_default_timezone_get ()));
16991699
17001700 $ share = $ this ->manager ->newShare ();
@@ -1730,7 +1730,7 @@ public function testValidateExpirationNegativeOffsetTimezone(): void {
17301730
17311731 $ expected = clone $ future ;
17321732 $ expected ->setTimezone ($ this ->timezone );
1733- $ expected ->setTime (0 , 0 );
1733+ $ expected ->setTime (23 , 59 , 59 );
17341734 $ expected ->setTimezone (new \DateTimeZone (date_default_timezone_get ()));
17351735
17361736 $ share = $ this ->manager ->newShare ();
@@ -1764,7 +1764,7 @@ public function testValidateExpirationDateHookModification(): void {
17641764 $ nextWeek ->add (new \DateInterval ('P7D ' ));
17651765
17661766 $ save = clone $ nextWeek ;
1767- $ save ->setTime (0 , 0 );
1767+ $ save ->setTime (23 , 59 , 59 );
17681768 $ save ->sub (new \DateInterval ('P2D ' ));
17691769 $ save ->setTimezone (new \DateTimeZone (date_default_timezone_get ()));
17701770
@@ -1788,7 +1788,7 @@ public function testValidateExpirationDateHookException(): void {
17881788
17891789 $ nextWeek = new \DateTime ();
17901790 $ nextWeek ->add (new \DateInterval ('P7D ' ));
1791- $ nextWeek ->setTime (0 , 0 , 0 );
1791+ $ nextWeek ->setTime (23 , 59 , 59 );
17921792
17931793 $ share = $ this ->manager ->newShare ();
17941794 $ share ->setExpirationDate ($ nextWeek );
@@ -2452,7 +2452,7 @@ public function testCanShare($expected, $sharingEnabled, $disabledForUser): void
24522452 public function testCreateShareUser (): void {
24532453 /** @var Manager&MockObject $manager */
24542454 $ manager = $ this ->createManagerMock ()
2455- ->onlyMethods (['canShare ' , 'generalCreateChecks ' , 'userCreateChecks ' , 'pathCreateChecks ' ])
2455+ ->onlyMethods (['canShare ' , 'generalCreateChecks ' , 'userCreateChecks ' , 'pathCreateChecks ' , ' validateExpirationDateInternal ' ])
24562456 ->getMock ();
24572457
24582458 $ shareOwner = $ this ->createMock (IUser::class);
@@ -2488,6 +2488,10 @@ public function testCreateShareUser(): void {
24882488 $ manager ->expects ($ this ->once ())
24892489 ->method ('pathCreateChecks ' )
24902490 ->with ($ path );
2491+ $ manager ->expects ($ this ->once ())
2492+ ->method ('validateExpirationDateInternal ' )
2493+ ->with ($ share )
2494+ ->willReturnArgument (0 );
24912495
24922496 $ this ->defaultProvider
24932497 ->expects ($ this ->once ())
@@ -2507,7 +2511,7 @@ public function testCreateShareUser(): void {
25072511
25082512 public function testCreateShareGroup (): void {
25092513 $ manager = $ this ->createManagerMock ()
2510- ->onlyMethods (['canShare ' , 'generalCreateChecks ' , 'groupCreateChecks ' , 'pathCreateChecks ' ])
2514+ ->onlyMethods (['canShare ' , 'generalCreateChecks ' , 'groupCreateChecks ' , 'pathCreateChecks ' , ' validateExpirationDateInternal ' ])
25112515 ->getMock ();
25122516
25132517 $ shareOwner = $ this ->createMock (IUser::class);
@@ -2543,6 +2547,10 @@ public function testCreateShareGroup(): void {
25432547 $ manager ->expects ($ this ->once ())
25442548 ->method ('pathCreateChecks ' )
25452549 ->with ($ path );
2550+ $ manager ->expects ($ this ->once ())
2551+ ->method ('validateExpirationDateInternal ' )
2552+ ->with ($ share )
2553+ ->willReturnArgument (0 );
25462554
25472555 $ this ->defaultProvider
25482556 ->expects ($ this ->once ())
@@ -2776,6 +2784,7 @@ public function testCreateShareHookError(): void {
27762784 'generalCreateChecks ' ,
27772785 'userCreateChecks ' ,
27782786 'pathCreateChecks ' ,
2787+ 'validateExpirationDateInternal ' ,
27792788 ])
27802789 ->getMock ();
27812790
@@ -2812,6 +2821,10 @@ public function testCreateShareHookError(): void {
28122821 $ manager ->expects ($ this ->once ())
28132822 ->method ('pathCreateChecks ' )
28142823 ->with ($ path );
2824+ $ manager ->expects ($ this ->once ())
2825+ ->method ('validateExpirationDateInternal ' )
2826+ ->with ($ share )
2827+ ->willReturnArgument (0 );
28152828
28162829 $ share ->expects ($ this ->once ())
28172830 ->method ('setShareOwner ' )
@@ -2836,7 +2849,7 @@ public function testCreateShareHookError(): void {
28362849
28372850 public function testCreateShareOfIncomingFederatedShare (): void {
28382851 $ manager = $ this ->createManagerMock ()
2839- ->onlyMethods (['canShare ' , 'generalCreateChecks ' , 'userCreateChecks ' , 'pathCreateChecks ' ])
2852+ ->onlyMethods (['canShare ' , 'generalCreateChecks ' , 'userCreateChecks ' , 'pathCreateChecks ' , ' validateExpirationDateInternal ' ])
28402853 ->getMock ();
28412854
28422855 $ shareOwner = $ this ->createMock (IUser::class);
@@ -2891,6 +2904,10 @@ public function testCreateShareOfIncomingFederatedShare(): void {
28912904 $ manager ->expects ($ this ->once ())
28922905 ->method ('pathCreateChecks ' )
28932906 ->with ($ path );
2907+ $ manager ->expects ($ this ->once ())
2908+ ->method ('validateExpirationDateInternal ' )
2909+ ->with ($ share )
2910+ ->willReturnArgument (0 );
28942911
28952912 $ this ->defaultProvider
28962913 ->expects ($ this ->once ())
0 commit comments