Skip to content

Commit

Permalink
Disable caching during test runs + allow -w to override -n from a rul…
Browse files Browse the repository at this point in the history
…eset
  • Loading branch information
gsherwood committed May 18, 2015
1 parent b469e78 commit 24c7a7f
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions src/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -472,9 +472,11 @@ public function restoreDefaults()
$this->colors = (bool) $colors;
}

$cache = self::getConfigData('cache');
if ($cache !== null) {
$this->cache = (bool) $cache;
if (defined('PHP_CODESNIFFER_IN_TESTS') === false) {
$cache = self::getConfigData('cache');
if ($cache !== null) {
$this->cache = (bool) $cache;
}
}

}//end restoreDefaults()
Expand Down Expand Up @@ -534,12 +536,16 @@ public function processShortArgument($arg, $pos)
}
break;
case 'n' :
$this->warningSeverity = 0;
$this->overriddenDefaults['warningSeverity'] = true;
if (isset($this->overriddenDefaults['warningSeverity']) === false) {
$this->warningSeverity = 0;
$this->overriddenDefaults['warningSeverity'] = true;
}
break;
case 'w' :
$this->warningSeverity = $this->errorSeverity;
$this->overriddenDefaults['warningSeverity'] = true;
if (isset($this->overriddenDefaults['warningSeverity']) === false) {
$this->warningSeverity = $this->errorSeverity;
$this->overriddenDefaults['warningSeverity'] = true;
}
break;
default:
if ($this->dieOnUnknownArg === false) {
Expand Down Expand Up @@ -579,8 +585,10 @@ public function processLongArgument($arg, $pos)
$this->overriddenDefaults['colors'] = true;
break;
case 'cache':
$this->cache = true;
$this->overriddenDefaults['cache'] = true;
if (defined('PHP_CODESNIFFER_IN_TESTS') === false) {
$this->cache = true;
$this->overriddenDefaults['cache'] = true;
}
break;
case 'no-cache':
$this->cache = false;
Expand Down

0 comments on commit 24c7a7f

Please sign in to comment.