summaryrefslogtreecommitdiffstats
path: root/phpunit-colors.patch
blob: 9c0a8f93587c78b453575b8c5dd7338988bbf70e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
From 3d56c46afb9ed10b0d248fb0ea698aa22d939421 Mon Sep 17 00:00:00 2001
From: Sebastian Bergmann <sb@sebastian-bergmann.de>
Date: Tue, 7 Oct 2014 11:29:29 +0200
Subject: [PATCH] Rework 591efd8fad55a526f021cad9c6cbcd9081df8969

---
 composer.json                | 2 +-
 src/TextUI/ResultPrinter.php | 6 +++++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/composer.json b/composer.json
index 9dc9950..ae6ff27 100644
--- a/composer.json
+++ b/composer.json
@@ -30,7 +30,7 @@
         "symfony/yaml": "~2.0",
         "sebastian/comparator": "~1.0",
         "sebastian/diff": "~1.1",
-        "sebastian/environment": "~1.0",
+        "sebastian/environment": "~1.1",
         "sebastian/exporter": "~1.0",
         "sebastian/version": "~1.0",
         "ext-dom": "*",
diff --git a/src/TextUI/ResultPrinter.php b/src/TextUI/ResultPrinter.php
index ca16c8a..e701e33 100644
--- a/src/TextUI/ResultPrinter.php
+++ b/src/TextUI/ResultPrinter.php
@@ -43,6 +43,8 @@
  * @since      File available since Release 2.0.0
  */
 
+use SebastianBergmann\Environment\Console;
+
 /**
  * Prints the result of a TextUI TestRunner run.
  *
@@ -147,7 +149,9 @@ public function __construct($out = null, $verbose = false, $colors = false, $deb
         }
 
         if (is_bool($colors)) {
-            $this->colors = $colors;
+            $console = new Console;
+
+            $this->colors = $colors && $console->hasColorSupport();
         } else {
             throw PHPUnit_Util_InvalidArgumentHelper::factory(3, 'boolean');
         }