예제 #1
0
 public function loadFile($filePath)
 {
     if ($this->bootstrap) {
         require_once $this->bootstrap;
     }
     if (!preg_match('/[tT]est\\.php$/', $filePath)) {
         return false;
     }
     $classes = array_filter(ClassDiscoverer::getDeclaredClasses($filePath), [$this, 'isTestClass']);
     if (empty($classes)) {
         return false;
     }
     $testPlan = new ParallelTestPlan();
     foreach ($classes as $class) {
         $testPlan->addTestPlan($this->makeTestPlan($filePath, $class));
     }
     return $testPlan;
 }
예제 #2
0
파일: Runner.php 프로젝트: djfm/ftr
 public function loadTests()
 {
     $files = $this->listTestFiles();
     $loader = new Loader();
     $loader->setBootstrap($this->bootstrap);
     $loader->setDataProviderFilter($this->dataProviderFilter);
     $loader->setFilter($this->filter);
     $testPlan = new ParallelTestPlan();
     foreach ($files as $file) {
         for ($n = 0; $n < $this->stress; ++$n) {
             $plan = $loader->loadFile($file);
             if ($plan) {
                 $testPlan->addTestPlan($plan);
             }
         }
     }
     $testsCount = $testPlan->getTestsCount();
     $countMessage = $testsCount > 1 ? 'Found %d tests to run.' : 'Found %d test to run.';
     $this->writeln(sprintf("<info>{$countMessage}</info>", $testsCount));
     $this->executionPlans = $testPlan->getExecutionPlans();
     $epsCount = count($this->executionPlans);
     $epsMessage = $testsCount > 1 ? 'Tests are split into %d execution plans.' : 'There is %d execution plan.';
     $this->writeln(sprintf("<comment>{$epsMessage}</comment>", $epsCount));
     $this->testsCount = $testsCount;
 }