From: Aaron Schulz Date: Fri, 29 Mar 2019 21:14:05 +0000 (-0700) Subject: Fix flakey MCR test in RevisionDbTestBase by mocking the time X-Git-Tag: 1.34.0-rc.0~2236^2 X-Git-Url: http://git.cyclocoop.org/%22.%24info%5B?a=commitdiff_plain;h=642dbe157b80e29bc031f0bfadaab705455878e8;p=lhc%2Fweb%2Fwiklou.git Fix flakey MCR test in RevisionDbTestBase by mocking the time Change-Id: I1d089d7b155adb865b42f7e8a26466553508c9be --- diff --git a/tests/phpunit/includes/RevisionDbTestBase.php b/tests/phpunit/includes/RevisionDbTestBase.php index a17d21dbad..d7f4fd62ea 100644 --- a/tests/phpunit/includes/RevisionDbTestBase.php +++ b/tests/phpunit/includes/RevisionDbTestBase.php @@ -26,6 +26,7 @@ abstract class RevisionDbTestBase extends MediaWikiTestCase { [ 'page', 'revision', + 'comment', 'ip_changes', 'text', 'archive', @@ -1396,6 +1397,9 @@ abstract class RevisionDbTestBase extends MediaWikiTestCase { $this->setService( 'MainWANObjectCache', $cache ); $db = wfGetDB( DB_MASTER ); + $now = 1553893742; + $cache->setMockTime( $now ); + // Get a fresh revision to use during testing $this->testPage->doEditContent( new WikitextContent( __METHOD__ ), __METHOD__ ); $rev = $this->testPage->getRevision(); @@ -1410,6 +1414,8 @@ abstract class RevisionDbTestBase extends MediaWikiTestCase { $cache->delete( $key, WANObjectCache::HOLDOFF_NONE ); $this->assertFalse( $cache->get( $key ) ); + ++$now; + // Get the new revision and make sure it is in the cache and correct $newRev = Revision::newKnownCurrent( $db, $rev->getPage(), $rev->getId() ); $this->assertRevEquals( $rev, $newRev );