/** * @return void */ private function findTests($path) { if (is_dir($path)) { foreach (glob("{$path}/*", GLOB_ONLYDIR) as $dir) { $this->findTests($dir); } $path .= '/*.phpt'; } foreach (glob($path) as $file) { if (is_file($file)) { $this->testHandler->initiate(realpath($file)); } } }
/** * @return void */ private function findTests($path) { if (strpbrk($path, '*?') === FALSE && !file_exists($path)) { throw new \InvalidArgumentException("File or directory '{$path}' not found."); } if (is_dir($path)) { foreach (glob(str_replace('[', '[[]', $path) . '/*', GLOB_ONLYDIR) ?: [] as $dir) { $this->findTests($dir); } $path .= '/*.' . self::TEST_FILE_EXTENSION; } foreach (glob(str_replace('[', '[[]', $path)) ?: [] as $file) { if (is_file($file)) { $this->testHandler->initiate(realpath($file)); } } }