summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--php-phpunit-PHPUnit.spec9
-rw-r--r--phpunit-colors.patch42
2 files changed, 50 insertions, 1 deletions
diff --git a/php-phpunit-PHPUnit.spec b/php-phpunit-PHPUnit.spec
index 6a884e0..d1f9d60 100644
--- a/php-phpunit-PHPUnit.spec
+++ b/php-phpunit-PHPUnit.spec
@@ -18,7 +18,7 @@
Name: php-phpunit-PHPUnit
Version: 4.3.0
-Release: 1%{?dist}
+Release: 2%{?dist}
Summary: The PHP Unit Testing framework
Group: Development/Libraries
@@ -31,6 +31,8 @@ Source1: Autoload.php.in
# Fix command for autoload
Patch0: %{gh_project}-rpm.patch
+# https://github.com/sebastianbergmann/phpunit/pull/1458
+Patch1: %{gh_project}-colors.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch: noarch
@@ -138,6 +140,7 @@ for the creation, execution and analysis of Unit Tests.
%setup -q -n %{gh_project}-%{gh_commit}
%patch0 -p0 -b .rpm
+%patch1 -p1
%build
@@ -197,6 +200,10 @@ fi
%changelog
+* Mon Oct 6 2014 Remi Collet <remi@fedoraproject.org> - 4.3.0-2
+- only enable colors when output to a terminal (from 4.4)
+- open https://github.com/sebastianbergmann/phpunit/pull/1458
+
* Fri Oct 3 2014 Remi Collet <remi@fedoraproject.org> - 4.3.0-1
- Update to 4.3.0
- drop dependencies on ocramius/instantiator and ocramius/lazy-map
diff --git a/phpunit-colors.patch b/phpunit-colors.patch
new file mode 100644
index 0000000..847d46c
--- /dev/null
+++ b/phpunit-colors.patch
@@ -0,0 +1,42 @@
+From 591efd8fad55a526f021cad9c6cbcd9081df8969 Mon Sep 17 00:00:00 2001
+From: Remi Collet <fedora@famillecollet.com>
+Date: Mon, 6 Oct 2014 10:54:54 +0200
+Subject: [PATCH] only enable colors when output to a terminal (not to a file)
+
+---
+ src/TextUI/Command.php | 7 +++++--
+ src/Util/Configuration.php | 3 +++
+ 2 files changed, 8 insertions(+), 2 deletions(-)
+
+diff --git a/src/TextUI/Command.php b/src/TextUI/Command.php
+index 929ca36..42b08b6 100644
+--- a/src/TextUI/Command.php
++++ b/src/TextUI/Command.php
+@@ -278,8 +278,11 @@ protected function handleArguments(array $argv)
+
+ foreach ($this->options[0] as $option) {
+ switch ($option[0]) {
+- case '--colors': {
+- $this->arguments['colors'] = true;
++ case '--colors':
++ if (function_exists("posix_isatty") && !posix_isatty(STDOUT)) {
++ $this->arguments['colors'] = false;
++ } else {
++ $this->arguments['colors'] = true;
+ }
+ break;
+
+diff --git a/src/Util/Configuration.php b/src/Util/Configuration.php
+index 9ddcfb8..0fcc5fb 100644
+--- a/src/Util/Configuration.php
++++ b/src/Util/Configuration.php
+@@ -582,6 +582,9 @@ public function getPHPUnitConfiguration()
+ $result['colors'] = $this->getBoolean(
+ (string) $root->getAttribute('colors'), false
+ );
++ if ($result['colors'] && function_exists("posix_isatty") && !posix_isatty(STDOUT)) {
++ $result['colors'] = false;
++ }
+ }
+
+ /**