@@ -940,7 +940,7 @@ public function testValidateExpirationDateInternalEnforceButNotSetNewShare($shar
940940 self ::invokePrivate ($ this ->manager , 'validateExpirationDateInternal ' , [$ share ]);
941941
942942 $ this ->assertNotNull ($ share ->getExpirationDate ());
943- $ this ->assertEquals ($ expected , $ share ->getExpirationDate ());
943+ $ this ->assertEquals ($ expected , $ share ->getExpirationDate ()-> setTime ( 0 , 0 , 0 ) );
944944 }
945945
946946 /**
@@ -975,7 +975,7 @@ public function testValidateExpirationDateInternalEnforceRelaxedDefaultButNotSet
975975 self ::invokePrivate ($ this ->manager , 'validateExpirationDateInternal ' , [$ share ]);
976976
977977 $ this ->assertNotNull ($ share ->getExpirationDate ());
978- $ this ->assertEquals ($ expected , $ share ->getExpirationDate ());
978+ $ this ->assertEquals ($ expected , $ share ->getExpirationDate ()-> setTime ( 0 , 0 , 0 ) );
979979 }
980980
981981 /**
@@ -1050,7 +1050,7 @@ public function testValidateExpirationDateInternalEnforceValid($shareType) {
10501050
10511051 self ::invokePrivate ($ this ->manager , 'validateExpirationDateInternal ' , [$ share ]);
10521052
1053- $ this ->assertEquals ($ expected , $ share ->getExpirationDate ());
1053+ $ this ->assertEquals ($ expected , $ share ->getExpirationDate ()-> setTime ( 0 , 0 , 0 ) );
10541054 }
10551055
10561056 /**
@@ -1062,7 +1062,6 @@ public function testValidateExpirationDateInternalNoDefault($shareType) {
10621062 $ date ->setTime (1 , 2 , 3 );
10631063
10641064 $ expected = clone $ date ;
1065- $ expected ->setTime (0 , 0 , 0 );
10661065
10671066 $ share = $ this ->manager ->newShare ();
10681067 $ share ->setShareType ($ shareType );
@@ -1107,7 +1106,6 @@ public function testValidateExpirationDateInternalNoDateDefault($shareType) {
11071106
11081107 $ expected = new \DateTime ();
11091108 $ expected ->add (new \DateInterval ('P3D ' ));
1110- $ expected ->setTime (0 , 0 , 0 );
11111109
11121110 if ($ shareType === IShare::TYPE_USER ) {
11131111 $ this ->config ->method ('getAppValue ' )
@@ -1128,12 +1126,12 @@ public function testValidateExpirationDateInternalNoDateDefault($shareType) {
11281126 $ hookListener = $ this ->getMockBuilder ('Dummy ' )->setMethods (['listener ' ])->getMock ();
11291127 \OCP \Util::connectHook ('\OC\Share ' , 'verifyExpirationDate ' , $ hookListener , 'listener ' );
11301128 $ hookListener ->expects ($ this ->once ())->method ('listener ' )->with ($ this ->callback (function ($ data ) use ($ expected ) {
1131- return $ data ['expirationDate ' ] == $ expected ;
1129+ return $ data ['expirationDate ' ]-> format ( ' YmdH ' ) == $ expected-> format ( ' YmdH ' ) ;
11321130 }));
11331131
11341132 self ::invokePrivate ($ this ->manager , 'validateExpirationDateInternal ' , [$ share ]);
11351133
1136- $ this ->assertEquals ($ expected , $ share ->getExpirationDate ());
1134+ $ this ->assertEquals ($ expected-> format ( ' YmdH ' ) , $ share ->getExpirationDate ()-> format ( ' YmdH ' ));
11371135 }
11381136
11391137 /**
@@ -1145,7 +1143,6 @@ public function testValidateExpirationDateInternalDefault($shareType) {
11451143 $ future ->setTime (1 , 2 , 3 );
11461144
11471145 $ expected = clone $ future ;
1148- $ expected ->setTime (0 , 0 , 0 );
11491146
11501147 $ share = $ this ->manager ->newShare ();
11511148 $ share ->setShareType ($ shareType );
@@ -1318,7 +1315,7 @@ public function testValidateExpirationDateEnforceButNotSetNewShare() {
13181315 self ::invokePrivate ($ this ->manager , 'validateExpirationDateLink ' , [$ share ]);
13191316
13201317 $ this ->assertNotNull ($ share ->getExpirationDate ());
1321- $ this ->assertEquals ($ expected , $ share ->getExpirationDate ());
1318+ $ this ->assertEquals ($ expected , $ share ->getExpirationDate ()-> setTime ( 0 , 0 , 0 ) );
13221319 }
13231320
13241321 public function testValidateExpirationDateEnforceRelaxedDefaultButNotSetNewShare () {
@@ -1339,7 +1336,7 @@ public function testValidateExpirationDateEnforceRelaxedDefaultButNotSetNewShare
13391336 self ::invokePrivate ($ this ->manager , 'validateExpirationDateLink ' , [$ share ]);
13401337
13411338 $ this ->assertNotNull ($ share ->getExpirationDate ());
1342- $ this ->assertEquals ($ expected , $ share ->getExpirationDate ());
1339+ $ this ->assertEquals ($ expected , $ share ->getExpirationDate ()-> setTime ( 0 , 0 , 0 ) );
13431340 }
13441341
13451342 public function testValidateExpirationDateEnforceTooFarIntoFuture () {
@@ -1388,7 +1385,7 @@ public function testValidateExpirationDateEnforceValid() {
13881385
13891386 self ::invokePrivate ($ this ->manager , 'validateExpirationDateLink ' , [$ share ]);
13901387
1391- $ this ->assertEquals ($ expected , $ share ->getExpirationDate ());
1388+ $ this ->assertEquals ($ expected , $ share ->getExpirationDate ()-> setTime ( 0 , 0 , 0 ) );
13921389 }
13931390
13941391 public function testValidateExpirationDateNoDefault () {
@@ -1397,7 +1394,6 @@ public function testValidateExpirationDateNoDefault() {
13971394 $ date ->setTime (1 , 2 , 3 );
13981395
13991396 $ expected = clone $ date ;
1400- $ expected ->setTime (0 , 0 , 0 );
14011397
14021398 $ share = $ this ->manager ->newShare ();
14031399 $ share ->setExpirationDate ($ date );
@@ -1433,7 +1429,6 @@ public function testValidateExpirationDateNoDateDefault() {
14331429
14341430 $ expected = new \DateTime ();
14351431 $ expected ->add (new \DateInterval ('P3D ' ));
1436- $ expected ->setTime (0 , 0 , 0 );
14371432
14381433 $ this ->config ->method ('getAppValue ' )
14391434 ->willReturnMap ([
@@ -1445,12 +1440,12 @@ public function testValidateExpirationDateNoDateDefault() {
14451440 $ hookListener = $ this ->getMockBuilder ('Dummy ' )->setMethods (['listener ' ])->getMock ();
14461441 \OCP \Util::connectHook ('\OC\Share ' , 'verifyExpirationDate ' , $ hookListener , 'listener ' );
14471442 $ hookListener ->expects ($ this ->once ())->method ('listener ' )->with ($ this ->callback (function ($ data ) use ($ expected ) {
1448- return $ data ['expirationDate ' ] == $ expected ;
1443+ return $ data ['expirationDate ' ]-> format ( ' YmdH ' ) == $ expected-> format ( ' YmdH ' ) ;
14491444 }));
14501445
14511446 self ::invokePrivate ($ this ->manager , 'validateExpirationDateLink ' , [$ share ]);
14521447
1453- $ this ->assertEquals ($ expected , $ share ->getExpirationDate ());
1448+ $ this ->assertEquals ($ expected-> format ( ' YmdH ' ) , $ share ->getExpirationDate ()-> format ( ' YmdH ' ));
14541449 }
14551450
14561451 public function testValidateExpirationDateDefault () {
@@ -1459,7 +1454,6 @@ public function testValidateExpirationDateDefault() {
14591454 $ future ->setTime (1 , 2 , 3 );
14601455
14611456 $ expected = clone $ future ;
1462- $ expected ->setTime (0 , 0 , 0 );
14631457
14641458 $ share = $ this ->manager ->newShare ();
14651459 $ share ->setExpirationDate ($ future );
0 commit comments