@@ -1293,7 +1293,7 @@ public function testValidateExpirationDateInternalEnforceButNotSetNewShare($shar
12931293 }
12941294
12951295 $ expected = new \DateTime ('now ' , $ this ->timezone );
1296- $ expected ->setTime (0 , 0 , 0 );
1296+ $ expected ->setTime (23 , 59 , 59 );
12971297 $ expected ->add (new \DateInterval ('P3D ' ));
12981298
12991299 self ::invokePrivate ($ this ->manager , 'validateExpirationDateInternal ' , [$ share ]);
@@ -1326,7 +1326,7 @@ public function testValidateExpirationDateInternalEnforceRelaxedDefaultButNotSet
13261326 }
13271327
13281328 $ expected = new \DateTime ('now ' , $ this ->timezone );
1329- $ expected ->setTime (0 , 0 , 0 );
1329+ $ expected ->setTime (23 , 59 , 59 );
13301330 $ expected ->add (new \DateInterval ('P1D ' ));
13311331
13321332 self ::invokePrivate ($ this ->manager , 'validateExpirationDateInternal ' , [$ share ]);
@@ -1373,7 +1373,7 @@ public function testValidateExpirationDateInternalEnforceValid($shareType): void
13731373 $ future ->setTime (1 , 2 , 3 );
13741374
13751375 $ expected = clone $ future ;
1376- $ expected ->setTime (0 , 0 , 0 );
1376+ $ expected ->setTime (23 , 59 , 59 );
13771377
13781378 $ share = $ this ->manager ->newShare ();
13791379 $ share ->setShareType ($ shareType );
@@ -1413,7 +1413,7 @@ public function testValidateExpirationDateInternalNoDefault($shareType): void {
14131413 $ date ->setTime (1 , 2 , 3 );
14141414
14151415 $ expected = clone $ date ;
1416- $ expected ->setTime (0 , 0 , 0 );
1416+ $ expected ->setTime (23 , 59 , 59 );
14171417
14181418 $ share = $ this ->manager ->newShare ();
14191419 $ share ->setShareType ($ shareType );
@@ -1453,7 +1453,7 @@ public function testValidateExpirationDateInternalNoDateDefault($shareType): voi
14531453 $ share ->setShareType ($ shareType );
14541454
14551455 $ expected = new \DateTime ('now ' , $ this ->timezone );
1456- $ expected ->setTime (0 , 0 );
1456+ $ expected ->setTime (23 , 59 , 59 );
14571457 $ expected ->add (new \DateInterval ('P3D ' ));
14581458 $ expected ->setTimezone (new \DateTimeZone (date_default_timezone_get ()));
14591459
@@ -1491,7 +1491,7 @@ public function testValidateExpirationDateInternalDefault($shareType): void {
14911491 $ future ->setTime (1 , 2 , 3 );
14921492
14931493 $ expected = clone $ future ;
1494- $ expected ->setTime (0 , 0 );
1494+ $ expected ->setTime (23 , 59 , 59 );
14951495
14961496 $ share = $ this ->manager ->newShare ();
14971497 $ share ->setShareType ($ shareType );
@@ -1528,7 +1528,7 @@ public function testValidateExpirationDateInternalDefault($shareType): void {
15281528 public function testValidateExpirationDateInternalHookModification ($ shareType ): void {
15291529 $ nextWeek = new \DateTime ('now ' , $ this ->timezone );
15301530 $ nextWeek ->add (new \DateInterval ('P7D ' ));
1531- $ nextWeek ->setTime (0 , 0 , 0 );
1531+ $ nextWeek ->setTime (23 , 59 , 59 );
15321532
15331533 $ save = clone $ nextWeek ;
15341534
@@ -1555,7 +1555,7 @@ public function testValidateExpirationDateInternalHookException($shareType): voi
15551555
15561556 $ nextWeek = new \DateTime ();
15571557 $ nextWeek ->add (new \DateInterval ('P7D ' ));
1558- $ nextWeek ->setTime (0 , 0 , 0 );
1558+ $ nextWeek ->setTime (23 , 59 , 59 );
15591559
15601560 $ share = $ this ->manager ->newShare ();
15611561 $ share ->setShareType ($ shareType );
@@ -1656,7 +1656,7 @@ public function testValidateExpirationDateEnforceButNotSetNewShare(): void {
16561656 ]);
16571657
16581658 $ expected = new \DateTime ('now ' , $ this ->timezone );
1659- $ expected ->setTime (0 , 0 , 0 );
1659+ $ expected ->setTime (23 , 59 , 59 );
16601660 $ expected ->add (new \DateInterval ('P3D ' ));
16611661
16621662 self ::invokePrivate ($ this ->manager , 'validateExpirationDateLink ' , [$ share ]);
@@ -1681,7 +1681,7 @@ public function testValidateExpirationDateEnforceRelaxedDefaultButNotSetNewShare
16811681 ]);
16821682
16831683 $ expected = new \DateTime ('now ' , $ this ->timezone );
1684- $ expected ->setTime (0 , 0 , 0 );
1684+ $ expected ->setTime (23 , 59 , 59 );
16851685 $ expected ->add (new \DateInterval ('P1D ' ));
16861686
16871687 self ::invokePrivate ($ this ->manager , 'validateExpirationDateLink ' , [$ share ]);
@@ -1720,7 +1720,7 @@ public function testValidateExpirationDateEnforceValid(): void {
17201720 $ future ->setTime (1 , 2 , 3 );
17211721
17221722 $ expected = clone $ future ;
1723- $ expected ->setTime (0 , 0 , 0 );
1723+ $ expected ->setTime (23 , 59 , 59 );
17241724
17251725 $ share = $ this ->manager ->newShare ();
17261726 $ share ->setExpirationDate ($ future );
@@ -1753,7 +1753,7 @@ public function testValidateExpirationDateNoDefault(): void {
17531753 $ date ->setTime (1 , 2 , 3 );
17541754
17551755 $ expected = clone $ date ;
1756- $ expected ->setTime (0 , 0 );
1756+ $ expected ->setTime (23 , 59 , 59 );
17571757 $ expected ->setTimezone (new \DateTimeZone (date_default_timezone_get ()));
17581758
17591759 $ share = $ this ->manager ->newShare ();
@@ -1790,7 +1790,7 @@ public function testValidateExpirationDateNoDateDefault(): void {
17901790
17911791 $ expected = new \DateTime ('now ' , $ this ->timezone );
17921792 $ expected ->add (new \DateInterval ('P3D ' ));
1793- $ expected ->setTime (0 , 0 );
1793+ $ expected ->setTime (23 , 59 , 59 );
17941794 $ expected ->setTimezone (new \DateTimeZone (date_default_timezone_get ()));
17951795
17961796 $ this ->config ->method ('getAppValue ' )
@@ -1822,7 +1822,7 @@ public function testValidateExpirationDateDefault(): void {
18221822 $ future ->setTime (1 , 2 , 3 );
18231823
18241824 $ expected = clone $ future ;
1825- $ expected ->setTime (0 , 0 );
1825+ $ expected ->setTime (23 , 59 , 59 );
18261826 $ expected ->setTimezone (new \DateTimeZone (date_default_timezone_get ()));
18271827
18281828 $ share = $ this ->manager ->newShare ();
@@ -1858,7 +1858,7 @@ public function testValidateExpirationNegativeOffsetTimezone(): void {
18581858
18591859 $ expected = clone $ future ;
18601860 $ expected ->setTimezone ($ this ->timezone );
1861- $ expected ->setTime (0 , 0 );
1861+ $ expected ->setTime (23 , 59 , 59 );
18621862 $ expected ->setTimezone (new \DateTimeZone (date_default_timezone_get ()));
18631863
18641864 $ share = $ this ->manager ->newShare ();
@@ -1892,7 +1892,7 @@ public function testValidateExpirationDateHookModification(): void {
18921892 $ nextWeek ->add (new \DateInterval ('P7D ' ));
18931893
18941894 $ save = clone $ nextWeek ;
1895- $ save ->setTime (0 , 0 );
1895+ $ save ->setTime (23 , 59 , 59 );
18961896 $ save ->sub (new \DateInterval ('P2D ' ));
18971897 $ save ->setTimezone (new \DateTimeZone (date_default_timezone_get ()));
18981898
@@ -1916,7 +1916,7 @@ public function testValidateExpirationDateHookException(): void {
19161916
19171917 $ nextWeek = new \DateTime ();
19181918 $ nextWeek ->add (new \DateInterval ('P7D ' ));
1919- $ nextWeek ->setTime (0 , 0 , 0 );
1919+ $ nextWeek ->setTime (23 , 59 , 59 );
19201920
19211921 $ share = $ this ->manager ->newShare ();
19221922 $ share ->setExpirationDate ($ nextWeek );
@@ -2580,7 +2580,7 @@ public function testCanShare($expected, $sharingEnabled, $disabledForUser): void
25802580 public function testCreateShareUser (): void {
25812581 /** @var Manager&MockObject $manager */
25822582 $ manager = $ this ->createManagerMock ()
2583- ->onlyMethods (['canShare ' , 'generalCreateChecks ' , 'userCreateChecks ' , 'pathCreateChecks ' ])
2583+ ->onlyMethods (['canShare ' , 'generalCreateChecks ' , 'userCreateChecks ' , 'pathCreateChecks ' , ' validateExpirationDateInternal ' ])
25842584 ->getMock ();
25852585
25862586 $ shareOwner = $ this ->createMock (IUser::class);
@@ -2616,6 +2616,10 @@ public function testCreateShareUser(): void {
26162616 $ manager ->expects ($ this ->once ())
26172617 ->method ('pathCreateChecks ' )
26182618 ->with ($ path );
2619+ $ manager ->expects ($ this ->once ())
2620+ ->method ('validateExpirationDateInternal ' )
2621+ ->with ($ share )
2622+ ->willReturnArgument (0 );
26192623
26202624 $ this ->defaultProvider
26212625 ->expects ($ this ->once ())
@@ -2635,7 +2639,7 @@ public function testCreateShareUser(): void {
26352639
26362640 public function testCreateShareGroup (): void {
26372641 $ manager = $ this ->createManagerMock ()
2638- ->onlyMethods (['canShare ' , 'generalCreateChecks ' , 'groupCreateChecks ' , 'pathCreateChecks ' ])
2642+ ->onlyMethods (['canShare ' , 'generalCreateChecks ' , 'groupCreateChecks ' , 'pathCreateChecks ' , ' validateExpirationDateInternal ' ])
26392643 ->getMock ();
26402644
26412645 $ shareOwner = $ this ->createMock (IUser::class);
@@ -2671,6 +2675,10 @@ public function testCreateShareGroup(): void {
26712675 $ manager ->expects ($ this ->once ())
26722676 ->method ('pathCreateChecks ' )
26732677 ->with ($ path );
2678+ $ manager ->expects ($ this ->once ())
2679+ ->method ('validateExpirationDateInternal ' )
2680+ ->with ($ share )
2681+ ->willReturnArgument (0 );
26742682
26752683 $ this ->defaultProvider
26762684 ->expects ($ this ->once ())
@@ -2904,6 +2912,7 @@ public function testCreateShareHookError(): void {
29042912 'generalCreateChecks ' ,
29052913 'userCreateChecks ' ,
29062914 'pathCreateChecks ' ,
2915+ 'validateExpirationDateInternal ' ,
29072916 ])
29082917 ->getMock ();
29092918
@@ -2940,6 +2949,10 @@ public function testCreateShareHookError(): void {
29402949 $ manager ->expects ($ this ->once ())
29412950 ->method ('pathCreateChecks ' )
29422951 ->with ($ path );
2952+ $ manager ->expects ($ this ->once ())
2953+ ->method ('validateExpirationDateInternal ' )
2954+ ->with ($ share )
2955+ ->willReturnArgument (0 );
29432956
29442957 $ share ->expects ($ this ->once ())
29452958 ->method ('setShareOwner ' )
@@ -2964,7 +2977,7 @@ public function testCreateShareHookError(): void {
29642977
29652978 public function testCreateShareOfIncomingFederatedShare (): void {
29662979 $ manager = $ this ->createManagerMock ()
2967- ->onlyMethods (['canShare ' , 'generalCreateChecks ' , 'userCreateChecks ' , 'pathCreateChecks ' ])
2980+ ->onlyMethods (['canShare ' , 'generalCreateChecks ' , 'userCreateChecks ' , 'pathCreateChecks ' , ' validateExpirationDateInternal ' ])
29682981 ->getMock ();
29692982
29702983 $ shareOwner = $ this ->createMock (IUser::class);
@@ -3019,6 +3032,10 @@ public function testCreateShareOfIncomingFederatedShare(): void {
30193032 $ manager ->expects ($ this ->once ())
30203033 ->method ('pathCreateChecks ' )
30213034 ->with ($ path );
3035+ $ manager ->expects ($ this ->once ())
3036+ ->method ('validateExpirationDateInternal ' )
3037+ ->with ($ share )
3038+ ->willReturnArgument (0 );
30223039
30233040 $ this ->defaultProvider
30243041 ->expects ($ this ->once ())
0 commit comments