enable upstream test suite
This commit is contained in:
parent
2d17417a27
commit
d480e2bc12
4 changed files with 122 additions and 37 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -1,3 +1,4 @@
|
|||
clog
|
||||
/php-phpunitgoodpractices-traits-1.9.1-1f56f64.tgz
|
||||
/php-phpunitgoodpractices-polyfill-1.5.0-b87c59f.tgz
|
||||
/php-sanmai-phpunit-legacy-adapter-8.1-464c750.tgz
|
||||
|
|
|
|||
83
makesrc.sh
83
makesrc.sh
|
|
@ -8,21 +8,24 @@ COMMIT=$(sed -n '/^%global gh_commit/{s/.* //;p}' $NAME.spec)
|
|||
SHORT=${COMMIT:0:7}
|
||||
|
||||
echo -e "\nCreate git snapshot\nName=$NAME, Owner=$OWNER, Project=$PROJECT, Version=$VERSION\n"
|
||||
if [ -f $NAME-$VERSION-$SHORT.tgz ]; then
|
||||
echo "$PROJECT Skipped"
|
||||
else
|
||||
echo "Cloning..."
|
||||
git clone https://github.com/$OWNER/$PROJECT.git $PROJECT-$COMMIT
|
||||
|
||||
echo "Cloning..."
|
||||
git clone https://github.com/$OWNER/$PROJECT.git $PROJECT-$COMMIT
|
||||
echo "Getting commit..."
|
||||
pushd $PROJECT-$COMMIT
|
||||
git checkout $COMMIT || exit 1
|
||||
cp composer.json ../composer-polyfill.json
|
||||
popd
|
||||
|
||||
echo "Getting commit..."
|
||||
pushd $PROJECT-$COMMIT
|
||||
git checkout $COMMIT
|
||||
cp composer.json ../composer-polyfill.json
|
||||
popd
|
||||
echo "Archiving..."
|
||||
tar czf $NAME-$VERSION-$SHORT.tgz --exclude .git $PROJECT-$COMMIT
|
||||
|
||||
echo "Archiving..."
|
||||
tar czf $NAME-$VERSION-$SHORT.tgz --exclude .git $PROJECT-$COMMIT
|
||||
|
||||
echo "Cleaning..."
|
||||
rm -rf $PROJECT-$COMMIT
|
||||
echo "Cleaning..."
|
||||
rm -rf $PROJECT-$COMMIT
|
||||
fi
|
||||
|
||||
PROJECT=Traits
|
||||
VERSION=$(sed -n '/^%global tr_version/{s/.* //;p}' $NAME.spec)
|
||||
|
|
@ -30,22 +33,54 @@ COMMIT=$(sed -n '/^%global tr_commit/{s/.* //;p}' $NAME.spec)
|
|||
SHORT=${COMMIT:0:7}
|
||||
NAME=php-phpunitgoodpractices-traits
|
||||
|
||||
echo -e "\nCreate git snapshot\nName=$NAME, Owner=$OWNER, Project=$PROJECT, Version=$VERSION\n"
|
||||
if [ -f $NAME-$VERSION-$SHORT.tgz ]; then
|
||||
echo "$PROJECT Skipped"
|
||||
else
|
||||
echo -e "\nCreate git snapshot\nName=$NAME, Owner=$OWNER, Project=$PROJECT, Version=$VERSION\n"
|
||||
|
||||
echo "Cloning..."
|
||||
git clone https://github.com/$OWNER/$PROJECT.git $PROJECT-$COMMIT
|
||||
echo "Cloning..."
|
||||
git clone https://github.com/$OWNER/$PROJECT.git $PROJECT-$COMMIT
|
||||
|
||||
echo "Getting commit..."
|
||||
pushd $PROJECT-$COMMIT
|
||||
git checkout $COMMIT
|
||||
cp composer.json ../composer-traits.json
|
||||
popd
|
||||
echo "Getting commit..."
|
||||
pushd $PROJECT-$COMMIT
|
||||
git checkout $COMMIT || exit 1
|
||||
cp composer.json ../composer-traits.json
|
||||
popd
|
||||
|
||||
echo "Archiving..."
|
||||
tar czf $NAME-$VERSION-$SHORT.tgz --exclude .git $PROJECT-$COMMIT
|
||||
echo "Archiving..."
|
||||
tar czf $NAME-$VERSION-$SHORT.tgz --exclude .git $PROJECT-$COMMIT
|
||||
|
||||
echo "Cleaning..."
|
||||
rm -rf $PROJECT-$COMMIT
|
||||
echo "Cleaning..."
|
||||
rm -rf $PROJECT-$COMMIT
|
||||
fi
|
||||
|
||||
NAME=$(basename $PWD)
|
||||
OWNER=$(sed -n '/^%global lg_owner/{s/.* //;p}' $NAME.spec)
|
||||
PROJECT=$(sed -n '/^%global lg_project/{s/.* //;p}' $NAME.spec)
|
||||
VERSION=$(sed -n '/^%global lg_version/{s/.* //;p}' $NAME.spec)
|
||||
COMMIT=$(sed -n '/^%global lg_commit/{s/.* //;p}' $NAME.spec)
|
||||
SHORT=${COMMIT:0:7}
|
||||
NAME=php-$OWNER-$PROJECT
|
||||
|
||||
if [ -f $NAME-$VERSION-$SHORT.tgz ]; then
|
||||
echo "$PROJECT Skipped"
|
||||
else
|
||||
echo -e "\nCreate git snapshot\nName=$NAME, Owner=$OWNER, Project=$PROJECT, Version=$VERSION\n"
|
||||
|
||||
echo "Cloning..."
|
||||
git clone https://github.com/$OWNER/$PROJECT.git $PROJECT-$COMMIT
|
||||
|
||||
echo "Getting commit..."
|
||||
pushd $PROJECT-$COMMIT
|
||||
git checkout $COMMIT || exit 1
|
||||
cp composer.json ../composer-legacy.json
|
||||
popd
|
||||
|
||||
echo "Archiving..."
|
||||
tar czf $NAME-$VERSION-$SHORT.tgz --exclude .git $PROJECT-$COMMIT
|
||||
|
||||
echo "Cleaning..."
|
||||
rm -rf $PROJECT-$COMMIT
|
||||
fi
|
||||
|
||||
echo "Done."
|
||||
|
|
|
|||
|
|
@ -7,6 +7,8 @@
|
|||
# Please, preserve the changelog entries
|
||||
#
|
||||
|
||||
%bcond_without tests
|
||||
|
||||
# Polyfill
|
||||
# https://github.com/PHPUnitGoodPractices/polyfill/releases
|
||||
%global gh_commit b87c59f0d3df764d0dcf8154e18be69fe6cb5cba
|
||||
|
|
@ -20,16 +22,22 @@
|
|||
%global ns_vendor PHPUnitGoodPractices
|
||||
%global ns_project Polyfill
|
||||
%global php_home %{_datadir}/php
|
||||
%global with_tests 0%{!?_without_tests:1}
|
||||
# Traits
|
||||
# https://github.com/PHPUnitGoodPractices/Traits/releases
|
||||
%global tr_commit 1f56f643aaa3e98f22acf71129109479afb9ef33
|
||||
%global tr_short %(c=%{tr_commit}; echo ${c:0:7})
|
||||
%global tr_version 1.9.1
|
||||
# Legacy
|
||||
# https://github.com/sanmai/phpunit-legacy-adapter/releases
|
||||
%global lg_owner sanmai
|
||||
%global lg_project phpunit-legacy-adapter
|
||||
%global lg_commit 464c7505c15c487239ac696a82097c765f38a2a1
|
||||
%global lg_short %(c=%{lg_commit}; echo ${c:0:7})
|
||||
%global lg_version 8.1
|
||||
|
||||
Name: php-%{pk_vendor}-%{pk_project}
|
||||
Version: 1.5.0
|
||||
Release: 1%{?dist}
|
||||
Release: 2%{?dist}
|
||||
Summary: Lacking future-compat polyfills for PHPUnit
|
||||
|
||||
License: MIT
|
||||
|
|
@ -37,26 +45,39 @@ URL: https://github.com/%{gh_owner}/%{gh_project}
|
|||
# git snapshot to get upstream test suite (none for now)
|
||||
Source0: %{name}-%{version}-%{gh_short}.tgz
|
||||
Source1: php-%{pk_vendor}-traits-%{tr_version}-%{tr_short}.tgz
|
||||
Source2: makesrc.sh
|
||||
Source2: php-%{lg_owner}-%{lg_project}-%{lg_version}-%{lg_short}.tgz
|
||||
Source3: makesrc.sh
|
||||
|
||||
BuildArch: noarch
|
||||
%if %{with_tests}
|
||||
%if %{with tests}
|
||||
# For tests
|
||||
BuildRequires: php(language) >= 5.5
|
||||
BuildRequires: %{_bindir}/phpunit
|
||||
# From composer.json, "require-dev": {
|
||||
%if 0%{?fedora} >= 32 || 0%{?rhel} >= 9
|
||||
%global phpunit %{_bindir}/phpunit9
|
||||
%else
|
||||
%global phpunit %{_bindir}/phpunit8
|
||||
%endif
|
||||
BuildRequires: %{phpunit}
|
||||
# From polyfill, composer.json, "require-dev": {
|
||||
# "friendsofphp/php-cs-fixer": "^2",
|
||||
# "php-coveralls/php-coveralls": "^2.4"
|
||||
# From traits, composer.json, "require-dev": {
|
||||
# "phpunitgoodpractices/polyfill": "^1.1",
|
||||
# "sanmai/phpunit-legacy-adapter": "^6.1 || ^8.0"
|
||||
%endif
|
||||
BuildRequires: php-cli
|
||||
# Autoloader
|
||||
BuildRequires: php-fedora-autoloader-devel
|
||||
%endif
|
||||
|
||||
# From composer.json, "require": {
|
||||
# From polyfill, composer.json, "require": {
|
||||
# "php": "^5.5 || ^7.0 || ^8.0",
|
||||
# "phpunit/phpunit": "^4.8.36 || ^5.7.27 || ^6.5.14 || ^7.5.20 || ^8.0 || ^9.0"
|
||||
# From traits, composer.json, "require": {
|
||||
# "php": "^5.5 || ^7.0 || ^8.0",
|
||||
# "phpunit/phpunit": "^4.8.36 || ^5.7.27 || ^6.5.14 || ^7.5.20 || ~8.5 || ~9.4"
|
||||
Requires: php(language) >= 5.5
|
||||
Requires: (phpunit9 or phpunit8 or phpunit7 or phpunit6 or php-phpunit-PHPUnit)
|
||||
# From phpcompatinfo report for version polyfill 1.4.0 and traits1.9.1
|
||||
# From phpcompatinfo report for version polyfill 1.5.0 and traits 1.9.1
|
||||
# nothing
|
||||
# Autoloader
|
||||
Requires: php-composer(fedora/autoloader)
|
||||
|
|
@ -73,13 +94,15 @@ Autoloader: %{php_home}/%{ns_vendor}/%{ns_project}/autoload.php
|
|||
|
||||
|
||||
%prep
|
||||
%setup -q -n %{gh_project}-%{gh_commit} -a 1
|
||||
%setup -q -n %{gh_project}-%{gh_commit} -a 1 -a 2
|
||||
mv composer.json composer-polyfill.json
|
||||
mv LICENSE LICENSE-polyfill
|
||||
|
||||
mv Traits-%{tr_commit}/src src2
|
||||
mv Traits-%{tr_commit}/composer.json composer-traits.json
|
||||
mv Traits-%{tr_commit}/LICENSE LICENSE-traits
|
||||
mv Traits-%{tr_commit}/tests tests/Traits
|
||||
mv %{lg_project}-%{lg_commit}/src src3
|
||||
|
||||
cat << 'EOF' | tee src/autoload.php
|
||||
<?php
|
||||
|
|
@ -115,7 +138,6 @@ cp -pr src2 %{buildroot}%{php_home}/%{ns_vendor}/Traits
|
|||
|
||||
|
||||
%check
|
||||
%if %{with_tests}
|
||||
: Minimal check for our autoloader
|
||||
php -r '
|
||||
require "%{buildroot}%{php_home}/%{ns_vendor}/%{ns_project}/autoload.php";
|
||||
|
|
@ -129,6 +151,29 @@ if (!class_exists("PHPUnitGoodPractices\\Traits\\PHPUnitVersionRetriever")) {
|
|||
exit(1);
|
||||
}
|
||||
'
|
||||
|
||||
%if %{with tests}
|
||||
: Upstream test suite
|
||||
mkdir vendor
|
||||
cat << 'EOF' | tee vendor/autoload.php
|
||||
<?php
|
||||
require '%{buildroot}%{php_home}/%{ns_vendor}/%{ns_project}/autoload.php';
|
||||
require dirname(__DIR__) . '/src3/TestCase.php';
|
||||
\Fedora\Autoloader\Autoload::addPsr4('PHPUnitGoodPractices\\Traits\\Tests\\', dirname(__DIR__) . '/tests/Traits');
|
||||
EOF
|
||||
|
||||
ret=0
|
||||
for cmdarg in "php %{phpunit}" "php72 %{_bindir}/phpunit8" php73 php74 php80
|
||||
do
|
||||
if which $cmdarg; then
|
||||
set $cmdarg
|
||||
$1 ${2:-%{_bindir}/phpunit9} \
|
||||
--filter '^((?!(testThatThereIsProperPHPUnitInComposer)).)*$' \
|
||||
--verbose || ret=1
|
||||
fi
|
||||
done
|
||||
|
||||
exit $ret
|
||||
%else
|
||||
: Test suite disabled
|
||||
%endif
|
||||
|
|
@ -144,6 +189,9 @@ if (!class_exists("PHPUnitGoodPractices\\Traits\\PHPUnitVersionRetriever")) {
|
|||
|
||||
|
||||
%changelog
|
||||
* Tue Dec 8 2020 Remi Collet <remi@remirepo.net> - 1.5.0-2
|
||||
- enable upstream test suite
|
||||
|
||||
* Tue Dec 8 2020 Remi Collet <remi@remirepo.net> - 1.5.0-1
|
||||
- update phpunitgoodpractices/polyfill to 1.5.0
|
||||
|
||||
|
|
|
|||
5
sources
5
sources
|
|
@ -1,2 +1,3 @@
|
|||
SHA512 (php-phpunitgoodpractices-polyfill-1.5.0-b87c59f.tgz) = 30bd3cbae013af3de7bb11d1dbcd327aba1bbb64a9742538fe476748a6fdfe786c4fae3851cea034ca2f754f0b0bb606009b93a4bf87140f67332b9f5c881704
|
||||
SHA512 (php-phpunitgoodpractices-traits-1.9.1-1f56f64.tgz) = 934b3c1a53dc0997d1084d0858771215ddd0926fd715ec5dcefdb9951c1f0827186d44e642a5266dbd56562a0b2514a64f39fa8438b271b0e395585e4a4069f8
|
||||
SHA512 (php-phpunitgoodpractices-polyfill-1.5.0-b87c59f.tgz) = 4f5ba02c41ea6c9bb0865e1103280b6c73d34b67fcc0b74debd24ed95aad7735f6d53fcd2c165f3c8e462e25d695580d250a9525103ad796942ee44ba1e773fd
|
||||
SHA512 (php-phpunitgoodpractices-traits-1.9.1-1f56f64.tgz) = f80bd879abf7d9a474241cd43c30e817ef1c2db7f9669f02c57b7d9ac8e971ad7a0c05dafa59932b27d8d03a0a345794cfedfac1504985eed047611b8eb6291a
|
||||
SHA512 (php-sanmai-phpunit-legacy-adapter-8.1-464c750.tgz) = 4f5704608294fdecdbc5345fba88471d13cd33156f0c5c27287413087fce74a2ebc7dbb6f0ad67563e950312f315012597ae03fda8cdad2396dd50905002f688
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue