X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=tests%2Fphpunit%2Fincludes%2Futils%2FUIDGeneratorTest.php;h=d746ea1459364d4f6418f37b121074a7b39c020f;hb=0d0059d36e7494792378c020f5de6033985c3637;hp=7123b943fcf0c2be831a5de1f6646db4d1b2e13d;hpb=174f34a86de3162bc673fd3bc6bed815cccf0edc;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/phpunit/includes/utils/UIDGeneratorTest.php b/tests/phpunit/includes/utils/UIDGeneratorTest.php index 7123b943fc..d746ea1459 100644 --- a/tests/phpunit/includes/utils/UIDGeneratorTest.php +++ b/tests/phpunit/includes/utils/UIDGeneratorTest.php @@ -9,21 +9,24 @@ class UIDGeneratorTest extends PHPUnit_Framework_TestCase { } /** + * Flaky test (T131549). + * + * @group Broken * @dataProvider provider_testTimestampedUID * @covers UIDGenerator::newTimestampedUID128 * @covers UIDGenerator::newTimestampedUID88 */ public function testTimestampedUID( $method, $digitlen, $bits, $tbits, $hostbits ) { - $id = call_user_func( array( 'UIDGenerator', $method ) ); + $id = call_user_func( [ 'UIDGenerator', $method ] ); $this->assertEquals( true, ctype_digit( $id ), "UID made of digit characters" ); $this->assertLessThanOrEqual( $digitlen, strlen( $id ), "UID has the right number of digits" ); $this->assertLessThanOrEqual( $bits, strlen( Wikimedia\base_convert( $id, 10, 2 ) ), "UID has the right number of bits" ); - $ids = array(); + $ids = []; for ( $i = 0; $i < 300; $i++ ) { - $ids[] = call_user_func( array( 'UIDGenerator', $method ) ); + $ids[] = call_user_func( [ 'UIDGenerator', $method ] ); } $lastId = array_shift( $ids ); @@ -55,18 +58,18 @@ class UIDGeneratorTest extends PHPUnit_Framework_TestCase { * NOTE: When adding a new method name here please update the covers tags for the tests! */ public static function provider_testTimestampedUID() { - return array( - array( 'newTimestampedUID128', 39, 128, 46, 48 ), - array( 'newTimestampedUID128', 39, 128, 46, 48 ), - array( 'newTimestampedUID88', 27, 88, 46, 32 ), - ); + return [ + [ 'newTimestampedUID128', 39, 128, 46, 48 ], + [ 'newTimestampedUID128', 39, 128, 46, 48 ], + [ 'newTimestampedUID88', 27, 88, 46, 32 ], + ]; } /** * @covers UIDGenerator::newUUIDv1 */ public function testUUIDv1() { - $ids = array(); + $ids = []; for ( $i = 0; $i < 100; $i++ ) { $id = UIDGenerator::newUUIDv1(); $this->assertEquals( true, @@ -79,7 +82,7 @@ class UIDGeneratorTest extends PHPUnit_Framework_TestCase { preg_match( '!^[0-9a-f]{12}1[0-9a-f]{3}[89ab][0-9a-f]{15}$!', $id ), "UID $id has the right format" ); - $id = UIDGenerator::newRawUUIDv1( UIDGenerator::QUICK_RAND ); + $id = UIDGenerator::newRawUUIDv1(); $this->assertEquals( true, preg_match( '!^[0-9a-f]{12}1[0-9a-f]{3}[89ab][0-9a-f]{15}$!', $id ), "UID $id has the right format" ); @@ -92,7 +95,7 @@ class UIDGeneratorTest extends PHPUnit_Framework_TestCase { * @covers UIDGenerator::newUUIDv4 */ public function testUUIDv4() { - $ids = array(); + $ids = []; for ( $i = 0; $i < 100; $i++ ) { $id = UIDGenerator::newUUIDv4(); $ids[] = $id;