/** * 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(''); } if ($path) { $testFileLoader = new TestFileLoader($this->options); $this->files = array_merge($this->files, $testFileLoader->loadPath($path)); } elseif (isset($this->options->testsuite) && $this->options->testsuite) { foreach ($configuration->getSuiteByName($this->options->testsuite) as $suite) { foreach ($suite as $suitePath) { $testFileLoader = new TestFileLoader($this->options); $this->files = array_merge($this->files, $testFileLoader->loadSuitePath($suitePath)); } } } elseif ($suites = $configuration->getSuites()) { foreach ($suites as $suite) { foreach ($suite as $suitePath) { $testFileLoader = new TestFileLoader($this->options); $this->files = array_merge($this->files, $testFileLoader->loadSuitePath($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(); }
/** * 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(''); } if ($path) { $this->loadPath($path); } elseif ($suites = $configuration->getSuites()) { foreach ($suites as $dirs) { foreach ($dirs as $path) { $this->loadPath($path); } } } if (!$this->files) { throw new \RuntimeException("No path or configuration provided (tests must end with Test.php)"); } $this->initSuites(); }