allow to run with old PHPUnit

This commit is contained in:
Remi Collet 2018-02-20 09:00:16 +01:00
commit 0037d54ce7

View file

@ -9,7 +9,7 @@
Name: php-%{composer_vendor}
Version: 2.0.10
Release: 1%{?dist}
Release: 2%{?dist}
Summary: PHP Secure Communications Library
License: MIT
URL: https://github.com/%{github_owner}/%{github_name}
@ -74,23 +74,22 @@ cp -pr %{composer_vendor} %{buildroot}%{_datadir}/php
%check
%{_bindir}/phpab --output tests/bootstrap.php tests
cat << 'EOF' | tee -a tests/bootstrap.php
if (class_exists("PHPUnit_Framework_TestCase") && !class_exists("PHPUnit\\Framework\\TestCase")) {
class_alias("PHPUnit_Framework_TestCase", "PHPUnit\\Framework\\TestCase");
}
require "%{buildroot}%{_datadir}/php/%{composer_vendor}/autoload.php";
date_default_timezone_set('UTC');
EOF
if php %{phpunit} --atleast-version 4.8.35; then
ret=0
for cmd in "php %{phpunit}" php70 php71 php72; do
if which $cmd; then
set $cmd
$1 -d memory_limit=1G ${2:-%{_bindir}/phpunit6} --verbose || ret=1
fi
done
exit $ret
else
: Skip test as PHPUnit is too old
fi
ret=0
for cmd in "php %{phpunit}" php70 php71 php72; do
if which $cmd; then
set $cmd
$1 -d memory_limit=1G ${2:-%{_bindir}/phpunit6} --verbose || ret=1
fi
done
exit $ret
%endif
@ -102,6 +101,9 @@ fi
%changelog
* Tue Feb 20 2018 Remi Collet <remi@remirepo.net> - 2.0.10-2
- allow to run with old PHPUnit
* Tue Feb 20 2018 Remi Collet <remi@remirepo.net> - 2.0.10-1
- Update to 2.0.10
- use phpunit6 when available