Skip to content

Commit

Permalink
Removed all codeCoverageIgnore annotations from the code
Browse files Browse the repository at this point in the history
These annotations are artificially bumping the code coverage. Unreached
code should be reported in the coverage report, even if we cannot reach
100% coverage for some safeguards.
Thus, some places using them were actually testable (and tested) code.
  • Loading branch information
stof committed Jan 2, 2014
1 parent 2c059ee commit 4248169
Show file tree
Hide file tree
Showing 6 changed files with 1 addition and 19 deletions.
4 changes: 0 additions & 4 deletions src/Symfony/Component/BrowserKit/Client.php
Expand Up @@ -97,9 +97,7 @@ public function setMaxRedirects($maxRedirects)
public function insulate($insulated = true)
{
if ($insulated && !class_exists('Symfony\\Component\\Process\\Process')) {
// @codeCoverageIgnoreStart
throw new \RuntimeException('Unable to isolate requests as the Symfony Process Component is not installed.');
// @codeCoverageIgnoreEnd
}

$this->insulated = (Boolean) $insulated;
Expand Down Expand Up @@ -378,9 +376,7 @@ abstract protected function doRequest($request);
*/
protected function getScript($request)
{
// @codeCoverageIgnoreStart
throw new \LogicException('To insulate requests, you need to override the getScript() method.');
// @codeCoverageIgnoreEnd
}

/**
Expand Down
3 changes: 1 addition & 2 deletions src/Symfony/Component/Console/Application.php
Expand Up @@ -145,9 +145,8 @@ public function run(InputInterface $input = null, OutputInterface $output = null
if ($exitCode > 255) {
$exitCode = 255;
}
// @codeCoverageIgnoreStart

exit($exitCode);
// @codeCoverageIgnoreEnd
}

return $exitCode;
Expand Down
2 changes: 0 additions & 2 deletions src/Symfony/Component/Console/Input/StringInput.php
Expand Up @@ -72,9 +72,7 @@ private function tokenize($input)
$tokens[] = stripcslashes($match[1]);
} else {
// should never happen
// @codeCoverageIgnoreStart
throw new \InvalidArgumentException(sprintf('Unable to parse input near "... %s ..."', substr($input, $cursor, 10)));
// @codeCoverageIgnoreEnd
}

$cursor += strlen($match[0]);
Expand Down
4 changes: 0 additions & 4 deletions src/Symfony/Component/Console/Output/StreamOutput.php
Expand Up @@ -75,10 +75,8 @@ public function getStream()
protected function doWrite($message, $newline)
{
if (false === @fwrite($this->stream, $message.($newline ? PHP_EOL : ''))) {
// @codeCoverageIgnoreStart
// should never happen
throw new \RuntimeException('Unable to write output.');
// @codeCoverageIgnoreEnd
}

fflush($this->stream);
Expand All @@ -96,12 +94,10 @@ protected function doWrite($message, $newline)
*/
protected function hasColorSupport()
{
// @codeCoverageIgnoreStart
if (DIRECTORY_SEPARATOR == '\\') {
return false !== getenv('ANSICON') || 'ON' === getenv('ConEmuANSI');
}

return function_exists('posix_isatty') && @posix_isatty($this->stream);
// @codeCoverageIgnoreEnd
}
}
4 changes: 0 additions & 4 deletions src/Symfony/Component/DomCrawler/Crawler.php
Expand Up @@ -627,9 +627,7 @@ public function filterXPath($xpath)
public function filter($selector)
{
if (!class_exists('Symfony\\Component\\CssSelector\\CssSelector')) {
// @codeCoverageIgnoreStart
throw new \RuntimeException('Unable to filter with a CSS selector as the Symfony CssSelector is not installed (you can use filterXPath instead).');
// @codeCoverageIgnoreEnd
}

return $this->filterXPath(CssSelector::toXPath($selector));
Expand Down Expand Up @@ -813,11 +811,9 @@ public function getNode($position)
if ($i == $position) {
return $node;
}
// @codeCoverageIgnoreStart
}

return null;
// @codeCoverageIgnoreEnd
}

/**
Expand Down
3 changes: 0 additions & 3 deletions src/Symfony/Component/Translation/PluralizationRules.php
Expand Up @@ -18,7 +18,6 @@
*/
class PluralizationRules
{
// @codeCoverageIgnoreStart
private static $rules = array();

/**
Expand Down Expand Up @@ -212,6 +211,4 @@ public static function set($rule, $locale)

self::$rules[$locale] = $rule;
}

// @codeCoverageIgnoreEnd
}

0 comments on commit 4248169

Please sign in to comment.