hhvm/hacktest

Refactor handling of dataproviders to reduce duplication

fredemmott opened this issue · 0 comments

Pseudocode example:

$to_run = vec[];
foreach ($methods as $method) {
  if (!$method->hasDataProvider()) {
    $to_run[] = () ==> $instance->$method();
    continue;
  }
  foreach ($dataprovider->getDataset() as $tuple) {
    $to_run[] = () ==> $instance->$method(...$tuple);
  }
}

foreach ($to_run as $runnable) {
  try {
    $runnable();
   } catch (...) { ... }
}