You are here

public function PHPUnit_Util_Configuration::getPHPUnitConfiguration in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/phpunit/phpunit/src/Util/Configuration.php \PHPUnit_Util_Configuration::getPHPUnitConfiguration()

Returns the PHPUnit configuration.

@since Method available since Release 3.2.14

Return value

array

File

vendor/phpunit/phpunit/src/Util/Configuration.php, line 545

Class

PHPUnit_Util_Configuration
Wrapper for the PHPUnit XML configuration file.

Code

public function getPHPUnitConfiguration() {
  $result = array();
  $root = $this->document->documentElement;
  if ($root
    ->hasAttribute('cacheTokens')) {
    $result['cacheTokens'] = $this
      ->getBoolean((string) $root
      ->getAttribute('cacheTokens'), false);
  }
  if ($root
    ->hasAttribute('columns')) {
    $columns = (string) $root
      ->getAttribute('columns');
    if ($columns == 'max') {
      $result['columns'] = 'max';
    }
    else {
      $result['columns'] = $this
        ->getInteger($columns, 80);
    }
  }
  if ($root
    ->hasAttribute('colors')) {

    /* only allow boolean for compatibility with previous versions
       'always' only allowed from command line */
    if ($this
      ->getBoolean($root
      ->getAttribute('colors'), false)) {
      $result['colors'] = PHPUnit_TextUI_ResultPrinter::COLOR_AUTO;
    }
    else {
      $result['colors'] = PHPUnit_TextUI_ResultPrinter::COLOR_NEVER;
    }
  }

  /*
   * Issue #657
   */
  if ($root
    ->hasAttribute('stderr')) {
    $result['stderr'] = $this
      ->getBoolean((string) $root
      ->getAttribute('stderr'), false);
  }
  if ($root
    ->hasAttribute('backupGlobals')) {
    $result['backupGlobals'] = $this
      ->getBoolean((string) $root
      ->getAttribute('backupGlobals'), true);
  }
  if ($root
    ->hasAttribute('backupStaticAttributes')) {
    $result['backupStaticAttributes'] = $this
      ->getBoolean((string) $root
      ->getAttribute('backupStaticAttributes'), false);
  }
  if ($root
    ->getAttribute('bootstrap')) {
    $result['bootstrap'] = $this
      ->toAbsolutePath((string) $root
      ->getAttribute('bootstrap'));
  }
  if ($root
    ->hasAttribute('convertErrorsToExceptions')) {
    $result['convertErrorsToExceptions'] = $this
      ->getBoolean((string) $root
      ->getAttribute('convertErrorsToExceptions'), true);
  }
  if ($root
    ->hasAttribute('convertNoticesToExceptions')) {
    $result['convertNoticesToExceptions'] = $this
      ->getBoolean((string) $root
      ->getAttribute('convertNoticesToExceptions'), true);
  }
  if ($root
    ->hasAttribute('convertWarningsToExceptions')) {
    $result['convertWarningsToExceptions'] = $this
      ->getBoolean((string) $root
      ->getAttribute('convertWarningsToExceptions'), true);
  }
  if ($root
    ->hasAttribute('forceCoversAnnotation')) {
    $result['forceCoversAnnotation'] = $this
      ->getBoolean((string) $root
      ->getAttribute('forceCoversAnnotation'), false);
  }
  if ($root
    ->hasAttribute('mapTestClassNameToCoveredClassName')) {
    $result['mapTestClassNameToCoveredClassName'] = $this
      ->getBoolean((string) $root
      ->getAttribute('mapTestClassNameToCoveredClassName'), false);
  }
  if ($root
    ->hasAttribute('processIsolation')) {
    $result['processIsolation'] = $this
      ->getBoolean((string) $root
      ->getAttribute('processIsolation'), false);
  }
  if ($root
    ->hasAttribute('stopOnError')) {
    $result['stopOnError'] = $this
      ->getBoolean((string) $root
      ->getAttribute('stopOnError'), false);
  }
  if ($root
    ->hasAttribute('stopOnFailure')) {
    $result['stopOnFailure'] = $this
      ->getBoolean((string) $root
      ->getAttribute('stopOnFailure'), false);
  }
  if ($root
    ->hasAttribute('stopOnIncomplete')) {
    $result['stopOnIncomplete'] = $this
      ->getBoolean((string) $root
      ->getAttribute('stopOnIncomplete'), false);
  }
  if ($root
    ->hasAttribute('stopOnRisky')) {
    $result['stopOnRisky'] = $this
      ->getBoolean((string) $root
      ->getAttribute('stopOnRisky'), false);
  }
  if ($root
    ->hasAttribute('stopOnSkipped')) {
    $result['stopOnSkipped'] = $this
      ->getBoolean((string) $root
      ->getAttribute('stopOnSkipped'), false);
  }
  if ($root
    ->hasAttribute('testSuiteLoaderClass')) {
    $result['testSuiteLoaderClass'] = (string) $root
      ->getAttribute('testSuiteLoaderClass');
  }
  if ($root
    ->getAttribute('testSuiteLoaderFile')) {
    $result['testSuiteLoaderFile'] = $this
      ->toAbsolutePath((string) $root
      ->getAttribute('testSuiteLoaderFile'));
  }
  if ($root
    ->hasAttribute('printerClass')) {
    $result['printerClass'] = (string) $root
      ->getAttribute('printerClass');
  }
  if ($root
    ->getAttribute('printerFile')) {
    $result['printerFile'] = $this
      ->toAbsolutePath((string) $root
      ->getAttribute('printerFile'));
  }
  if ($root
    ->hasAttribute('timeoutForSmallTests')) {
    $result['timeoutForSmallTests'] = $this
      ->getInteger((string) $root
      ->getAttribute('timeoutForSmallTests'), 1);
  }
  if ($root
    ->hasAttribute('timeoutForMediumTests')) {
    $result['timeoutForMediumTests'] = $this
      ->getInteger((string) $root
      ->getAttribute('timeoutForMediumTests'), 10);
  }
  if ($root
    ->hasAttribute('timeoutForLargeTests')) {
    $result['timeoutForLargeTests'] = $this
      ->getInteger((string) $root
      ->getAttribute('timeoutForLargeTests'), 60);
  }
  if ($root
    ->hasAttribute('beStrictAboutTestsThatDoNotTestAnything')) {
    $result['reportUselessTests'] = $this
      ->getBoolean((string) $root
      ->getAttribute('beStrictAboutTestsThatDoNotTestAnything'), false);
  }
  if ($root
    ->hasAttribute('checkForUnintentionallyCoveredCode')) {
    $result['strictCoverage'] = $this
      ->getBoolean((string) $root
      ->getAttribute('checkForUnintentionallyCoveredCode'), false);
  }
  if ($root
    ->hasAttribute('beStrictAboutOutputDuringTests')) {
    $result['disallowTestOutput'] = $this
      ->getBoolean((string) $root
      ->getAttribute('beStrictAboutOutputDuringTests'), false);
  }
  if ($root
    ->hasAttribute('beStrictAboutChangesToGlobalState')) {
    $result['disallowChangesToGlobalState'] = $this
      ->getBoolean((string) $root
      ->getAttribute('beStrictAboutChangesToGlobalState'), false);
  }
  if ($root
    ->hasAttribute('beStrictAboutTestSize')) {
    $result['enforceTimeLimit'] = $this
      ->getBoolean((string) $root
      ->getAttribute('beStrictAboutTestSize'), false);
  }
  if ($root
    ->hasAttribute('beStrictAboutTodoAnnotatedTests')) {
    $result['disallowTodoAnnotatedTests'] = $this
      ->getBoolean((string) $root
      ->getAttribute('beStrictAboutTodoAnnotatedTests'), false);
  }
  if ($root
    ->hasAttribute('strict')) {
    $flag = $this
      ->getBoolean((string) $root
      ->getAttribute('strict'), false);
    $result['reportUselessTests'] = $flag;
    $result['strictCoverage'] = $flag;
    $result['disallowTestOutput'] = $flag;
    $result['enforceTimeLimit'] = $flag;
    $result['disallowTodoAnnotatedTests'] = $flag;
    $result['deprecatedStrictModeSetting'] = true;
  }
  if ($root
    ->hasAttribute('verbose')) {
    $result['verbose'] = $this
      ->getBoolean((string) $root
      ->getAttribute('verbose'), false);
  }
  return $result;
}