/** * @return void */ public function test_function() { // prepare $this->setExpectedException('InvalidArgumentException', 'Depth parameter must be an integer'); // invoke logic & test SimpleArrayLibrary::countMinDepth('a', 'z'); }
/** * @param array $data * * @return void * @dataProvider getData */ public function test_function(array $data) { // invoke logic & test $this->assertEquals($data['expResult'], SimpleArrayLibrary::countMinDepth($data['array'], $data['depth'])); }
/** * @param array $repacked * * @return array */ protected function compactDependencies(array $repacked) { if (SimpleArrayLibrary::countMaxDepth($repacked) != 2 || SimpleArrayLibrary::countMinDepth($repacked) != 2) { throw new UnexpectedValueException('Invalid input'); } $return = []; foreach ($repacked as $collection => $data) { $i = $data['i']; unset($data['i']); $return[$i] = [$collection => array_unique($data)]; } ksort($return); $return = array_values($return); $return = array_reverse($return); return $return; }