@@ -1489,10 +1489,10 @@ public function testValidateExpirationDateEnforceButNotSet(): void {
14891489 $ share = $ this ->manager ->newShare ();
14901490 $ share ->setProviderId ('foo ' )->setId ('bar ' );
14911491
1492- $ this ->config ->method ('getAppValue ' )
1492+ $ this ->appConfig ->method ('getValueBool ' )
14931493 ->willReturnMap ([
1494- ['core ' , 'shareapi_default_expire_date ' , ' no ' , ' yes ' ],
1495- ['core ' , 'shareapi_enforce_expire_date ' , ' no ' , ' yes ' ],
1494+ ['core ' , 'shareapi_default_expire_date ' , true ],
1495+ ['core ' , 'shareapi_enforce_expire_date ' , true ],
14961496 ]);
14971497
14981498 self ::invokePrivate ($ this ->manager , 'validateExpirationDateLink ' , [$ share ]);
@@ -1517,12 +1517,16 @@ public function testValidateExpirationDateEnforceButNotSetNewShare(): void {
15171517
15181518 $ this ->config ->method ('getAppValue ' )
15191519 ->willReturnMap ([
1520- ['core ' , 'shareapi_enforce_expire_date ' , 'no ' , 'yes ' ],
15211520 ['core ' , 'shareapi_expire_after_n_days ' , '7 ' , '3 ' ],
1522- ['core ' , 'shareapi_default_expire_date ' , 'no ' , 'yes ' ],
15231521 ['core ' , 'link_defaultExpDays ' , '3 ' , '3 ' ],
15241522 ]);
15251523
1524+ $ this ->appConfig ->method ('getValueBool ' )
1525+ ->willReturnMap ([
1526+ ['core ' , 'shareapi_default_expire_date ' , true ],
1527+ ['core ' , 'shareapi_enforce_expire_date ' , true ],
1528+ ]);
1529+
15261530 $ expected = new \DateTime ('now ' , $ this ->timezone );
15271531 $ expected ->setTime (0 , 0 , 0 );
15281532 $ expected ->add (new \DateInterval ('P3D ' ));
@@ -1538,12 +1542,16 @@ public function testValidateExpirationDateEnforceRelaxedDefaultButNotSetNewShare
15381542
15391543 $ this ->config ->method ('getAppValue ' )
15401544 ->willReturnMap ([
1541- ['core ' , 'shareapi_enforce_expire_date ' , 'no ' , 'yes ' ],
15421545 ['core ' , 'shareapi_expire_after_n_days ' , '7 ' , '3 ' ],
1543- ['core ' , 'shareapi_default_expire_date ' , 'no ' , 'yes ' ],
15441546 ['core ' , 'link_defaultExpDays ' , '3 ' , '1 ' ],
15451547 ]);
15461548
1549+ $ this ->appConfig ->method ('getValueBool ' )
1550+ ->willReturnMap ([
1551+ ['core ' , 'shareapi_default_expire_date ' , true ],
1552+ ['core ' , 'shareapi_enforce_expire_date ' , true ],
1553+ ]);
1554+
15471555 $ expected = new \DateTime ('now ' , $ this ->timezone );
15481556 $ expected ->setTime (0 , 0 , 0 );
15491557 $ expected ->add (new \DateInterval ('P1D ' ));
@@ -1566,9 +1574,13 @@ public function testValidateExpirationDateEnforceTooFarIntoFuture(): void {
15661574
15671575 $ this ->config ->method ('getAppValue ' )
15681576 ->willReturnMap ([
1569- ['core ' , 'shareapi_enforce_expire_date ' , 'no ' , 'yes ' ],
15701577 ['core ' , 'shareapi_expire_after_n_days ' , '7 ' , '3 ' ],
1571- ['core ' , 'shareapi_default_expire_date ' , 'no ' , 'yes ' ],
1578+ ]);
1579+
1580+ $ this ->appConfig ->method ('getValueBool ' )
1581+ ->willReturnMap ([
1582+ ['core ' , 'shareapi_default_expire_date ' , true ],
1583+ ['core ' , 'shareapi_enforce_expire_date ' , true ],
15721584 ]);
15731585
15741586 self ::invokePrivate ($ this ->manager , 'validateExpirationDateLink ' , [$ share ]);
@@ -1587,9 +1599,13 @@ public function testValidateExpirationDateEnforceValid(): void {
15871599
15881600 $ this ->config ->method ('getAppValue ' )
15891601 ->willReturnMap ([
1590- ['core ' , 'shareapi_enforce_expire_date ' , 'no ' , 'yes ' ],
15911602 ['core ' , 'shareapi_expire_after_n_days ' , '7 ' , '3 ' ],
1592- ['core ' , 'shareapi_default_expire_date ' , 'no ' , 'yes ' ],
1603+ ]);
1604+
1605+ $ this ->appConfig ->method ('getValueBool ' )
1606+ ->willReturnMap ([
1607+ ['core ' , 'shareapi_default_expire_date ' , true ],
1608+ ['core ' , 'shareapi_enforce_expire_date ' , true ],
15931609 ]);
15941610
15951611 $ hookListener = $ this ->createMock (DummyShareManagerListener::class);
@@ -1651,11 +1667,16 @@ public function testValidateExpirationDateNoDateDefault(): void {
16511667
16521668 $ this ->config ->method ('getAppValue ' )
16531669 ->willReturnMap ([
1654- ['core ' , 'shareapi_default_expire_date ' , 'no ' , 'yes ' ],
16551670 ['core ' , 'shareapi_expire_after_n_days ' , '7 ' , '3 ' ],
16561671 ['core ' , 'link_defaultExpDays ' , '3 ' , '3 ' ],
16571672 ]);
16581673
1674+ $ this ->appConfig ->method ('getValueBool ' )
1675+ ->willReturnMap ([
1676+ ['core ' , 'shareapi_default_expire_date ' , true ],
1677+ ['core ' , 'shareapi_enforce_expire_date ' , false ],
1678+ ]);
1679+
16591680 $ hookListener = $ this ->createMock (DummyShareManagerListener::class);
16601681 Util::connectHook ('\OC\Share ' , 'verifyExpirationDate ' , $ hookListener , 'listener ' );
16611682 $ hookListener ->expects ($ this ->once ())->method ('listener ' )->with ($ this ->callback (function ($ data ) use ($ expected ) {
@@ -1681,11 +1702,16 @@ public function testValidateExpirationDateDefault(): void {
16811702
16821703 $ this ->config ->method ('getAppValue ' )
16831704 ->willReturnMap ([
1684- ['core ' , 'shareapi_default_expire_date ' , 'no ' , 'yes ' ],
16851705 ['core ' , 'shareapi_expire_after_n_days ' , '7 ' , '3 ' ],
16861706 ['core ' , 'link_defaultExpDays ' , '3 ' , '1 ' ],
16871707 ]);
16881708
1709+ $ this ->appConfig ->method ('getValueBool ' )
1710+ ->willReturnMap ([
1711+ ['core ' , 'shareapi_default_expire_date ' , true ],
1712+ ['core ' , 'shareapi_enforce_expire_date ' , false ],
1713+ ]);
1714+
16891715 $ hookListener = $ this ->createMock (DummyShareManagerListener::class);
16901716 Util::connectHook ('\OC\Share ' , 'verifyExpirationDate ' , $ hookListener , 'listener ' );
16911717 $ hookListener ->expects ($ this ->once ())->method ('listener ' )->with ($ this ->callback (function ($ data ) use ($ expected ) {
@@ -1712,11 +1738,16 @@ public function testValidateExpirationNegativeOffsetTimezone(): void {
17121738
17131739 $ this ->config ->method ('getAppValue ' )
17141740 ->willReturnMap ([
1715- ['core ' , 'shareapi_default_expire_date ' , 'no ' , 'yes ' ],
17161741 ['core ' , 'shareapi_expire_after_n_days ' , '7 ' , '3 ' ],
17171742 ['core ' , 'link_defaultExpDays ' , '3 ' , '1 ' ],
17181743 ]);
17191744
1745+ $ this ->appConfig ->method ('getValueBool ' )
1746+ ->willReturnMap ([
1747+ ['core ' , 'shareapi_default_expire_date ' , true ],
1748+ ['core ' , 'shareapi_enforce_expire_date ' , false ],
1749+ ]);
1750+
17201751 $ hookListener = $ this ->createMock (DummyShareManagerListener::class);
17211752 Util::connectHook ('\OC\Share ' , 'verifyExpirationDate ' , $ hookListener , 'listener ' );
17221753 $ hookListener ->expects ($ this ->once ())->method ('listener ' )->with ($ this ->callback (function ($ data ) use ($ expected ) {
@@ -1779,10 +1810,14 @@ public function testValidateExpirationDateExistingShareNoDefault(): void {
17791810
17801811 $ this ->config ->method ('getAppValue ' )
17811812 ->willReturnMap ([
1782- ['core ' , 'shareapi_default_expire_date ' , 'no ' , 'yes ' ],
17831813 ['core ' , 'shareapi_expire_after_n_days ' , '7 ' , '6 ' ],
17841814 ]);
17851815
1816+ $ this ->appConfig ->method ('getValueBool ' )
1817+ ->willReturnMap ([
1818+ ['core ' , 'shareapi_default_expire_date ' , true ],
1819+ ['core ' , 'shareapi_enforce_expire_date ' , false ],
1820+ ]);
17861821 self ::invokePrivate ($ this ->manager , 'validateExpirationDateLink ' , [$ share ]);
17871822
17881823 $ this ->assertEquals (null , $ share ->getExpirationDate ());
0 commit comments