public function testCombinationsStatic() { // Size 0 combinations --------------------------------------------------------------------- $combinationList0 = Combination::get($this->_sourceDataSetKey, 0); $expectedList0 = []; $this->_assertCombination($combinationList0, $expectedList0, 0); // Size 1 combinations --------------------------------------------------------------------- $combinationList1 = Combination::get($this->_sourceDataSetKey, 1); $expectedList1 = [['a' => 5], ['b' => 6], ['c' => 8], ['d' => 10]]; $this->_assertCombination($combinationList1, $expectedList1, 4, 1); // If this test pass, we don't need to check for other Index arrays as it proves that the // combination is still treated as a map and thus if the key arrays tests pass, so would the // indexed arrays $combinationIdxList1 = Combination::get($this->_sourceDataSetIdx, 1); $expectedIdxList1 = [[0 => 5], [1 => 6], [2 => 8], [3 => 10]]; $this->_assertCombination($combinationIdxList1, $expectedIdxList1, 4, 1); // Size 3 combinations --------------------------------------------------------------------- $combinationList3 = Combination::get($this->_sourceDataSetKey, 3); $expectedList3 = [['a' => 5, 'b' => 6, 'c' => 8], ['a' => 5, 'b' => 6, 'd' => 10], ['a' => 5, 'c' => 8, 'd' => 10], ['b' => 6, 'c' => 8, 'd' => 10]]; $this->_assertCombination($expectedList3, $combinationList3, 4, 3); // Size 4 combinations --------------------------------------------------------------------- $combinationList4 = Combination::get($this->_sourceDataSetKey, 4); $expectedList4 = [['a' => 5, 'b' => 6, 'c' => 8, 'd' => 10]]; $this->_assertCombination($expectedList4, $combinationList4, 1, 4); // Size 3 combinations --------------------------------------------------------------------- $combinationList = Combination::get($this->_sourceDataSetKey); $expectedList = [['a' => 5], ['b' => 6], ['c' => 8], ['d' => 10], ['a' => 5, 'b' => 6], ['a' => 5, 'c' => 8], ['a' => 5, 'd' => 10], ['b' => 6, 'c' => 8], ['b' => 6, 'd' => 10], ['c' => 8, 'd' => 10], ['a' => 5, 'b' => 6, 'c' => 8], ['a' => 5, 'b' => 6, 'd' => 10], ['a' => 5, 'c' => 8, 'd' => 10], ['b' => 6, 'c' => 8, 'd' => 10], ['a' => 5, 'b' => 6, 'c' => 8, 'd' => 10]]; $this->_assertCombination($expectedList, $combinationList, 15); }