From 73d4cd792c9b118db40a1dd4c55c0027fd894091 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Thu, 17 Dec 2020 08:35:24 +0100 Subject: update to 2.0.30 switch to phpunit9 on Fedora --- .gitignore | 2 ++ composer.json | 2 +- php-phpseclib.spec | 36 ++++++++++++++++++++++++++++++++---- 3 files changed, 35 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 1ab5c4f..01f0400 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,7 @@ +clog package-*.xml *.tgz +*.tar.bz2 *.tar.gz *.tar.xz *.tar.xz.asc diff --git a/composer.json b/composer.json index 9303f8a..08b9c7c 100644 --- a/composer.json +++ b/composer.json @@ -55,7 +55,7 @@ }, "require-dev": { "phing/phing": "~2.7", - "phpunit/phpunit": "^4.8.35|^5.7|^6.0", + "phpunit/phpunit": "^4.8.35|^5.7|^6.0|^9.4", "squizlabs/php_codesniffer": "~2.0" }, "suggest": { diff --git a/php-phpseclib.spec b/php-phpseclib.spec index dd43eff..715d79d 100644 --- a/php-phpseclib.spec +++ b/php-phpseclib.spec @@ -3,12 +3,12 @@ %global github_owner phpseclib %global github_name phpseclib -%global github_commit 497856a8d997f640b4a516062f84228a772a48a8 +%global github_commit 136b9ca7eebef78be14abf90d65c5e57b6bc5d36 %global github_short %(c=%{github_commit}; echo ${c:0:7}) %bcond_without tests Name: php-%{composer_vendor} -Version: 2.0.29 +Version: 2.0.30 Release: 1%{?dist} Summary: PHP Secure Communications Library License: MIT @@ -27,11 +27,15 @@ BuildArch: noarch %if %{with tests} BuildRequires: php-composer(fedora/autoloader) +%if 0%{?fedora} >= 32 || 0%{?rhel} >= 9 +%global phpunit %{_bindir}/phpunit9 +%else %if 0%{?fedora} >= 26 || 0%{?rhel} >= 8 %global phpunit %{_bindir}/phpunit6 %else %global phpunit %{_bindir}/phpunit %endif +%endif BuildRequires: %{phpunit} BuildRequires: %{_bindir}/phpab # Optional at runtime, to avoid too muck skipped tests @@ -85,13 +89,33 @@ require "%{buildroot}%{_datadir}/php/%{composer_vendor}/autoload.php"; date_default_timezone_set('UTC'); EOF +# from travis/run-phpunit.sh +if %{phpunit} --atleast-version 8 +then + find tests -type f -name "*.php" -print0 | xargs -0 sed -i 's/n setUpBeforeClass()/n setUpBeforeClass(): void/g' + find tests -type f -name "*.php" -print0 | xargs -0 sed -i 's/n setUp()/n setUp(): void/g' + find tests -type f -name "*.php" -print0 | xargs -0 sed -i 's/n tearDown()/n tearDown(): void/g' + find tests -type f -name "*.php" -print0 | xargs -0 sed -i 's/\(n assertIsArray([^)]*)\)/\1: void/g' + find tests -type f -name "*.php" -print0 | xargs -0 sed -i 's/\(n assertIsString([^)]*)\)/\1: void/g' + find tests -type f -name "*.php" -print0 | xargs -0 sed -i 's/\(n assertStringContainsString([^)]*)\)/\1: void/g' + find tests -type f -name "*.php" -print0 | xargs -0 sed -i 's/\(n assertStringNotContainsString([^)]*)\)/\1: void/g' + find tests -type f -name "*.php" -print0 | xargs -0 sed -i 's/^class Unit_Crypt_\(AES\|Hash\|RSA\)_/class /g' + find tests -type f -name "*.php" -print0 | xargs -0 sed -i 's/^class Unit_File_\(X509\)_/class /g' + find tests -type f -name "*.php" -print0 | xargs -0 sed -i 's/^class Unit_Math_\(BigInteger\)_/class /g' + find tests -type f -name "*.php" -print0 | xargs -0 sed -i 's/^class Unit_\(Crypt\|File\|Math\|Net\)_/class /g' + find tests -type f -name "*.php" -print0 | xargs -0 sed -i 's/^class Functional_Net_/class /g' + find tests -type f -name "*.php" -print0 | xargs -0 sed -i 's/extends Unit_Crypt_Hash_\(SHA512Test\|SHA256Test\)/extends \1/g' +fi + +# avoid already defined class +sed -e '/require /d' -i tests/Unit/Crypt/Hash/SHA*_96Test.php # testAuthorityInfoAccess fails without internet access ret=0 -for cmd in "php %{phpunit}" php72 php73 php74; do +for cmd in "php %{phpunit}" php73 php74 php80; do if which $cmd; then set $cmd - $1 -d memory_limit=1G ${2:-%{_bindir}/phpunit6} \ + $1 -d memory_limit=1G ${2:-%{_bindir}/phpunit9} \ --filter '^((?!(testAuthorityInfoAccess)).)*$' \ --verbose || ret=1 fi @@ -108,6 +132,10 @@ exit $ret %changelog +* Thu Dec 17 2020 Remi Collet - 2.0.30-1 +- update to 2.0.30 +- switch to phpunit9 on Fedora + * Tue Sep 8 2020 Remi Collet - 2.0.29-1 - update to 2.0.29 -- cgit