[php-phpunit-PHPUnit/epel7] - Update to 4.1.0 - sources from github - run tests during build - add dependencies on php-phpunit-c

Remi Collet remi at fedoraproject.org
Tue May 6 08:08:35 UTC 2014


commit 76ae1a23cdd49a1b0f72114f8ad414b6e656d378
Author: Remi Collet <remi at fedoraproject.org>
Date:   Tue May 6 09:57:57 2014 +0200

    - Update to 4.1.0
    - sources from github
    - run tests during build
    - add dependencies on php-phpunit-comparator, php-phpunit-diff, php-phpunit-environment, php-phpunit-exporter, php-phpunit-Version
    
    (cherry picked from commit 4787aa2c402632c851219823f6d1526fe3d676d6)

 .gitignore               |    4 +-
 Autoload.php.in          |   75 +++++++++++++++++++++++
 php-phpunit-PHPUnit.spec |  151 +++++++++++++++++++++++++++-------------------
 phpunit-rpm.patch        |   32 ++++++++++
 sources                  |    2 +-
 5 files changed, 200 insertions(+), 64 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index e214faa..801a9a4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,4 @@
-*spec~
-package*.xml
+clog
 /PHPUnit-3.6.0.tgz
 /PHPUnit-3.6.2.tgz
 /PHPUnit-3.6.3.tgz
@@ -33,3 +32,4 @@ package*.xml
 /PHPUnit-3.7.30.tgz
 /PHPUnit-3.7.31.tgz
 /PHPUnit-3.7.34.tgz
+/phpunit-4.1.0.tar.gz
diff --git a/Autoload.php.in b/Autoload.php.in
new file mode 100644
index 0000000..5077fd4
--- /dev/null
+++ b/Autoload.php.in
@@ -0,0 +1,75 @@
+<?php
+/* Inspipred from Autoload from version 3.7 */
+
+/* Required */
+require_once 'File/Iterator/Autoload.php';
+require_once 'PHP/CodeCoverage/Autoload.php';
+require_once 'PHP/Timer/Autoload.php';
+require_once 'PHPUnit/Framework/MockObject/Autoload.php';
+require_once 'Text/Template/Autoload.php';
+require_once 'PHP/Invoker/Autoload.php';
+require_once 'SebastianBergmann/Diff/autoload.php';
+require_once 'SebastianBergmann/Environment/autoload.php';
+require_once 'SebastianBergmann/Exporter/autoload.php';
+require_once 'SebastianBergmann/Version/autoload.php';
+require_once 'SebastianBergmann/Comparator/autoload.php';
+
+spl_autoload_register(
+  function ($class)
+  {
+      static $classes = NULL;
+      static $path    = NULL;
+
+      if ($classes === NULL) {
+          $classes = array(
+            ___CLASSLIST___
+          );
+
+          $path = dirname(__FILE__);
+      }
+
+      $cn = strtolower($class);
+
+      if (isset($classes[$cn])) {
+          require $path . $classes[$cn];
+      }
+  }
+);
+
+// Symfony Yaml autoloader
+spl_autoload_register(
+  function ($class) {
+      if (0 === strpos(ltrim($class, '/'), 'Symfony\Component\Yaml')) {
+          $file = sprintf(
+            'Symfony/Component/Yaml%s.php',
+
+            substr(
+              str_replace('\\', '/', $class),
+              strlen('Symfony\Component\Yaml')
+            )
+          );
+
+          if (stream_resolve_include_path($file)) {
+              require_once $file;
+          }
+      }
+  }
+);
+
+/* Optional */
+
+if (stream_resolve_include_path('PHPUnit/Extensions/Database/Autoload.php')) {
+    require_once 'PHPUnit/Extensions/Database/Autoload.php';
+}
+
+if (stream_resolve_include_path('PHPUnit/Extensions/SeleniumCommon/Autoload.php')) {
+    require_once 'PHPUnit/Extensions/SeleniumCommon/Autoload.php';
+}
+
+else if (stream_resolve_include_path('PHPUnit/Extensions/SeleniumTestCase/Autoload.php')) {
+    require_once 'PHPUnit/Extensions/SeleniumTestCase/Autoload.php';
+}
+
+if (stream_resolve_include_path('PHPUnit/Extensions/Story/Autoload.php')) {
+    require_once 'PHPUnit/Extensions/Story/Autoload.php';
+}
diff --git a/php-phpunit-PHPUnit.spec b/php-phpunit-PHPUnit.spec
index 3718203..7602596 100644
--- a/php-phpunit-PHPUnit.spec
+++ b/php-phpunit-PHPUnit.spec
@@ -8,58 +8,81 @@
 #
 # Please, preserve the changelog entries
 #
-%{!?pear_metadir: %global pear_metadir %{pear_phpdir}}
-%{!?__pear: %{expand: %%global __pear %{_bindir}/pear}}
+%global gh_commit    efb1b1334605594417a3bd466477772d06d460a8
+%global gh_short     %(c=%{gh_commit}; echo ${c:0:7})
+%global gh_owner     sebastianbergmann
+%global gh_project   phpunit
+%global php_home     %{_datadir}/php
 %global pear_name    PHPUnit
 %global pear_channel pear.phpunit.de
 
 Name:           php-phpunit-PHPUnit
-Version:        3.7.34
+Version:        4.1.0
 Release:        1%{?dist}
 Summary:        The PHP Unit Testing framework
 
 Group:          Development/Libraries
 License:        BSD
-URL:            http://www.phpunit.de
-Source0:        http://pear.phpunit.de/get/%{pear_name}-%{version}.tgz
+URL:            https://github.com/%{gh_owner}/%{gh_project}
+Source0:        https://github.com/%{gh_owner}/%{gh_project}/archive/%{gh_commit}/%{gh_project}-%{version}.tar.gz
+
+# Autoload template, from verison 3.7
+Source1:        Autoload.php.in
+
+# Fix command for autoload
+Patch0:         %{gh_project}-rpm.patch
 
 BuildArch:      noarch
 BuildRequires:  php(language) >= 5.3.3
-BuildRequires:  php-pear(PEAR) >= 1.9.4
-BuildRequires:  php-channel(%{pear_channel})
-
+BuildRequires:  %{_bindir}/phpab
+BuildRequires:  php-phpunit-File-Iterator >= 1.3.1
+BuildRequires:  php-phpunit-Text-Template >= 1.2
+BuildRequires:  php-phpunit-PHP-CodeCoverage >= 2.0
+BuildRequires:  php-phpunit-PHP-Timer >= 1.0.2
+BuildRequires:  php-phpunit-PHPUnit-MockObject >= 2.1
+BuildRequires:  php-phpunit-comparator >= 1.0
+BuildRequires:  php-phpunit-diff >= 1.1
+BuildRequires:  php-phpunit-environment >= 1.0
+BuildRequires:  php-phpunit-exporter >= 1.0
+BuildRequires:  php-phpunit-Version >= 1.0
+BuildRequires:  php-symfony-yaml >= 2.0.0
+BuildRequires:  php-phpunit-PHP-Invoker >= 1.1.0
+
+# From composer.json
+Requires:       php-phpunit-File-Iterator >= 1.3.1
+Requires:       php-phpunit-Text-Template >= 1.2
+Requires:       php-phpunit-PHP-CodeCoverage >= 2.0
+Requires:       php-phpunit-PHP-Timer >= 1.0.2
+Requires:       php-phpunit-PHPUnit-MockObject >= 2.1
+Requires:       php-phpunit-comparator >= 1.0
+Requires:       php-phpunit-diff >= 1.1
+Requires:       php-phpunit-environment >= 1.0
+Requires:       php-phpunit-exporter >= 1.0
+Requires:       php-phpunit-Version >= 1.0
+Requires:       php-symfony-yaml >= 2.0.0
+Requires:       php-symfony-yaml <  3
 Requires:       php(language) >= 5.3.3
-Requires:       php-ctype
 Requires:       php-dom
-Requires:       php-libxml
-Requires:       php-pcntl
+Requires:       php-json
 Requires:       php-pcre
 Requires:       php-reflection
 Requires:       php-spl
-Requires:       php-tidy
-Requires:       php-channel(%{pear_channel})
-Requires(post): %{__pear}
-Requires(postun): %{__pear}
-Requires:       php-pear(%{pear_channel}/File_Iterator) >= 1.3.0
-Requires:       php-pear(%{pear_channel}/Text_Template) >= 1.1.1
-Requires:       php-pear(%{pear_channel}/PHP_CodeCoverage) >= 1.2.1
-Requires:       php-pear(%{pear_channel}/PHP_CodeCoverage) <  1.3
-Requires:       php-pear(%{pear_channel}/PHP_Timer) >= 1.0.4
-Requires:       php-pear(pear.symfony.com/Yaml) >= 2.0.0
-Requires:       php-pear(pear.symfony.com/Yaml) <  3
-# PHPUnit Extensions (yes, with circular dependency on PHPUnit)
-Requires:       php-pear(%{pear_channel}/PHPUnit_MockObject) >= 1.2.0
-Requires:       php-pear(%{pear_channel}/PHPUnit_MockObject) <  1.3
-
-# Optionnal dependencies
-Requires:       php-json
-Requires:       php-pdo
+# Optional
+Requires:       php-phpunit-PHP-Invoker >= 1.1.0
+# From phpcompatinfo report for version 4.0.18
+Requires:       php-date
+Requires:       php-libxml
 Requires:       php-mbstring
-Requires:       php-pecl(Xdebug) >= 2.0.5
-Requires:       php-pear(%{pear_channel}/PHP_Invoker) >= 1.1.0
-Requires:       php-pear(%{pear_channel}/PHP_Invoker) <  1.2
+Requires:       php-openssl
+Requires:       php-pcntl
+Requires:       php-phar
+Requires:       php-tidy
+Requires:       php-xml
+
 
+# For compatibility with PEAR mode
 Provides:       php-pear(%{pear_channel}/%{pear_name}) = %{version}
+# Package have been rename
 Obsoletes:      php-pear-PHPUnit < %{version}
 Provides:       php-pear-PHPUnit = %{version}-%{release}
 
@@ -73,56 +96,62 @@ 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
+%setup -q -n %{gh_project}-%{gh_commit}
+
+%patch0 -p0 -b .rpm
 
 
 %build
-cd %{pear_name}-%{version}
-# Empty build section, most likely nothing required.
+phpab \
+  --output   src/Autoload.php \
+  --template %{SOURCE1} \
+  src
 
 
 %install
-cd %{pear_name}-%{version}
+mkdir -p   %{buildroot}%{php_home}
+cp -pr src %{buildroot}%{php_home}/PHPUnit
 
-# Install Package
-%{__pear} install --nodeps --packagingroot %{buildroot} %{name}.xml
+install -D -p -m 755 phpunit %{buildroot}%{_bindir}/phpunit
 
-# Clean up unnecessary files
-rm -rf %{buildroot}%{pear_metadir}/.??*
 
-# Install XML package description
-install -d %{buildroot}%{pear_xmldir}
-install -pm 644 %{name}.xml %{buildroot}%{pear_xmldir}
+%check
+sed -e 's:vendor/autoload:src/Autoload:' \
+    -i tests/bootstrap.php
 
+sed -e '/logging/d' \
+    -e '/<log/d' \
+    phpunit.xml.dist > phpunit.xml
 
-%post
-%{__pear} install --nodeps --soft --force --register-only \
-    %{pear_xmldir}/%{name}.xml >/dev/null || :
+sed -e 's:PHPUnit/Autoload:src/Autoload:' \
+    -i phpunit
 
-%postun
-if [ $1 -eq 0 ] ; then
-    %{__pear} uninstall --nodeps --ignore-errors --register-only \
-        %{pear_channel}/%{pear_name} >/dev/null || :
-fi
+./phpunit  \
+  --include-path=%{buildroot}%{php_home} \
+  --testsuite=small \
+  -d date.timezone=UTC
 
-%triggerpostun -- php-pear-PHPUnit
-# re-register extension unregistered during postun of obsoleted php-pear-PHPUnit
-%{__pear} install --nodeps --soft --force --register-only \
-    %{pear_xmldir}/%{name}.xml >/dev/null || :
 
+%post
+if [ -x %{_bindir}/pear ]; then
+   %{_bindir}/pear uninstall --nodeps --ignore-errors --register-only \
+      %{pear_channel}/%{pear_name} >/dev/null || :
+fi
 
 
 %files
-%doc %{pear_docdir}/%{pear_name}
-%{pear_xmldir}/%{name}.xml
-%{pear_phpdir}/%{pear_name}
 %{_bindir}/phpunit
+%{php_home}/PHPUnit
 
 
 %changelog
+* Sat May  3 2014 Remi Collet <remi at fedoraproject.org> - 4.1.0-1
+- Update to 4.1.0
+- sources from github
+- run tests during build
+- add dependencies on php-phpunit-comparator, php-phpunit-diff,
+  php-phpunit-environment, php-phpunit-exporter, php-phpunit-Version
+
 * Sun Apr 06 2014 Remi Collet <remi at fedoraproject.org> - 3.7.34-1
 - Update to 3.7.34
 
diff --git a/phpunit-rpm.patch b/phpunit-rpm.patch
new file mode 100644
index 0000000..0a1253b
--- /dev/null
+++ b/phpunit-rpm.patch
@@ -0,0 +1,32 @@
+diff -up ./phpunit.rpm ./phpunit
+--- ./phpunit.rpm	2014-04-29 16:21:26.000000000 +0200
++++ ./phpunit	2014-04-29 16:22:50.000000000 +0200
+@@ -1,4 +1,4 @@
+-#!/usr/bin/env php
++#!/usr/bin/php
+ <?php
+ /* PHPUnit
+  *
+@@ -35,21 +35,6 @@
+  * POSSIBILITY OF SUCH DAMAGE.
+  */
+ 
+-foreach (array(__DIR__ . '/../../autoload.php', __DIR__ . '/vendor/autoload.php') as $file) {
+-    if (file_exists($file)) {
+-        define('PHPUNIT_COMPOSER_INSTALL', $file);
+-        break;
+-    }
+-}
+-
+-if (!defined('PHPUNIT_COMPOSER_INSTALL')) {
+-    die(
+-        'You need to set up the project dependencies using the following commands:' . PHP_EOL .
+-        'wget http://getcomposer.org/composer.phar' . PHP_EOL .
+-        'php composer.phar install' . PHP_EOL
+-    );
+-}
+-
+-require PHPUNIT_COMPOSER_INSTALL;
++require 'PHPUnit/Autoload.php';
+ 
+ PHPUnit_TextUI_Command::main();
diff --git a/sources b/sources
index 7a7cbef..198b69d 100644
--- a/sources
+++ b/sources
@@ -1 +1 @@
-7cd54f9ebcbed32692620f0f431838f7  PHPUnit-3.7.34.tgz
+29dcc2ac0ba8b536bbcfb359cdb8b672  phpunit-4.1.0.tar.gz


More information about the scm-commits mailing list