From: Tim Landscheidt Date: Thu, 20 Nov 2014 23:32:23 +0000 (+0000) Subject: Fix errors in UIDGeneratorTest::testTimestampedUID X-Git-Tag: 1.31.0-rc.0~13218^2 X-Git-Url: http://git.cyclocoop.org/%7B%24admin_url%7Dcompta/comptes/journal.php?a=commitdiff_plain;h=24b08513ef7ab1127420a70cb76358a08777598b;hp=21d434948d201bfd2dc0e7a75dac0b5ba4e0c75e;p=lhc%2Fweb%2Fwiklou.git Fix errors in UIDGeneratorTest::testTimestampedUID Currently, this test passes in Jenkins, but not with Travis CI's hhvm where apparently code execution is slower so not all UIDs are created within the same millisecond. This also previously masked that the test did not indeed test if the host bits are identical as instead it tested the MSBs twice. Bug: 73668 Change-Id: Ic68af599599ace5faa6a687d115d2d3802f6ba1b --- diff --git a/tests/phpunit/includes/utils/UIDGeneratorTest.php b/tests/phpunit/includes/utils/UIDGeneratorTest.php index 50fa384933..0e11ccad59 100644 --- a/tests/phpunit/includes/utils/UIDGeneratorTest.php +++ b/tests/phpunit/includes/utils/UIDGeneratorTest.php @@ -35,14 +35,14 @@ class UIDGeneratorTest extends MediaWikiTestCase { $lastId_bin = wfBaseConvert( $lastId, 10, 2 ); $this->assertGreaterThanOrEqual( - substr( $id_bin, 0, $tbits ), substr( $lastId_bin, 0, $tbits ), + substr( $id_bin, 0, $tbits ), "New ID timestamp ($id_bin) >= prior one ($lastId_bin)." ); if ( $hostbits ) { $this->assertEquals( - substr( $id_bin, 0, -$hostbits ), - substr( $lastId_bin, 0, -$hostbits ), + substr( $id_bin, -$hostbits ), + substr( $lastId_bin, -$hostbits ), "Host ID of ($id_bin) is same as prior one ($lastId_bin)." ); }