John Erling Blad has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/56152


Change subject: Fix clock ticks in test
......................................................................

Fix clock ticks in test

If the time is picked up several different places and compared
there can be a "race condition" where the clock ticks and the
tests fails because the time isn't equal anymore. This fixes
one such case.

Change-Id: I11e08591f24404825df22d2613db4b407e75803b
---
M lib/tests/phpunit/changes/ChangeRowTest.php
1 file changed, 3 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/52/56152/1

diff --git a/lib/tests/phpunit/changes/ChangeRowTest.php 
b/lib/tests/phpunit/changes/ChangeRowTest.php
index 17edf91..81f6ead 100644
--- a/lib/tests/phpunit/changes/ChangeRowTest.php
+++ b/lib/tests/phpunit/changes/ChangeRowTest.php
@@ -152,9 +152,9 @@
         * @dataProvider instanceProvider
         */
        public function testGetAge( $changeRow ) {
-               $this->assertEquals(
-                       time() - (int)wfTimestamp( TS_UNIX, '20130101000000' ),
-                       $changeRow->getAge()
+               // Don't assert on equalness due to clock ticks!
+               $this->assertTrue(
+                       abs( time() - (int)wfTimestamp( TS_UNIX, 
'20130101000000' ) - $changeRow->getAge() ) <= 1
                );
        }
 

-- 
To view, visit https://gerrit.wikimedia.org/r/56152
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I11e08591f24404825df22d2613db4b407e75803b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: John Erling Blad <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to