/**
* @return void
*/
public function initiate($file)
{
list($annotations, $testName) = $this->getAnnotations($file);
$php = clone $this->runner->getInterpreter();
$jobsArgs = array(array());
foreach (get_class_methods($this) as $method) {
if (!preg_match('#^initiate(.+)#', strtolower($method), $m) || !isset($annotations[$m[1]])) {
continue;
}
foreach ((array) $annotations[$m[1]] as $value) {
$res = $this->{$method}($value, $php, $file);
if ($res && is_int($res[0])) {
// [Runner::*, message]
$this->runner->writeResult($testName, $res[0], $res[1]);
return;
} elseif ($res && $res[1]) {
// [param name, values]
$tmp = array();
foreach ($res[1] as $val) {
foreach ($jobsArgs as $args) {
$args[] = Helpers::escapeArg("--{$res['0']}={$val}");
$tmp[] = $args;
}
}
$jobsArgs = $tmp;
}
}
}
foreach ($jobsArgs as $args) {
$this->runner->addJob(new Job($file, $php, $args));
}
}