private function includeTestPaths()
{
$runner = $this;
$includer = function ($path) use($runner) {
include_once $path;
};
foreach ($this->testPaths as $testPath) {
try {
$declaredTestClasses = $this->findTestClasses();
$numberOfIncludedFiles = sizeof(get_included_files());
$this->includer->includePath($testPath, $includer);
if ($numberOfIncludedFiles < sizeof(get_included_files()) && sizeof(array_diff($this->findTestClasses(), $declaredTestClasses)) <= 0 && $this->testGenerator !== null) {
$this->testGenerator->generate($testPath);
try {
$this->includer->includePath($testPath, function ($testPath) use($runner) {
include $testPath;
});
} catch (includer\exception $exception) {
throw new exceptions\runtime\file(sprintf($this->getLocale()->_('Unable to add test file \'%s\''), $testPath));
}
}
} catch (includer\exception $exception) {
if ($this->testGenerator === null) {
throw new exceptions\runtime\file(sprintf($this->getLocale()->_('Unable to add test file \'%s\''), $testPath));
} else {
$this->testGenerator->generate($testPath);
try {
$this->includer->includePath($testPath, $includer);
} catch (includer\exception $exception) {
throw new exceptions\runtime\file(sprintf($this->getLocale()->_('Unable to generate test file \'%s\''), $testPath));
}
}
}
}
return $this;
}