public function getTests() { $config = \Yii::$app->controller->module->params; foreach ($config['tests'] as $type => $active) { // Get out of the loop in case the type is deactivated in config if (!$active) { break; } // Configure the file iterator $directory = new \RecursiveDirectoryIterator("{$this->configuration['paths']['tests']}/{$type}/", \RecursiveDirectoryIterator::KEY_AS_FILENAME | \RecursiveDirectoryIterator::CURRENT_AS_FILEINFO); $phpfiles = new \RegexIterator(new \RecursiveIteratorIterator($directory), '/^.+(Cept|Cest|Test)\\.php$/i', \RegexIterator::MATCH, \RegexIterator::USE_KEY); foreach ($phpfiles as $file) { if (!in_array($file->getFilename(), $config['ignore']) && $file->isFile()) { $test = new Test(); $test->initialize($type, $file); array_push($this->tests, $test); unset($test); } } } }