Exemple #1
0
 /**
  * Runs all unit tests.
  *
  * @param string $test     The test suite to run. Defaults to "Test".
  * @param bool   $untested Whether or not to display untested LOC.
  * @param string $analyze  The path, relative to the base path, to analyze. If not specified, all modules are analyzed.
  *
  * @return array
  */
 public function all($test = null, $untested = false, $analyze = null)
 {
     $suite = new Suite();
     $cover = new Coverage();
     $finder = new FsFinder();
     $finder->is('/\\.php$/');
     $finder->in(__DIR__ . '/../../../' . $analyze);
     $cover->start();
     foreach (App::get() as $name => $module) {
         $path = __DIR__ . '/../../../';
         $path .= $name . '/';
         $path .= App::get()->modules['tests']['path'];
         $suite->addTests(new Finder($path, $test));
     }
     $suite->run($this->getTestEvent());
     $analyzer = $cover->stop();
     foreach ($finder as $file) {
         $analyzer->addFile($file->getRealpath());
     }
     return ['percent' => round(number_format($analyzer->getPercentTested(), 2), 2), 'suite' => $suite, 'report' => $analyzer, 'untested' => $untested];
 }
Exemple #2
0
 public function getIterator()
 {
     $finder = new Finder();
     $finder->in($this->getPathname());
     return $finder;
 }