disable test suite on EL

switch to phpunit9
This commit is contained in:
Remi Collet 2021-12-08 09:19:09 +01:00
commit 184c458a68

View file

@ -1,8 +1,8 @@
#
# Fedora spec file for php-patchwork-jsqueeze
#
# Copyright (c) 2016 Adam Williamson <awilliam@redhat.com>
# Shawn Iwinski <shawn@iwin.ski>
# Copyright (c) 2016-2021 Adam Williamson <awilliam@redhat.com>
# Shawn Iwinski <shawn@iwin.ski>
#
# License: MIT
# http://opensource.org/licenses/MIT
@ -21,14 +21,17 @@
# "php": ">=5.3.0"
%global php_min_ver 5.3.0
# Build using "--without tests" to disable tests
%global with_tests 0%{!?_without_tests:1}
%if 0%{?fedora}
%bcond_without tests
%else
%bcond_with tests
%endif
%{!?phpdir: %global phpdir %{_datadir}/php}
Name: php-%{composer_vendor}-%{composer_project}
Version: %{github_version}
Release: 11%{?dist}
Release: 12%{?dist}
Summary: Efficient JavaScript minification
License: ASL 2.0 or GPLv2
@ -43,10 +46,10 @@ BuildArch: noarch
# Autoloader
BuildRequires: %{_bindir}/phpab
# Tests
%if %{with_tests}
%if %{with tests}
## composer.json
BuildRequires: php(language) >= %{php_min_ver}
BuildRequires: php-composer(phpunit/phpunit)
BuildRequires: phpunit9
## phpcompatinfo (computed from version 2.0.5)
BuildRequires: php-pcre
%endif
@ -89,16 +92,29 @@ cp -pr src/* %{buildroot}%{phpdir}/Patchwork/
%check
%if %{with_tests}
%{_bindir}/phpunit --verbose \
--bootstrap %{buildroot}%{phpdir}/Patchwork/autoload-jsqueeze.php
%if %{with tests}
: Create tests autoloader
cat << 'EOF' | tee tests/bootstrap.php
<?php
require "%{buildroot}%{phpdir}/Patchwork/autoload-jsqueeze.php";
class_alias("PHPUnit\\Framework\\TestCase", "PHPUnit_Framework_TestCase");
EOF
: Run upstream test suite
ret=0
for cmd in php php74 php80 php81
do
if which $cmd; then
$cmd %{_bindir}/phpunit9 --verbose || ret=1
fi
done
exit $ret
%else
: Tests skipped
%endif
%files
%{!?_licensedir:%global license %%doc}
%license LICENSE.*
%doc *.md
%doc composer.json
@ -108,6 +124,10 @@ cp -pr src/* %{buildroot}%{phpdir}/Patchwork/
%changelog
* Wed Dec 8 2021 Remi Collet <remi@fedoraproject.org> - 2.0.5-12
- disable test suite on EL
- switch to phpunit9
* Fri Jul 23 2021 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.5-11
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild