diff options
-rw-r--r-- | Autoload.php.in | 74 | ||||
-rw-r--r-- | php-phpunit-PHPUnit.spec | 153 | ||||
-rw-r--r-- | phpunit-rpm.patch | 32 |
3 files changed, 187 insertions, 72 deletions
diff --git a/Autoload.php.in b/Autoload.php.in new file mode 100644 index 0000000..83fd1fb --- /dev/null +++ b/Autoload.php.in @@ -0,0 +1,74 @@ +<?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'; + +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 53cf6a2..1248db2 100644 --- a/php-phpunit-PHPUnit.spec +++ b/php-phpunit-PHPUnit.spec @@ -8,61 +8,81 @@ # # Please, preserve the changelog entries # -%{!?__pear: %{expand: %%global __pear %{_bindir}/pear}} +%global gh_commit 95d18c9b84f5f9b200f53363b717910446686768 +%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.35 -Release: 2%{?dist} +Version: 4.0.18 +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 -# Don't display message about deprecated PEAR -Patch0: %{pear_name}-msg.patch +# Autoload template, from verison 3.7 +Source1: Autoload.php.in + +# Fix command for autoload +Patch0: %{gh_project}-rpm.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) 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.0 +BuildRequires: php-phpunit-diff >= 1.1 +BuildRequires: php-phpunit-environment >= 1.0 +BuildRequires: php-phpunit-exporter >= 1.0.1 +BuildRequires: php-phpunit-Version >= 1.0.3 +BuildRequires: php-symfony-yaml >= 2.0.0 + +# From package.xml +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-CodeCoverage < 2.1 +Requires: php-phpunit-PHP-Timer >= 1.0.2 +Requires: php-phpunit-PHPUnit-MockObject >= 2.0 +Requires: php-phpunit-PHPUnit-MockObject < 2.1 +Requires: php-phpunit-diff >= 1.1 +Requires: php-phpunit-environment >= 1.0 +Requires: php-phpunit-exporter >= 1.0.1 +Requires: php-phpunit-Version >= 1.0.3 +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} @@ -76,66 +96,55 @@ for the creation, execution and analysis of Unit Tests. %prep -%setup -qc +%setup -q -n %{gh_project}-%{gh_commit} -cd %{pear_name}-%{version} -%patch0 -p1 -b .msg - -# package.xml is V2 -sed -e '/TestRunner.php/s/md5sum="[^"]*"//' \ - ../package.xml >%{name}.xml +%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 -rm -rf %{buildroot} -cd %{pear_name}-%{version} - -# Install Package -%{__pear} install --nodeps --packagingroot %{buildroot} %{name}.xml - -# 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} +rm -rf %{buildroot} +mkdir -p %{buildroot}%{php_home} +cp -pr src %{buildroot}%{php_home}/PHPUnit +install -D -p -m 755 phpunit %{buildroot}%{_bindir}/phpunit -%clean -rm -rf %{buildroot} +%check +sed -e 's:vendor/autoload:src/Autoload:' \ + -i tests/bootstrap.php -%post -%{__pear} install --nodeps --soft --force --register-only \ - %{pear_xmldir}/%{name}.xml >/dev/null || : +sed -e '/logging/d' \ + -e '/<log/d' \ + phpunit.xml.dist > phpunit.xml -%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 || : +%clean +rm -rf %{buildroot} %files %defattr(-,root,root,-) -%doc %{pear_docdir}/%{pear_name} -%{pear_xmldir}/%{name}.xml -%{pear_phpdir}/%{pear_name} %{_bindir}/phpunit +%{php_home}/PHPUnit %changelog +* Tue Apr 29 2014 Remi Collet <remi@fedoraproject.org> - 4.0.14-1 +- update to 4.0.18 +- sources from github + * Tue Apr 22 2014 Remi Collet <remi@fedoraproject.org> - 3.7.35-2 - remove message about deprecated PEAR channel 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(); |