You are here

protected function PHPUnit_TextUI_Command::handleLoader in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/phpunit/phpunit/src/TextUI/Command.php \PHPUnit_TextUI_Command::handleLoader()

Handles the loading of the PHPUnit_Runner_TestSuiteLoader implementation.

Parameters

string $loaderClass:

string $loaderFile:

Return value

PHPUnit_Runner_TestSuiteLoader

1 call to PHPUnit_TextUI_Command::handleLoader()
PHPUnit_TextUI_Command::handleArguments in vendor/phpunit/phpunit/src/TextUI/Command.php
Handles the command-line arguments.

File

vendor/phpunit/phpunit/src/TextUI/Command.php, line 672

Class

PHPUnit_TextUI_Command
A TestRunner for the Command Line Interface (CLI) PHP SAPI Module.

Code

protected function handleLoader($loaderClass, $loaderFile = '') {
  if (!class_exists($loaderClass, false)) {
    if ($loaderFile == '') {
      $loaderFile = PHPUnit_Util_Filesystem::classNameToFilename($loaderClass);
    }
    $loaderFile = stream_resolve_include_path($loaderFile);
    if ($loaderFile) {
      require $loaderFile;
    }
  }
  if (class_exists($loaderClass, false)) {
    $class = new ReflectionClass($loaderClass);
    if ($class
      ->implementsInterface('PHPUnit_Runner_TestSuiteLoader') && $class
      ->isInstantiable()) {
      return $class
        ->newInstance();
    }
  }
  if ($loaderClass == 'PHPUnit_Runner_StandardTestSuiteLoader') {
    return;
  }
  $this
    ->showError(sprintf('Could not use "%s" as loader.', $loaderClass));
}