ParaTest\Runners\PHPUnit\SuiteLoader::load PHP Method

load() public method

Populates the loaded suite collection. Will load suites based off a phpunit xml configuration or a specified path
public load ( string $path = '' )
$path string
    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();
    }

Usage Example

示例#1
0
 /**
  * Builds the collection of pending ExecutableTest objects
  * to run. If functional mode is enabled $this->pending will
  * contain a collection of TestMethod objects instead of Suite
  * objects
  */
 protected function load()
 {
     $loader = new SuiteLoader($this->options);
     $loader->load($this->options->path);
     $executables = $this->options->functional ? $loader->getTestMethods() : $loader->getSuites();
     $this->pending = array_merge($this->pending, $executables);
     foreach ($this->pending as $pending) {
         $this->printer->addTest($pending);
     }
 }
All Usage Examples Of ParaTest\Runners\PHPUnit\SuiteLoader::load