3 * Test class for ArrayUtils class
8 class ArrayUtilsTest
extends PHPUnit_Framework_TestCase
{
12 * @covers ArrayUtils::findLowerBound
13 * @dataProvider provideFindLowerBound
15 function testFindLowerBound(
16 $valueCallback, $valueCount, $comparisonCallback, $target, $expected
19 ArrayUtils
::findLowerBound(
20 $valueCallback, $valueCount, $comparisonCallback, $target
25 function provideFindLowerBound() {
26 $indexValueCallback = function ( $size ) {
27 return function ( $val ) use ( $size ) {
28 $this->assertTrue( $val >= 0 );
29 $this->assertTrue( $val < $size );
33 $comparisonCallback = function ( $a, $b ) {
39 $indexValueCallback( 0 ),
46 $indexValueCallback( 1 ),
53 $indexValueCallback( 1 ),
60 $indexValueCallback( 1 ),
67 $indexValueCallback( 2 ),
74 $indexValueCallback( 2 ),
81 $indexValueCallback( 2 ),
88 $indexValueCallback( 2 ),
95 $indexValueCallback( 2 ),
102 $indexValueCallback( 3 ),
109 $indexValueCallback( 3 ),
116 $indexValueCallback( 3 ),
123 $indexValueCallback( 3 ),
133 * @covers ArrayUtils::arrayDiffAssocRecursive
134 * @dataProvider provideArrayDiffAssocRecursive
136 function testArrayDiffAssocRecursive( $expected ) {
137 $args = func_get_args();
138 array_shift( $args );
139 $this->assertEquals( call_user_func_array(
140 'ArrayUtils::arrayDiffAssocRecursive', $args
144 function provideArrayDiffAssocRecursive() {
275 [ 1 => [ [ 2, 3 ], 2 ] ],
276 [ 1, [ [ 2, 3 ], 2 ] ],
280 [ 1 => [ [ 2 ], 2 ] ],
281 [ 1, [ [ 2, 3 ], 2 ] ],
282 [ 1, [ [ 1 => 3 ] ] ],
286 [ 1, [ [ 2, 3 ], 2 ] ],
287 [ 1, [ [ 1 => 3, 0 => 2 ] ] ],
291 [ 1, [ [ 2, 3 ], 2 ] ],
292 [ 1, [ [ 1 => 3 ] ] ],
297 [ 1, [ [ 2, 3 ], 2 ] ],
298 [ 1 => [ 1 => 2, 0 => [ 1 => 3, 0 => 2 ] ], 0 => 1 ],
302 [ 1, [ [ 2, 3 ], 2 ] ],
304 [ 1 => [ [ 1 => 3 ] ] ],