@@ -1156,7 +1156,7 @@ public function testValidateExpirationDateInternalEnforceButNotSetNewShare($shar
11561156 }
11571157
11581158 $ expected = new \DateTime ('now ' , $ this ->timezone );
1159- $ expected ->setTime (0 , 0 , 0 );
1159+ $ expected ->setTime (23 , 59 , 59 );
11601160 $ expected ->add (new \DateInterval ('P3D ' ));
11611161
11621162 self ::invokePrivate ($ this ->manager , 'validateExpirationDateInternal ' , [$ share ]);
@@ -1191,7 +1191,7 @@ public function testValidateExpirationDateInternalEnforceRelaxedDefaultButNotSet
11911191 }
11921192
11931193 $ expected = new \DateTime ('now ' , $ this ->timezone );
1194- $ expected ->setTime (0 , 0 , 0 );
1194+ $ expected ->setTime (23 , 59 , 59 );
11951195 $ expected ->add (new \DateInterval ('P1D ' ));
11961196
11971197 self ::invokePrivate ($ this ->manager , 'validateExpirationDateInternal ' , [$ share ]);
@@ -1242,7 +1242,7 @@ public function testValidateExpirationDateInternalEnforceValid($shareType): void
12421242 $ future ->setTime (1 , 2 , 3 );
12431243
12441244 $ expected = clone $ future ;
1245- $ expected ->setTime (0 , 0 , 0 );
1245+ $ expected ->setTime (23 , 59 , 59 );
12461246
12471247 $ share = $ this ->manager ->newShare ();
12481248 $ share ->setShareType ($ shareType );
@@ -1284,7 +1284,7 @@ public function testValidateExpirationDateInternalNoDefault($shareType): void {
12841284 $ date ->setTime (1 , 2 , 3 );
12851285
12861286 $ expected = clone $ date ;
1287- $ expected ->setTime (0 , 0 , 0 );
1287+ $ expected ->setTime (23 , 59 , 59 );
12881288
12891289 $ share = $ this ->manager ->newShare ();
12901290 $ share ->setShareType ($ shareType );
@@ -1328,7 +1328,7 @@ public function testValidateExpirationDateInternalNoDateDefault($shareType): voi
13281328 $ share ->setShareType ($ shareType );
13291329
13301330 $ expected = new \DateTime ('now ' , $ this ->timezone );
1331- $ expected ->setTime (0 , 0 );
1331+ $ expected ->setTime (23 , 59 , 59 );
13321332 $ expected ->add (new \DateInterval ('P3D ' ));
13331333 $ expected ->setTimezone (new \DateTimeZone (date_default_timezone_get ()));
13341334
@@ -1368,7 +1368,7 @@ public function testValidateExpirationDateInternalDefault($shareType): void {
13681368 $ future ->setTime (1 , 2 , 3 );
13691369
13701370 $ expected = clone $ future ;
1371- $ expected ->setTime (0 , 0 );
1371+ $ expected ->setTime (23 , 59 , 59 );
13721372
13731373 $ share = $ this ->manager ->newShare ();
13741374 $ share ->setShareType ($ shareType );
@@ -1407,7 +1407,7 @@ public function testValidateExpirationDateInternalDefault($shareType): void {
14071407 public function testValidateExpirationDateInternalHookModification ($ shareType ): void {
14081408 $ nextWeek = new \DateTime ('now ' , $ this ->timezone );
14091409 $ nextWeek ->add (new \DateInterval ('P7D ' ));
1410- $ nextWeek ->setTime (0 , 0 , 0 );
1410+ $ nextWeek ->setTime (23 , 59 , 59 );
14111411
14121412 $ save = clone $ nextWeek ;
14131413
@@ -1436,7 +1436,7 @@ public function testValidateExpirationDateInternalHookException($shareType): voi
14361436
14371437 $ nextWeek = new \DateTime ();
14381438 $ nextWeek ->add (new \DateInterval ('P7D ' ));
1439- $ nextWeek ->setTime (0 , 0 , 0 );
1439+ $ nextWeek ->setTime (23 , 59 , 59 );
14401440
14411441 $ share = $ this ->manager ->newShare ();
14421442 $ share ->setShareType ($ shareType );
@@ -1535,7 +1535,7 @@ public function testValidateExpirationDateEnforceButNotSetNewShare(): void {
15351535 ]);
15361536
15371537 $ expected = new \DateTime ('now ' , $ this ->timezone );
1538- $ expected ->setTime (0 , 0 , 0 );
1538+ $ expected ->setTime (23 , 59 , 59 );
15391539 $ expected ->add (new \DateInterval ('P3D ' ));
15401540
15411541 self ::invokePrivate ($ this ->manager , 'validateExpirationDateLink ' , [$ share ]);
@@ -1556,7 +1556,7 @@ public function testValidateExpirationDateEnforceRelaxedDefaultButNotSetNewShare
15561556 ]);
15571557
15581558 $ expected = new \DateTime ('now ' , $ this ->timezone );
1559- $ expected ->setTime (0 , 0 , 0 );
1559+ $ expected ->setTime (23 , 59 , 59 );
15601560 $ expected ->add (new \DateInterval ('P1D ' ));
15611561
15621562 self ::invokePrivate ($ this ->manager , 'validateExpirationDateLink ' , [$ share ]);
@@ -1591,7 +1591,7 @@ public function testValidateExpirationDateEnforceValid(): void {
15911591 $ future ->setTime (1 , 2 , 3 );
15921592
15931593 $ expected = clone $ future ;
1594- $ expected ->setTime (0 , 0 , 0 );
1594+ $ expected ->setTime (23 , 59 , 59 );
15951595
15961596 $ share = $ this ->manager ->newShare ();
15971597 $ share ->setExpirationDate ($ future );
@@ -1620,7 +1620,7 @@ public function testValidateExpirationDateNoDefault(): void {
16201620 $ date ->setTime (1 , 2 , 3 );
16211621
16221622 $ expected = clone $ date ;
1623- $ expected ->setTime (0 , 0 );
1623+ $ expected ->setTime (23 , 59 , 59 );
16241624 $ expected ->setTimezone (new \DateTimeZone (date_default_timezone_get ()));
16251625
16261626 $ share = $ this ->manager ->newShare ();
@@ -1657,7 +1657,7 @@ public function testValidateExpirationDateNoDateDefault(): void {
16571657
16581658 $ expected = new \DateTime ('now ' , $ this ->timezone );
16591659 $ expected ->add (new \DateInterval ('P3D ' ));
1660- $ expected ->setTime (0 , 0 );
1660+ $ expected ->setTime (23 , 59 , 59 );
16611661 $ expected ->setTimezone (new \DateTimeZone (date_default_timezone_get ()));
16621662
16631663 $ this ->config ->method ('getAppValue ' )
@@ -1684,7 +1684,7 @@ public function testValidateExpirationDateDefault(): void {
16841684 $ future ->setTime (1 , 2 , 3 );
16851685
16861686 $ expected = clone $ future ;
1687- $ expected ->setTime (0 , 0 );
1687+ $ expected ->setTime (23 , 59 , 59 );
16881688 $ expected ->setTimezone (new \DateTimeZone (date_default_timezone_get ()));
16891689
16901690 $ share = $ this ->manager ->newShare ();
@@ -1715,7 +1715,7 @@ public function testValidateExpirationNegativeOffsetTimezone(): void {
17151715
17161716 $ expected = clone $ future ;
17171717 $ expected ->setTimezone ($ this ->timezone );
1718- $ expected ->setTime (0 , 0 );
1718+ $ expected ->setTime (23 , 59 , 59 );
17191719 $ expected ->setTimezone (new \DateTimeZone (date_default_timezone_get ()));
17201720
17211721 $ share = $ this ->manager ->newShare ();
@@ -1744,7 +1744,7 @@ public function testValidateExpirationDateHookModification(): void {
17441744 $ nextWeek ->add (new \DateInterval ('P7D ' ));
17451745
17461746 $ save = clone $ nextWeek ;
1747- $ save ->setTime (0 , 0 );
1747+ $ save ->setTime (23 , 59 , 59 );
17481748 $ save ->sub (new \DateInterval ('P2D ' ));
17491749 $ save ->setTimezone (new \DateTimeZone (date_default_timezone_get ()));
17501750
@@ -1768,7 +1768,7 @@ public function testValidateExpirationDateHookException(): void {
17681768
17691769 $ nextWeek = new \DateTime ();
17701770 $ nextWeek ->add (new \DateInterval ('P7D ' ));
1771- $ nextWeek ->setTime (0 , 0 , 0 );
1771+ $ nextWeek ->setTime (23 , 59 , 59 );
17721772
17731773 $ share = $ this ->manager ->newShare ();
17741774 $ share ->setExpirationDate ($ nextWeek );
@@ -2428,7 +2428,7 @@ public function testCanShare($expected, $sharingEnabled, $disabledForUser): void
24282428 public function testCreateShareUser (): void {
24292429 /** @var Manager&MockObject $manager */
24302430 $ manager = $ this ->createManagerMock ()
2431- ->onlyMethods (['canShare ' , 'generalCreateChecks ' , 'userCreateChecks ' , 'pathCreateChecks ' ])
2431+ ->onlyMethods (['canShare ' , 'generalCreateChecks ' , 'userCreateChecks ' , 'pathCreateChecks ' , ' validateExpirationDateInternal ' ])
24322432 ->getMock ();
24332433
24342434 $ shareOwner = $ this ->createMock (IUser::class);
@@ -2464,6 +2464,10 @@ public function testCreateShareUser(): void {
24642464 $ manager ->expects ($ this ->once ())
24652465 ->method ('pathCreateChecks ' )
24662466 ->with ($ path );
2467+ $ manager ->expects ($ this ->once ())
2468+ ->method ('validateExpirationDateInternal ' )
2469+ ->with ($ share )
2470+ ->willReturnArgument (0 );
24672471
24682472 $ this ->defaultProvider
24692473 ->expects ($ this ->once ())
@@ -2519,6 +2523,10 @@ public function testCreateShareGroup(): void {
25192523 $ manager ->expects ($ this ->once ())
25202524 ->method ('pathCreateChecks ' )
25212525 ->with ($ path );
2526+ $ manager ->expects ($ this ->once ())
2527+ ->method ('validateExpirationDateInternal ' )
2528+ ->with ($ share )
2529+ ->willReturnArgument (0 );
25222530
25232531 $ this ->defaultProvider
25242532 ->expects ($ this ->once ())
@@ -2770,6 +2778,7 @@ public function testCreateShareHookError(): void {
27702778 'generalCreateChecks ' ,
27712779 'userCreateChecks ' ,
27722780 'pathCreateChecks ' ,
2781+ 'validateExpirationDateInternal ' ,
27732782 ])
27742783 ->getMock ();
27752784
@@ -2806,6 +2815,10 @@ public function testCreateShareHookError(): void {
28062815 $ manager ->expects ($ this ->once ())
28072816 ->method ('pathCreateChecks ' )
28082817 ->with ($ path );
2818+ $ manager ->expects ($ this ->once ())
2819+ ->method ('validateExpirationDateInternal ' )
2820+ ->with ($ share )
2821+ ->willReturnArgument (0 );
28092822
28102823 $ share ->expects ($ this ->once ())
28112824 ->method ('setShareOwner ' )
@@ -2885,6 +2898,10 @@ public function testCreateShareOfIncomingFederatedShare(): void {
28852898 $ manager ->expects ($ this ->once ())
28862899 ->method ('pathCreateChecks ' )
28872900 ->with ($ path );
2901+ $ manager ->expects ($ this ->once ())
2902+ ->method ('validateExpirationDateInternal ' )
2903+ ->with ($ share )
2904+ ->willReturnArgument (0 );
28882905
28892906 $ this ->defaultProvider
28902907 ->expects ($ this ->once ())
0 commit comments