Beispiel #1
0
 /**
  * Collect test classes of the given type from Modules'
  *
  * @param string $classType
  * @return array
  */
 public function get($classType, array $includeOnly = [])
 {
     $classes = [];
     $modules = $this->moduleResolver->getModulesPath();
     foreach ($modules as $modulePath) {
         if (!is_readable($modulePath . '/Test/' . $classType)) {
             continue;
         }
         $dirIterator = new \RegexIterator(new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($modulePath . '/Test/' . $classType, \FilesystemIterator::SKIP_DOTS)), '/.php$/i');
         foreach ($dirIterator as $fileInfo) {
             /** @var $fileInfo \SplFileInfo */
             $filePath = $fileInfo->getRealPath();
             $filePath = str_replace('\\', '/', $filePath);
             $classPath = str_replace(MTF_TESTS_PATH, '', $filePath);
             $className = str_replace('/', '\\', $classPath);
             $className = str_replace('.php', '', $className);
             if (!empty($includeOnly)) {
                 if (false === array_search($className, $includeOnly)) {
                     continue;
                 }
             }
             $classes[] = ['name' => $className, 'class' => $className, 'path' => $filePath];
         }
     }
     return $classes;
 }
 function test_initial_slash_not_required()
 {
     $ds = new ModuleResolver();
     $record = $ds->retrieve('/dummy/test/single');
     $this->assertEqual('/dummy/test/single', $record['url']);
     $record = $ds->retrieve('dummy/test/single');
     $this->assertEqual('/dummy/test/single', $record['url']);
 }