Skip to content

Commit

Permalink
If xdebug code coverage is enabled, write comment when running tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mattab committed Dec 10, 2014
1 parent 80341fa commit fd2024b
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion plugins/TestRunner/Commands/TestsRun.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,11 @@ protected function execute(InputInterface $input, OutputInterface $output)
$command = '../../vendor/phpunit/phpunit/phpunit';

if (!$this->isCoverageEnabled($options) && $this->isXdebugLoaded()) {
$output->writeln('<comment>Did you know? You can run tests faster by disabling xdebug</comment>');
$message = 'Did you know? You can run tests faster by disabling xdebug';
if($this->isXdebugCodeCoverageEnabled()) {
$message .= ' (if you need xdebug, speed up tests by setting xdebug.coverage_enable=0)</comment>';
}
$output->writeln('<comment>' . $message .'</comment>');
}

// force xdebug usage for coverage options
Expand Down Expand Up @@ -255,6 +259,11 @@ private function isXdebugLoaded()
return extension_loaded('xdebug');
}

private function isXdebugCodeCoverageEnabled()
{
return (bool)ini_get('xdebug.coverage_enable');
}

private function fixPathToTestFileOrDirectory($testFile)
{
if ('/' !== substr($testFile, 0, 1)) {
Expand Down

0 comments on commit fd2024b

Please sign in to comment.