X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=tests%2Fphpunit%2Fincludes%2FMergeHistoryTest.php;h=4544e9bed83bf9820f4ff2d95629694fdb9e93f1;hb=344481f60d92ac9295129c5089c0fe467ff497b9;hp=f44ae322727e61555c3d277ff066485055ad24aa;hpb=089612544da3abd89476f41476abc78b0cd98e98;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/phpunit/includes/MergeHistoryTest.php b/tests/phpunit/includes/MergeHistoryTest.php index f44ae32272..4544e9bed8 100644 --- a/tests/phpunit/includes/MergeHistoryTest.php +++ b/tests/phpunit/includes/MergeHistoryTest.php @@ -28,6 +28,12 @@ class MergeHistoryTest extends MediaWikiTestCase { */ public function testIsValidMerge( $source, $dest, $timestamp, $error ) { $this->setMwGlobals( 'wgContentHandlerUseDB', false ); + if ( $timestamp === true ) { + // Although this timestamp is after the latest timestamp of both pages, + // MergeHistory should select the latest source timestamp up to this which should + // still work for the merge. + $timestamp = time() + ( 24 * 3600 ); + } $mh = new MergeHistory( Title::newFromText( $source ), Title::newFromText( $dest ), @@ -45,10 +51,8 @@ class MergeHistoryTest extends MediaWikiTestCase { return [ // for MergeHistory::isValidMerge [ 'Test', 'Test2', false, true ], - // Although this timestamp is after the latest timestamp of both pages, - // MergeHistory should select the latest source timestamp up to this which should - // still work for the merge. - [ 'Test', 'Test2', strtotime( 'tomorrow' ), true ], + // Timestamp of `true` is a placeholder for "in the future"" + [ 'Test', 'Test2', true, true ], [ 'Test', 'Test', false, 'mergehistory-fail-self-merge' ], [ 'Nonexistant', 'Test2', false, 'mergehistory-fail-invalid-source' ], [ 'Test', 'Nonexistant', false, 'mergehistory-fail-invalid-dest' ], @@ -68,7 +72,7 @@ class MergeHistoryTest extends MediaWikiTestCase { public function testIsValidMergeRevisionLimit() { $limit = MergeHistory::REVISION_LIMIT; - $mh = $this->getMockBuilder( 'MergeHistory' ) + $mh = $this->getMockBuilder( MergeHistory::class ) ->setMethods( [ 'getRevisionCount' ] ) ->setConstructorArgs( [ Title::newFromText( 'Test' ),