$values) { $tests = static::expandOneValue($tests, $substitute, $values); } return $tests; } /** * Given an array of test data, where each element is * data to pass to a unit test, find any element in any * one test item whose value is exactly $substitute. * Make a new test item for every item in $values, using * each as the substitution for $substitute. */ public static function expandOneValue($tests, $substitute, $values) { $result = []; foreach($tests as $test) { $position = array_search($substitute, $test); if ($position === FALSE) { $result[] = $test; } else { foreach($values as $replacement) { $test[$position] = $replacement; $result[] = $test; } } } return $result; } }