From ab8bc1f980d8a3208d63e16223c941c4759925e3 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Tue, 7 Feb 2017 12:11:27 +0100 Subject: php-phpunit-PHPUnit: cleanup for upcoming v6 --- php-phpunit-PHPUnit.spec | 34 +++++++++++++++------------------- phpunit-5.4.0-Autoload.php.in | 3 ++- phpunit-rpm.patch | 23 +++++++++++++++-------- 3 files changed, 32 insertions(+), 28 deletions(-) diff --git a/php-phpunit-PHPUnit.spec b/php-phpunit-PHPUnit.spec index f466c49..210a7c8 100644 --- a/php-phpunit-PHPUnit.spec +++ b/php-phpunit-PHPUnit.spec @@ -18,7 +18,7 @@ %global pear_channel pear.phpunit.de %global major 5.7 %global minor 11 -%global specrel 1 +%global specrel 2 Name: php-phpunit-PHPUnit Version: %{major}.%{minor} @@ -47,8 +47,10 @@ BuildRequires: php(language) >= 5.6 BuildRequires: %{_bindir}/phpab BuildRequires: php-composer(phpunit/php-file-iterator) >= 1.4 BuildRequires: php-composer(phpunit/php-text-template) >= 1.2 +BuildRequires: php-composer(phpunit/php-code-coverage) < 5 BuildRequires: php-composer(phpunit/php-code-coverage) >= 4.0.4 BuildRequires: php-composer(phpunit/php-timer) >= 1.0.6 +BuildRequires: php-composer(phpunit/phpunit-mock-objects) < 4 BuildRequires: php-composer(phpunit/phpunit-mock-objects) >= 3.2 BuildRequires: php-composer(phpspec/prophecy) >= 1.6.2 BuildRequires: php-composer(sebastian/comparator) >= 1.2.4 @@ -61,6 +63,7 @@ BuildRequires: php-composer(sebastian/object-enumerator) >= 2.0 BuildRequires: php-composer(sebastian/resource-operations) >= 1.0 BuildRequires: php-composer(sebastian/version) >= 1.0 BuildRequires: php-composer(myclabs/deep-copy) >= 1.3 +BuildRequires: php-composer(symfony/yaml) < 3 BuildRequires: php-composer(symfony/yaml) >= 2.1 BuildRequires: php-composer(phpunit/php-invoker) >= 1.1.0 BuildRequires: php-composer(doctrine/instantiator) >= 1.0.4 @@ -123,7 +126,7 @@ Requires: php-composer(sebastian/version) < 3 Requires: php-composer(myclabs/deep-copy) >= 1.3 Requires: php-composer(myclabs/deep-copy) < 2 Requires: php-composer(symfony/yaml) >= 2.1 -Requires: php-composer(symfony/yaml) < 4 +Requires: php-composer(symfony/yaml) < 3 Requires: php-dom Requires: php-json Requires: php-mbstring @@ -199,24 +202,12 @@ install -D -p -m 755 phpunit %{buildroot}%{_bindir}/phpunit %check OPT="--testsuite=small --no-coverage" -sed -e "/'testNoTestCases'/d" \ - -i tests/Framework/SuiteTest.php - -# remirepo:11 -run=0 ret=0 -if which php56; then - php56 ./phpunit $OPT - run=1 -fi -if which php71; then - php71 ./phpunit $OPT - run=1 -fi -if [ $run -eq 0 ]; then -./phpunit $OPT --verbose -# remirepo:2 -fi +for cmd in php56 php70 php71 php; do + if which $cmd; then + $cmd ./phpunit $OPT --verbose + fi +done exit $ret @@ -242,6 +233,11 @@ fi %changelog +* Tue Feb 7 2017 Remi Collet - 5.7.11-2 +- add max version for some build dependencies +- only allow Symfony 2 +- handle redirect to composer installed PHPUnit v6 + * Sun Feb 5 2017 Remi Collet - 5.7.11-1 - update to 5.7.11 - raise dependency on sebastian/comparator 1.2.4 diff --git a/phpunit-5.4.0-Autoload.php.in b/phpunit-5.4.0-Autoload.php.in index 93a47af..baffe2c 100644 --- a/phpunit-5.4.0-Autoload.php.in +++ b/phpunit-5.4.0-Autoload.php.in @@ -12,8 +12,9 @@ if (!class_exists('Fedora\\Autoloader\\Autoload', false)) { __DIR__ ); +$sym = (getenv('RPM_SYMFONY_TREE') ?: 'Symfony'); /* don't use symfony autoloader which pull some unwanted stuff (polyfill) */ -$vendorDir = stream_resolve_include_path('Symfony/Component/Yaml/Yaml.php'); +$vendorDir = stream_resolve_include_path("$sym/Component/Yaml/Yaml.php"); \Fedora\Autoloader\Autoload::addPsr4('Symfony\\Component\\', dirname(dirname($vendorDir))); /* Required */ diff --git a/phpunit-rpm.patch b/phpunit-rpm.patch index efc2c79..6d8265a 100644 --- a/phpunit-rpm.patch +++ b/phpunit-rpm.patch @@ -1,7 +1,7 @@ diff -up ./phpunit.rpm ./phpunit ---- ./phpunit.rpm 2015-08-10 13:22:08.674131079 +0200 -+++ ./phpunit 2015-08-10 13:23:53.882702518 +0200 -@@ -27,24 +27,21 @@ if (!ini_get('date.timezone')) { +--- ./phpunit.rpm 2017-02-05 16:31:31.000000000 +0100 ++++ ./phpunit 2017-02-07 11:56:09.174850687 +0100 +@@ -27,26 +27,27 @@ if (!ini_get('date.timezone')) { ini_set('date.timezone', 'UTC'); } @@ -32,16 +32,23 @@ diff -up ./phpunit.rpm ./phpunit - die(1); +// Libraries PATH +if (file_exists('./vendor/phpunit/phpunit/phpunit') && file_exists('./vendor/autoload.php')) { -+ echo "\n==== Redirecting to composer installed version in vendor/phpunit ====\n\n"; -+ define ('PHPUNIT_COMPOSER_INSTALL', realpath('./vendor/autoload.php')); ++ echo "\n==== Redirecting to composer installed version in vendor/phpunit ====\n\n"; ++ define ('PHPUNIT_COMPOSER_INSTALL', realpath('./vendor/autoload.php')); +} else { -+ define ('PHPUNIT_COMPOSER_INSTALL', stream_resolve_include_path('PHPUnit/Autoload.php')); ++ define ('PHPUNIT_COMPOSER_INSTALL', stream_resolve_include_path('PHPUnit/Autoload.php')); } require PHPUNIT_COMPOSER_INSTALL; + +-PHPUnit_TextUI_Command::main(); ++if (class_exists('PHPUnit_TextUI_Command')) { ++ PHPUnit_TextUI_Command::main(); // PHPUnit v5 or older ++} else { ++ PHPUnit\TextUI\Command::main(); // PHPUnit v6 or newer ++} diff -up ./tests/bootstrap.php.rpm ./tests/bootstrap.php ---- ./tests/bootstrap.php.rpm 2015-08-10 11:16:56.000000000 +0200 -+++ ./tests/bootstrap.php 2015-08-10 13:22:08.674131079 +0200 +--- ./tests/bootstrap.php.rpm 2017-02-05 16:31:31.000000000 +0100 ++++ ./tests/bootstrap.php 2017-02-07 11:49:35.123108015 +0100 @@ -1,6 +1,9 @@