Skip to content

Commit

Permalink
minor #9931 Removed all codeCoverageIgnore annotations from the code …
Browse files Browse the repository at this point in the history
…(stof)

This PR was merged into the 2.5-dev branch.

Discussion
----------

Removed all codeCoverageIgnore annotations from the code

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | n/a
| License       | MIT
| Doc PR        | n/a

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 IMO.
Thus, some places using them were actually testable (and tested) code.

Commits
-------

4248169 Removed all codeCoverageIgnore annotations from the code
  • Loading branch information
fabpot committed Jan 3, 2014
2 parents 2c059ee + 4248169 commit 60c2140
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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 60c2140

Please sign in to comment.