From 13e23de76a38517fda280a678297d1b491d86c05 Mon Sep 17 00:00:00 2001 From: Thomas Steur <thomas.steur@googlemail.com> Date: Fri, 17 Oct 2014 01:08:44 +0200 Subject: [PATCH] refs #6413 show a message if xdebug is loaded but not needed --- plugins/CoreConsole/Commands/TestsRun.php | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/plugins/CoreConsole/Commands/TestsRun.php b/plugins/CoreConsole/Commands/TestsRun.php index 2ca498c6eb..a0304b0682 100644 --- a/plugins/CoreConsole/Commands/TestsRun.php +++ b/plugins/CoreConsole/Commands/TestsRun.php @@ -45,8 +45,12 @@ class TestsRun extends ConsoleCommand $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>'); + } + // force xdebug usage for coverage options - if (false !== strpos($options, '--coverage') && !extension_loaded('xdebug')) { + if ($this->isCoverageEnabled($options) && !$this->isXdebugLoaded()) { $output->writeln('<info>xdebug extension required for code coverage.</info>'); @@ -189,4 +193,14 @@ class TestsRun extends ConsoleCommand return ucfirst($suite) . 'Tests'; } + private function isCoverageEnabled($options) + { + return false !== strpos($options, '--coverage'); + } + + private function isXdebugLoaded() + { + return extension_loaded('xdebug'); + } + } \ No newline at end of file -- GitLab