[php-phpunit-PHPUnit/f20] - disable colors when output is not a tty - define date.timezone to avoid warning

Remi Collet remi at fedoraproject.org
Wed Nov 12 14:54:46 UTC 2014


commit 3d73704fb929990cff26d657ecfefcc2bcaf2604
Author: Remi Collet <remi at fedoraproject.org>
Date:   Wed Nov 12 15:54:34 2014 +0100

    - disable colors when output is not a tty
    - define date.timezone to avoid warning

 PHPUnit-rpm.patch        |   36 ++++++++++++++++++++++++++++++++++++
 php-phpunit-PHPUnit.spec |   21 ++++++++++++++++++---
 2 files changed, 54 insertions(+), 3 deletions(-)
---
diff --git a/PHPUnit-rpm.patch b/PHPUnit-rpm.patch
new file mode 100644
index 0000000..f643705
--- /dev/null
+++ b/PHPUnit-rpm.patch
@@ -0,0 +1,36 @@
+diff -up PHPUnit-3.7.34/phpunit.php.rpm PHPUnit-3.7.34/phpunit.php
+--- PHPUnit-3.7.34/phpunit.php.rpm	2014-11-12 15:23:22.178115346 +0100
++++ PHPUnit-3.7.34/phpunit.php	2014-11-12 15:23:32.738157913 +0100
+@@ -35,6 +35,10 @@
+  * POSSIBILITY OF SUCH DAMAGE.
+  */
+ 
++if (!ini_get('date.timezone')) {
++     ini_set('date.timezone', 'UTC');
++}
++
+ define('PHPUnit_MAIN_METHOD', 'PHPUnit_TextUI_Command::main');
+ 
+ if (strpos('@php_bin@', '@php_bin') === 0) {
+diff -up PHPUnit-3.7.34/PHPUnit/TextUI/Command.php.rpm PHPUnit-3.7.34/PHPUnit/TextUI/Command.php
+--- PHPUnit-3.7.34/PHPUnit/TextUI/Command.php.rpm	2014-11-12 15:22:15.920848253 +0100
++++ PHPUnit-3.7.34/PHPUnit/TextUI/Command.php	2014-11-12 15:26:21.548838470 +0100
+@@ -250,6 +250,7 @@ class PHPUnit_TextUI_Command
+         foreach ($this->options[0] as $option) {
+             switch ($option[0]) {
+                 case '--colors': {
++                  if (function_exists('posix_isatty') && @posix_isatty(STDOUT))
+                     $this->arguments['colors'] = TRUE;
+                 }
+                 break;
+diff -up PHPUnit-3.7.34/PHPUnit/Util/Configuration.php.rpm PHPUnit-3.7.34/PHPUnit/Util/Configuration.php
+--- PHPUnit-3.7.34/PHPUnit/Util/Configuration.php.rpm	2014-11-12 15:22:29.008901029 +0100
++++ PHPUnit-3.7.34/PHPUnit/Util/Configuration.php	2014-11-12 15:26:28.433866230 +0100
+@@ -582,6 +582,7 @@ class PHPUnit_Util_Configuration
+         }
+ 
+         if ($root->hasAttribute('colors')) {
++          if (function_exists('posix_isatty') && @posix_isatty(STDOUT))
+             $result['colors'] = $this->getBoolean(
+               (string)$root->getAttribute('colors'), FALSE
+             );
diff --git a/php-phpunit-PHPUnit.spec b/php-phpunit-PHPUnit.spec
index 261b3f2..6bd8c98 100644
--- a/php-phpunit-PHPUnit.spec
+++ b/php-phpunit-PHPUnit.spec
@@ -15,7 +15,7 @@
 
 Name:           php-phpunit-PHPUnit
 Version:        3.7.34
-Release:        1%{?dist}
+Release:        2%{?dist}
 Summary:        The PHP Unit Testing framework
 
 Group:          Development/Libraries
@@ -23,6 +23,11 @@ License:        BSD
 URL:            http://www.phpunit.de
 Source0:        http://pear.phpunit.de/get/%{pear_name}-%{version}.tgz
 
+# Backported from PHPUnit 4.4
+# disable colors when output is not a tty
+# define date.timezone to avoid warning
+Patch0:         %{pear_name}-rpm.patch
+
 BuildArch:      noarch
 BuildRequires:  php(language) >= 5.3.3
 BuildRequires:  php-pear(PEAR) >= 1.9.4
@@ -75,8 +80,14 @@ for the creation, execution and analysis of Unit Tests.
 %prep
 %setup -qc
 cd %{pear_name}-%{version}
-# package.xml is V2
-mv ../package.xml %{name}.xml
+
+%patch0 -p1 -b .rpm
+# Drop checksum for patched files
+sed -e '/phpunit.php/s/md5sum="[^"]*"//' \
+    -e '/Command.php/s/md5sum="[^"]*"//' \
+    -e '/Configuration.php/s/md5sum="[^"]*"//' \
+    ../package.xml >%{name}.xml
+touch -r ../package.xml %{name}.xml
 
 
 %build
@@ -123,6 +134,10 @@ fi
 
 
 %changelog
+* Wed Nov 12 2014 Remi Collet <remi at fedoraproject.org> - 3.7.34-2
+- disable colors when output is not a tty
+- define date.timezone to avoid warning
+
 * Sun Apr 06 2014 Remi Collet <remi at fedoraproject.org> - 3.7.34-1
 - Update to 3.7.34
 


More information about the scm-commits mailing list