From 331691e33250464064ef4727a718fa5f7d20da15 Mon Sep 17 00:00:00 2001 From: Marcin Kurczewski Date: Wed, 14 May 2014 09:34:20 +0200 Subject: [PATCH] Fixed constructing job file list in tests --- tests/Tests/AbstractFullApiTest.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/Tests/AbstractFullApiTest.php b/tests/Tests/AbstractFullApiTest.php index c16ec388..cefb6aa2 100644 --- a/tests/Tests/AbstractFullApiTest.php +++ b/tests/Tests/AbstractFullApiTest.php @@ -19,7 +19,12 @@ abstract class AbstractFullApiTest extends AbstractTest protected function getAllJobs() { - $files = glob(getConfig()->rootDir . DS . 'src' . DS . 'Api' . DS . 'Jobs' . DS . '*.php'); + $pathToJobs = getConfig()->rootDir . DS . 'src' . DS . 'Api' . DS . 'Jobs'; + $directory = new RecursiveDirectoryIterator($pathToJobs); + $iterator = new RecursiveIteratorIterator($directory); + $regex = new RegexIterator($iterator, '/^.+Job\.php$/i'); + $files = array_keys(iterator_to_array($regex)); + \Chibi\Util\Reflection::loadClasses($files); return array_filter(get_declared_classes(), function($x) {