Exemplo n.º 1
0
 public function scan($rootPath)
 {
     $rootPath = realpath(APP_ROOT . DIRECTORY_SEPARATOR . $rootPath);
     $scanner = new RecursiveFileScanner();
     $scanner->prepare(RecursiveFileFilter::createExtNameFilter("php"));
     $types = TypeScanner::scan($scanner->scan($rootPath), array('\\classes\\stereotype\\Component'));
     return $types;
 }
Exemplo n.º 2
0
 public function testFileScanner()
 {
     $scanner = new RecursiveFileScanner();
     $scanner->prepare(RecursiveFileFilter::createExtNameFilter("php"));
     $results = $scanner->scan(APP_ROOT . "/app/classes");
     $this->assertTrue(is_array($results), "not valid");
     $this->assertNotEquals(0, count($results), "no results");
     //var_dump("filescanner",$results);
 }
Exemplo n.º 3
0
 /**
  *
  * @return PerminatorPHPUnitSuite
  */
 public static function suite()
 {
     $suite = new self();
     $suite->setName(__CLASS__);
     $rootPath = realpath(APP_ROOT . 'test');
     $scanner = new RecursiveFileScanner();
     $scanner->prepare(RecursiveFileFilter::createExtNameFilter("php"));
     $types = TypeScanner::scan($scanner->scan($rootPath), array('\\PHPUnit_Framework_TestCase'), array(), array());
     foreach ($types as $type) {
         $suite->addTestSuite($type);
     }
     return $suite;
 }
Exemplo n.º 4
0
 public function scan($rootPathName)
 {
     if (is_null($this->filter)) {
         throw new \LogicException("not prepared RecursiveFileFilter.");
     }
     if ($rootPathName instanceof \SplFileInfo) {
         /* @var $rootPathName \SplFileInfo */
         $dirs = new \RecursiveDirectoryIterator($rootPathName->getPathname());
     } elseif (is_string($rootPathName)) {
         /* @var $rootPathName string */
         $dirs = new \RecursiveDirectoryIterator($rootPathName);
     }
     foreach ($dirs as $dir) {
         /* @var $file \SplFileInfo */
         $fileName = $dir->getFilename();
         $pathName = realpath($dir->getPathname());
         if ($fileName == '..' || $fileName == '.') {
             continue;
         } elseif (is_dir($pathName)) {
             if ($this->filter->conformityConditions($pathName)) {
                 $this->foundFiles[] = $pathName;
             }
             $this->scan($pathName);
         }
     }
     return $this->foundFiles;
 }