diff --git a/src/Framework/Environment.php b/src/Framework/Environment.php index e9d9f8d4..d0c7a92c 100644 --- a/src/Framework/Environment.php +++ b/src/Framework/Environment.php @@ -27,9 +27,6 @@ class Environment /** Thread number when run tests in multi threads */ public const THREAD = 'NETTE_TESTER_THREAD'; - /** @var bool used for debugging Tester itself */ - public static $debugMode = true; - /** @var bool */ public static $checkAssertions = false; @@ -125,7 +122,7 @@ public static function handleException(\Throwable $e): void { self::removeOutputBuffers(); self::$checkAssertions = false; - echo self::$debugMode ? Dumper::dumpException($e) : "\nError: {$e->getMessage()}\n"; + echo Dumper::dumpException($e); exit($e instanceof AssertException ? Runner\Job::CODE_FAIL : Runner\Job::CODE_ERROR); } diff --git a/src/Runner/CliTester.php b/src/Runner/CliTester.php index 99985c49..3cee49e4 100644 --- a/src/Runner/CliTester.php +++ b/src/Runner/CliTester.php @@ -25,6 +25,9 @@ class CliTester /** @var PhpInterpreter */ private $interpreter; + /** @var bool */ + private $debugMode = true; + public function run(): ?int { @@ -34,7 +37,7 @@ public function run(): ?int ob_start(); $cmd = $this->loadOptions(); - Environment::$debugMode = (bool) $this->options['--debug']; + $this->debugMode = (bool) $this->options['--debug']; if (isset($this->options['--colors'])) { Environment::$useColors = (bool) $this->options['--colors']; } elseif (in_array($this->options['-o'], ['tap', 'junit'], true)) { @@ -300,7 +303,7 @@ private function setupErrors(): void private function displayException(\Throwable $e): void { echo "\n"; - echo Environment::$debugMode + echo $this->debugMode ? Dumper::dumpException($e) : Dumper::color('white/red', 'Error: ' . $e->getMessage()); echo "\n";