Example #1
0
 /**
  * Populates the loaded suite collection. Will load suites
  * based off a phpunit xml configuration or a specified path
  *
  * @param string $path
  * @throws \RuntimeException
  */
 public function load($path = '')
 {
     if (is_object($this->options) && isset($this->options->filtered['configuration'])) {
         $configuration = $this->options->filtered['configuration'];
     } else {
         $configuration = new Configuration('');
     }
     $excludedGroups = array_merge($this->options->excludeGroups, $configuration->getExcludedGroups());
     $this->options->excludeGroups = $excludedGroups;
     if ($path) {
         $this->loadPath($path);
     } elseif (isset($this->options->testsuite) && $this->options->testsuite) {
         foreach ($configuration->getSuiteByName($this->options->testsuite) as $suite) {
             foreach ($suite as $suitePath) {
                 $this->loadPath($suitePath);
             }
         }
     } elseif ($suites = $configuration->getSuites()) {
         foreach ($suites as $suite) {
             foreach ($suite as $suitePath) {
                 $this->loadPath($suitePath);
             }
         }
     }
     if (!$this->files) {
         throw new \RuntimeException("No path or configuration provided (tests must end with Test.php)");
     }
     $this->files = array_unique($this->files);
     // remove duplicates
     $this->initSuites();
 }