From 5a2725ef5c49dc7166ceb29a027563466fa0e6b5 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Tue, 13 Oct 2020 08:41:52 +0200 Subject: update to 1.2.0 drop dependency on phpunitgoodpractices/polyfill add patch for old phpunit from https://github.com/PHP-CS-Fixer/phpunit-constraint-xmlmatchesxsd/pull/12 switch to classmap autoloader --- 12.patch | 23 +++++++ composer.json | 5 +- php-cs-fixer-phpunit-constraint-xmlmatchesxsd.spec | 70 +++++++++++----------- 3 files changed, 61 insertions(+), 37 deletions(-) create mode 100644 12.patch diff --git a/12.patch b/12.patch new file mode 100644 index 0000000..5235bfa --- /dev/null +++ b/12.patch @@ -0,0 +1,23 @@ +From 9d351061fdc28a58e5a75effd4879c4e556585d2 Mon Sep 17 00:00:00 2001 +From: Remi Collet +Date: Tue, 13 Oct 2020 08:35:27 +0200 +Subject: [PATCH] fix for PHPUnit 5 + +--- + src/Constraint/XmlMatchesXsd.php | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/src/Constraint/XmlMatchesXsd.php b/src/Constraint/XmlMatchesXsd.php +index f981ab5..e9e6490 100644 +--- a/src/Constraint/XmlMatchesXsd.php ++++ b/src/Constraint/XmlMatchesXsd.php +@@ -12,7 +12,8 @@ + + namespace PhpCsFixer\PhpunitConstraintXmlMatchesXsd\Constraint; + +-if (version_compare(\PHPUnit\Runner\Version::id(), '7.0.0') < 0) { ++if (!class_exists('\PHPUnit\Runner\Version') ++ || version_compare(\PHPUnit\Runner\Version::id(), '7.0.0') < 0) { + class_alias(XmlMatchesXsdForV5::class, XmlMatchesXsd::class); + } elseif (version_compare(\PHPUnit\Runner\Version::id(), '8.0.0') < 0) { + class_alias(XmlMatchesXsdForV7::class, XmlMatchesXsd::class); diff --git a/composer.json b/composer.json index 02b05ad..b0b86d4 100644 --- a/composer.json +++ b/composer.json @@ -13,11 +13,10 @@ } ], "require": { - "php": "^5.5 || ^7.0", + "php": "^5.5 || ^7.0 || ^8.0", "ext-dom": "*", "ext-libxml": "*", - "phpunit/phpunit": "^5.7.23 || ^6.4.3 || ^7.0 || ^8.0", - "phpunitgoodpractices/polyfill": "^1.1" + "phpunit/phpunit": "^5.7.23 || ^6.4.3 || ^7.0 || ^8.0 || ^9.0" }, "conflict": { "hhvm": "*" diff --git a/php-cs-fixer-phpunit-constraint-xmlmatchesxsd.spec b/php-cs-fixer-phpunit-constraint-xmlmatchesxsd.spec index d9c6ee7..d193e7c 100644 --- a/php-cs-fixer-phpunit-constraint-xmlmatchesxsd.spec +++ b/php-cs-fixer-phpunit-constraint-xmlmatchesxsd.spec @@ -1,12 +1,12 @@ # remirepo/fedora spec file for php-cs-fixer-phpunit-constraint-xmlmatchesxsd # -# Copyright (c) 2018-2019 Remi Collet +# Copyright (c) 2018-2020 Remi Collet # License: CC-BY-SA # http://creativecommons.org/licenses/by-sa/4.0/ # # Please, preserve the changelog entries # -%global gh_commit 92e0ca8fd30b257a993a66511198267ca7d9d8eb +%global gh_commit 526989325b1bb9a67f215108c490260cfdf6b4f1 %global gh_short %(c=%{gh_commit}; echo ${c:0:7}) #global gh_date 20150717 %global gh_owner PHP-CS-Fixer @@ -19,7 +19,7 @@ %global with_tests 0%{!?_without_tests:1} Name: %{pk_vendor}-%{pk_project} -Version: 1.1.0 +Version: 1.2.0 Release: 1%{?dist} Summary: Constraint for testing XML against XSD @@ -29,6 +29,8 @@ URL: https://github.com/%{gh_owner}/%{gh_project} Source0: %{name}-%{version}-%{gh_short}.tgz Source1: makesrc.sh +Patch0: https://patch-diff.githubusercontent.com/raw/PHP-CS-Fixer/phpunit-constraint-xmlmatchesxsd/pull/12.patch + BuildArch: noarch %if %{with_tests} # For tests @@ -39,41 +41,28 @@ BuildRequires: php-libxml # "johnkary/phpunit-speedtrap": "^1.1 || ^2.0 || ^3.0", # "symfony/phpunit-bridge": "^3.2.2 || ^4.0" # ignore phpunit listeners +%if 0%{?fedora} >= 31 || 0%{?rhel} >= 9 +BuildRequires: phpunit9 +%endif %if 0%{?fedora} >= 29 || 0%{?rhel} >= 8 BuildRequires: phpunit8 %endif %if 0%{?fedora} >= 28 || 0%{?rhel} >= 8 BuildRequires: phpunit7 %endif -# remirepo:1 -%if 0%{?fedora} >= 27 || 0%{?rhel} >= 8 -BuildRequires: (php-composer(phpunitgoodpractices/polyfill) >= 1.1 with php-composer(phpunitgoodpractices/polyfill) < 2) -BuildRequires: phpunit6 >= 6.4.3 -# remirepo:3 -%else -BuildRequires: php-phpunitgoodpractices-polyfill >= 1.1 -%endif BuildRequires: php-composer(phpunit/phpunit) >= 5.7.23 # Autoloader BuildRequires: php-fedora-autoloader-devel %endif # From composer.json, "require": { -# "php": "^5.5 || ^7.0", +# "php": "^5.5 || ^7.0 || ^8.0", # "ext-dom": "*", # "ext-libxml": "*", -# "phpunit/phpunit": "^5.7.23 || ^6.4.3 || ^7.0 || ^8.0", -# "phpunitgoodpractices/polyfill": "^1.1" +# "phpunit/phpunit": "^5.7.23 || ^6.4.3 || ^7.0 || ^8.0 || ^9.0" Requires: php(language) >= 5.5 Requires: php-dom Requires: php-libxml -# remirepo:1 -%if 0%{?fedora} >= 27 || 0%{?rhel} >= 8 -Requires: (php-composer(phpunitgoodpractices/polyfill) >= 1.1 with php-composer(phpunitgoodpractices/polyfill) < 2) -# remirepo:3 -%else -Requires: php-phpunitgoodpractices-polyfill >= 1.1 -%endif # ignore phpunit dep, package using it will run the proper phpunit command (and autoloader) # From phpcompatinfo report for version 1.0.0 # nothing @@ -91,23 +80,20 @@ Autoloader: %{php_home}/%{ns_vendor}/%{ns_project}/autoload.php %prep %setup -q -n %{gh_project}-%{gh_commit} +%patch0 -p1 -cat << 'EOF' | tee src/autoload.php -/,/<\/listeners>/d' phpunit.xml.dist >phpunit.xml : Run upstream test suite with each available phpunit version ret=0 if [ -x %{_bindir}/phpunit ]; then - for cmd in php php56 php70 php71 php72; do + for cmd in php php72 php73 php74; do if which $cmd; then $cmd %{_bindir}/phpunit --verbose || ret=1 fi done fi if [ -x %{_bindir}/phpunit6 ]; then - for cmd in php php70 php71 php72; do + for cmd in php php72 php73 php74; do if which $cmd; then $cmd %{_bindir}/phpunit6 --verbose || ret=1 fi done fi if [ -x %{_bindir}/phpunit7 ]; then - for cmd in php php71 php72; do + for cmd in php php72 php73 php74; do if which $cmd; then $cmd %{_bindir}/phpunit7 --verbose || ret=1 fi done fi if [ -x %{_bindir}/phpunit8 ]; then - for cmd in php php72; do + for cmd in php php72 php73 php74; do if which $cmd; then $cmd %{_bindir}/phpunit8 --verbose || ret=1 fi done fi +if [ -x %{_bindir}/phpunit9 ]; then + for cmd in php php73 php74 php80; do + if which $cmd; then + $cmd %{_bindir}/phpunit9 --verbose || ret=1 + fi + done +fi exit $ret %else : Test suite disabled @@ -162,6 +156,7 @@ exit $ret %files +# remirepo:1 %{!?_licensedir:%global license %%doc} %license LICENSE %doc composer.json @@ -170,6 +165,13 @@ exit $ret %changelog +* Tue Oct 13 2020 Remi Collet - 1.2.0-1 +- update to 1.2.0 +- drop dependency on phpunitgoodpractices/polyfill +- add patch for old phpunit from + https://github.com/PHP-CS-Fixer/phpunit-constraint-xmlmatchesxsd/pull/12 +- switch to classmap autoloader + * Tue Mar 26 2019 Remi Collet - 1.1.0-1 - update to 1.1.0 - raise dependency on phpunitgoodpractices/polyfill 1.1 -- cgit