From 1269c2d67c358273b1d3fe0a1cff9e02d1a5e633 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Mon, 24 Aug 2020 09:26:10 +0200 Subject: allow phpunit8 and phpunit9 --- php-mnapoli-phpunit-easymock.spec | 34 +++++++++++++++++++++++++++------- 1 file changed, 27 insertions(+), 7 deletions(-) diff --git a/php-mnapoli-phpunit-easymock.spec b/php-mnapoli-phpunit-easymock.spec index 21ed952..0ac4afa 100644 --- a/php-mnapoli-phpunit-easymock.spec +++ b/php-mnapoli-phpunit-easymock.spec @@ -22,15 +22,23 @@ %global php_min_ver 7.3 # "phpunit/phpunit": "^8.5|^9.0" %global phpunit8_min_ver 8.5 +%global phpunit9_min_ver 9.0 # Build using "--without tests" to disable tests %global with_tests 0%{!?_without_tests:1} +# Rich dependencies supported? +%if 0%{?fedora} >= 27 || 0%{?rhel} >= 8 +%global with_rich_dependencies 1 +%else +%global with_rich_dependencies 0 +%endif + %{!?phpdir: %global phpdir %{_datadir}/php} Name: php-%{composer_vendor}-%{composer_project} Version: %{github_version} -Release: 1%{?github_release}%{?dist} +Release: 2%{?github_release}%{?dist} Summary: Helpers to build PHPUnit mocks License: MIT @@ -46,7 +54,9 @@ BuildArch: noarch %if %{with_tests} ## composer.json BuildRequires: php(language) >= %{php_min_ver} +# test suite run with all allowed versions BuildRequires: phpunit8 >= %{phpunit8_min_ver} +BuildRequires: phpunit9 >= %{phpunit9_min_ver} ## phpcompatinfo (computed from version 1.3.0) BuildRequires: php-reflection ## Autoloader @@ -55,7 +65,11 @@ BuildRequires: php-composer(fedora/autoloader) # composer.json Requires: php(language) >= %{php_min_ver} -Requires: phpunit8 >= %{phpunit8_min_ver} +# +%if %{with_rich_dependencies} +# Single version required at runtime +Requires: (phpunit8 >= %{phpunit8_min_ver} or phpunit9 >= %{phpunit9_min_ver}) +%endif # phpcompatinfo (computed from version 1.3.0) # # Autoloader @@ -86,10 +100,6 @@ cat <<'AUTOLOAD' | tee src/autoload.php require_once '%{phpdir}/Fedora/Autoloader/autoload.php'; \Fedora\Autoloader\Autoload::addPsr4('EasyMock\\', __DIR__); - -\Fedora\Autoloader\Dependencies::required([ - '%{phpdir}/PHPUnit8/autoload.php', -]); AUTOLOAD @@ -110,7 +120,14 @@ BOOTSTRAP : Upstream tests RETURN_CODE=0 PHPUNIT=$(which phpunit8) -for PHP_EXEC in "" php74; do +for PHP_EXEC in "" php73 php74; do + if [ -z "$PHP_EXEC" ] || which $PHP_EXEC; then + $PHP_EXEC $PHPUNIT --verbose --bootstrap bootstrap.php \ + || RETURN_CODE=1 + fi +done +PHPUNIT=$(which phpunit9) +for PHP_EXEC in "" php73 php74 php80; do if [ -z "$PHP_EXEC" ] || which $PHP_EXEC; then $PHP_EXEC $PHPUNIT --verbose --bootstrap bootstrap.php \ || RETURN_CODE=1 @@ -131,6 +148,9 @@ exit $RETURN_CODE %changelog +* Mon Aug 24 2020 Remi Collet -1.3.0-2 +- allow phpunit8 and phpunit9 + * Fri Aug 21 2020 Shawn Iwinski - 1.3.0-1 - Update to 1.3.0 (RHBZ #1784948) -- cgit