/** * Execute test * @param string $section Default is null. Class name will be used as section name if not found. * @return array result */ protected function executeTest($section = null) { if ($section === null) { $chosenSection = urldecode($this->getKeyParam('section')); } else { $chosenSection = $section; } // echo 'Running test suite for all section'; $list = DooFile::getFilePathIndexList($this->getScenarioPath()); $this->result = array(); foreach ($list as $path) { $pathinfo = pathinfo($path); if ($pathinfo['extension'] !== 'php') { continue; } require_once $path; $cls = explode('.', $pathinfo['filename']); $cls = $cls[0]; $obj = new $cls(); $section = $obj->getSectionName(); if (empty($section)) { $section = $cls; } //if section is specified, test only that section if (!empty($chosenSection) && $chosenSection !== $section) { continue; } if (empty($section)) { $section = $cls; } //prepare the specs $obj->prepare(); $this->result[$section] = $this->bdd->run($obj->specs, $this->includeSubject); } return $this->result; }