8 call_user_func_array(
'parent::__construct', func_get_args() );
14 $poolCounterConfig = [
15 'class' =>
'PoolCounterMock',
21 $poolCounter = $this->getMockBuilder(
'PoolCounterAbstractMock' )
22 ->setConstructorArgs( [ $poolCounterConfig,
'testCounter',
'someKey' ] )
25 ->setMethods( [
'idontexist' ] )
26 ->getMockForAbstractClass();
27 $this->assertInstanceOf(
'PoolCounter', $poolCounter );
31 $poolCounterConfig = [
32 'class' =>
'PoolCounterMock',
39 $poolCounter = $this->getMockBuilder(
'PoolCounterAbstractMock' )
40 ->setConstructorArgs( [ $poolCounterConfig,
'testCounter',
'key' ] )
41 ->setMethods( [
'idontexist' ] )
42 ->getMockForAbstractClass();
43 $this->assertInstanceOf(
'PoolCounter', $poolCounter );
47 $poolCounter = $this->getMockBuilder(
'PoolCounterAbstractMock' )
50 ->setMethods( [
'idontexist' ] )
51 ->disableOriginalConstructor()
52 ->getMockForAbstractClass();
54 $hashKeyIntoSlots =
new ReflectionMethod( $poolCounter,
'hashKeyIntoSlots' );
55 $hashKeyIntoSlots->setAccessible(
true );
57 $keysWithTwoSlots = $keysWithFiveSlots = [];
58 foreach ( range( 1, 100 )
as $i ) {
59 $keysWithTwoSlots[] = $hashKeyIntoSlots->invoke( $poolCounter,
'test',
'key ' . $i, 2 );
60 $keysWithFiveSlots[] = $hashKeyIntoSlots->invoke( $poolCounter,
'test',
'key ' . $i, 5 );
64 for ( $i = 0; $i <= 1; $i++ ) {
65 $twoSlotKeys[] =
"test:$i";
68 for ( $i = 0; $i <= 4; $i++ ) {
69 $fiveSlotKeys[] =
"test:$i";
77 $hashKeyIntoSlots->invoke( $poolCounter,
'test',
'asdfgh', 1000 ),
78 $hashKeyIntoSlots->invoke( $poolCounter,
'test',
'asdfgh', 1000 )