X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=tests%2Fphpunit%2Fincludes%2Fpoolcounter%2FPoolCounterTest.php;h=d57ad0412591956275aeaddbb9291f46ca468566;hb=e968a1f431ad058dcb14adb2757bde5664b99a79;hp=15b47b4a8cf75c80b6c917e4e4a24aa795afdd68;hpb=8eac2feedb7ee093d2c48504e1eb2b8a9dbc8452;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/phpunit/includes/poolcounter/PoolCounterTest.php b/tests/phpunit/includes/poolcounter/PoolCounterTest.php index 15b47b4a8c..d57ad04125 100644 --- a/tests/phpunit/includes/poolcounter/PoolCounterTest.php +++ b/tests/phpunit/includes/poolcounter/PoolCounterTest.php @@ -56,17 +56,26 @@ class PoolCounterTest extends MediaWikiTestCase { $keysWithTwoSlots = $keysWithFiveSlots = []; foreach ( range( 1, 100 ) as $i ) { - $keysWithTwoSlots[] = $hashKeyIntoSlots->invoke( $poolCounter, 'key ' . $i, 2 ); - $keysWithFiveSlots[] = $hashKeyIntoSlots->invoke( $poolCounter, 'key ' . $i, 5 ); + $keysWithTwoSlots[] = $hashKeyIntoSlots->invoke( $poolCounter, 'test', 'key ' . $i, 2 ); + $keysWithFiveSlots[] = $hashKeyIntoSlots->invoke( $poolCounter, 'test', 'key ' . $i, 5 ); } - $this->assertArrayEquals( range( 0, 1 ), array_unique( $keysWithTwoSlots ) ); - $this->assertArrayEquals( range( 0, 4 ), array_unique( $keysWithFiveSlots ) ); + $twoSlotKeys = []; + for ( $i = 0; $i <= 1; $i++ ) { + $twoSlotKeys[] = "test:$i"; + } + $fiveSlotKeys = []; + for ( $i = 0; $i <= 4; $i++ ) { + $fiveSlotKeys[] = "test:$i"; + } + + $this->assertArrayEquals( $twoSlotKeys, array_unique( $keysWithTwoSlots ) ); + $this->assertArrayEquals( $fiveSlotKeys, array_unique( $keysWithFiveSlots ) ); // make sure it is deterministic $this->assertEquals( - $hashKeyIntoSlots->invoke( $poolCounter, 'asdfgh', 1000 ), - $hashKeyIntoSlots->invoke( $poolCounter, 'asdfgh', 1000 ) + $hashKeyIntoSlots->invoke( $poolCounter, 'test', 'asdfgh', 1000 ), + $hashKeyIntoSlots->invoke( $poolCounter, 'test', 'asdfgh', 1000 ) ); } }