diff options
-rw-r--r-- | phpunit7-comp.patch | 122 | ||||
-rw-r--r-- | phpunit7.spec | 38 |
2 files changed, 151 insertions, 9 deletions
diff --git a/phpunit7-comp.patch b/phpunit7-comp.patch new file mode 100644 index 0000000..b30897f --- /dev/null +++ b/phpunit7-comp.patch @@ -0,0 +1,122 @@ +Adapted for phpunit7 from + + +From b439136ed5bdfc2abc1bbda8bd5922854c959a1f Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Michael=20Vo=C5=99=C3=AD=C5=A1ek?= <mvorisek@mvorisek.cz> +Date: Wed, 14 Sep 2022 15:50:39 +0200 +Subject: [PATCH] Drop comparison /w `PHP_FLOAT_EPSILON` + +--- + src/Framework/Constraint/IsIdentical.php | 13 +------------ + tests/unit/Framework/AssertTest.php | 22 +++++++++++++++++++--- + 2 files changed, 20 insertions(+), 15 deletions(-) + +diff -up ./src/Framework/Constraint/IsIdentical.php.comp ./src/Framework/Constraint/IsIdentical.php +--- ./src/Framework/Constraint/IsIdentical.php.comp 2022-09-26 09:33:03.170600127 +0200 ++++ ./src/Framework/Constraint/IsIdentical.php 2022-09-26 09:35:13.452281355 +0200 +@@ -26,11 +26,6 @@ use SebastianBergmann\Comparator\Compari + class IsIdentical extends Constraint + { + /** +- * @var float +- */ +- private const EPSILON = 0.0000000001; +- +- /** + * @var mixed + */ + private $value; +@@ -61,13 +56,7 @@ class IsIdentical extends Constraint + */ + public function evaluate($other, $description = '', $returnResult = false) + { +- if (\is_float($this->value) && \is_float($other) && +- !\is_infinite($this->value) && !\is_infinite($other) && +- !\is_nan($this->value) && !\is_nan($other)) { +- $success = \abs($this->value - $other) < self::EPSILON; +- } else { +- $success = $this->value === $other; +- } ++ $success = $this->value === $other; + + if ($returnResult) { + return $success; +diff -up ./tests/unit/Framework/AssertTest.php.comp ./tests/unit/Framework/AssertTest.php +--- ./tests/unit/Framework/AssertTest.php.comp 2022-09-26 09:33:03.170600127 +0200 ++++ ./tests/unit/Framework/AssertTest.php 2022-09-26 09:37:39.752924997 +0200 +@@ -3099,8 +3099,13 @@ XML; + [0, 0], + // floats + [2.3, 2.3], +- [1 / 3, 1 - 2 / 3], +- [\log(0), \log(0)], ++ [1 / 3, 1 / 3], ++ [1 - 2 / 3, 1 - 2 / 3], ++ [5.5E+123, 5.5E+123], ++ [5.5E-123, 5.5E-123], ++ [log(0), log(0)], ++ [INF, INF], ++ [-INF, -INF], + // arrays + [[], []], + [[0 => 1], [0 => 1]], +@@ -3156,6 +3161,12 @@ XML; + [[new \Struct(2.3)], [new \Struct(4.2)], 0.5], + // NAN + [\NAN, \NAN], ++ [1 / 3, 1 - 2 / 3], ++ [1 / 3, '0.33333333333333337'], ++ [1 - 2 / 3, '3333333333333333'], ++ [5.5E+123, 5.6E+123], ++ [5.5E-123, 5.6E-123], ++ [5.5E+123, 5.5E-123], + // arrays + [[], [0 => 1]], + [[0 => 1], []], +@@ -3359,8 +3370,12 @@ XML; + ['0', 0], + [2.3, '2.3'], + ['2.3', 2.3], +- [(string) (1 / 3), 1 - 2 / 3], +- [1 / 3, (string) (1 - 2 / 3)], ++ [1, 1.0], ++ [1.0, '1'], ++ [1 / 3, '0.3333333333333333'], ++ [1 - 2 / 3, '0.33333333333333337'], ++ [5.5E+123, '5.5E+123'], ++ [5.5E-123, '5.5E-123'], + ['string representation', new \ClassWithToString], + [new \ClassWithToString, 'string representation'], + ]; +From 3e5a5d09ff2ece2fb41c0a462246956fd055407f Mon Sep 17 00:00:00 2001 +From: Sebastian Bergmann <sb@sebastian-bergmann.de> +Date: Wed, 14 Sep 2022 08:56:29 +0200 +Subject: [PATCH] Delete test that expected wrong behaviour of + sebastian/comparator + +--- + tests/unit/Framework/Constraint/IsEqualTest.php | 12 ------------ + 1 file changed, 12 deletions(-) + +diff -up ./tests/unit/Framework/Constraint/IsEqualTest.php.comp ./tests/unit/Framework/Constraint/IsEqualTest.php +--- ./tests/unit/Framework/Constraint/IsEqualTest.php.comp 2022-09-26 09:40:05.516578010 +0200 ++++ ./tests/unit/Framework/Constraint/IsEqualTest.php 2022-09-26 09:41:35.658375993 +0200 +@@ -166,18 +166,6 @@ Failed asserting that two arrays are equ + + EOF + ], +- [[true], ['true'], <<<EOF +-Failed asserting that two arrays are equal. +---- Expected +-+++ Actual +-@@ @@ +- Array ( +-- 0 => true +-+ 0 => 'true' +- ) +- +-EOF +- ], + [[0, [1], [2], 3], [0, [4], [2], 3], <<<EOF + Failed asserting that two arrays are equal. + --- Expected diff --git a/phpunit7.spec b/phpunit7.spec index 38db195..be6b244 100644 --- a/phpunit7.spec +++ b/phpunit7.spec @@ -1,13 +1,14 @@ # remirepo/fedora spec file for phpunit7 # -# Copyright (c) 2010-2021 Remi Collet +# Copyright (c) 2010-2023 Remi Collet # -# License: CC-BY-SA +# License: CC-BY-SA-4.0 # http://creativecommons.org/licenses/by-sa/4.0/ # # Please, preserve the changelog entries # +# remirepo:2 # For compatibility with SCL %undefine __brp_mangle_shebangs @@ -28,10 +29,10 @@ Name: %{pk_project}%{ver_major} Version: %{ver_major}.%{ver_minor}.%{ver_patch} -Release: 8%{?dist} +Release: 12%{?dist} Summary: The PHP Unit Testing framework version %{ver_major} -License: BSD +License: BSD-3-Clause URL: https://github.com/%{gh_vendor}/%{gh_project} Source0: https://github.com/%{gh_vendor}/%{gh_project}/archive/%{gh_commit}/%{name}-%{version}-%{gh_short}.tar.gz @@ -39,6 +40,8 @@ Source0: https://github.com/%{gh_vendor}/%{gh_project}/archive/%{gh_commi Patch0: %{name}-rpm.patch # Minimal fix for PHP 8 Patch1: %{name}-php8.patch +# Fix for new comparator +Patch2: %{name}-comp.patch BuildArch: noarch BuildRequires: php(language) >= 7.1 @@ -182,6 +185,11 @@ Requires: php-spl # projects have been merged Obsoletes: php-phpunit-mock-objects6 < 6.1.3 +%if 0%{?fedora} >= 39 || 0%{?rhel} >= 10 +Provides: php-composer(phpunit/phpunit) = %{version} +Provides: phpunit = %{version}-%{release} +%endif + %description PHPUnit is a programmer-oriented testing framework for PHP. @@ -199,10 +207,13 @@ Documentation: https://phpunit.readthedocs.io/ %prep %setup -q -n %{gh_project}-%{gh_commit} -%patch0 -p1 -b .rpm -%patch1 -p1 -b .php8 +%patch -P0 -p1 -b .rpm +%patch -P1 -p1 -b .php8 +%patch -P2 -p1 -b .comp find . -name \*.php8 -delete -print +find . -name \*.comp -delete -print + %build %{_bindir}/phpab \ @@ -217,7 +228,6 @@ cat << 'EOF' | tee -a src/autoload.php '%{php_home}/Text/Template/Autoload.php', '%{php_home}/SebastianBergmann/CodeCoverage6/autoload.php', '%{php_home}/SebastianBergmann/Timer/autoload.php', - '%{php_home}/Prophecy/autoload.php', '%{php_home}/SebastianBergmann/Diff3/autoload.php', // Before comparator which may load v2 '%{php_home}/SebastianBergmann/Comparator3/autoload.php', '%{php_home}/SebastianBergmann/Environment4/autoload.php', @@ -231,6 +241,8 @@ cat << 'EOF' | tee -a src/autoload.php '%{php_home}/SebastianBergmann/Invoker/autoload.php', '%{php_home}/PharIo/Manifest/autoload.php', '%{php_home}/PharIo/Version/autoload.php', + // May load Comparator/RecursionContext bad version + '%{php_home}/Prophecy/autoload.php', ]); // Extensions \Fedora\Autoloader\Dependencies::optional([ @@ -260,7 +272,7 @@ sed -e 's:@PATH@:%{buildroot}%{php_home}/%{ns_vendor}:' -i tests/bootstrap.php sed -e 's:%{php_home}/%{ns_vendor}:%{buildroot}%{php_home}/%{ns_vendor}:' -i phpunit ret=0 -for cmd in php php73 php74 php80 php81; do +for cmd in php php81 php82 php83; do if which $cmd; then OPT="--testsuite=unit --no-coverage" VER=$($cmd -r 'echo PHP_VERSION_ID;'); @@ -270,7 +282,9 @@ for cmd in php php73 php74 php80 php81; do fi if [ $VER -ge 80000 ]; then FILTER="$FILTER|testCountTraversable|testConstraintTraversableCheckForObjectIdentityForDefaultCase" - OPT="$OPT --filter '^((?!($FILTER)).)*$'" + fi + if [ $VER -ge 80300 ]; then + FILTER="$FILTER|testMessageXdebugScreamCompatibility|testGetOriginalException|testNoOriginalExceptionInStacktrace|testIsInIsolationReturnsTrue" fi if [ -n "$FILTER" ]; then OPT="$OPT --filter '^((?!($FILTER)).)*$'" @@ -292,6 +306,12 @@ exit $ret %changelog +* Fri Dec 22 2023 Remi Collet <remi@remirepo.net> - 7.5.20-12 +- fix possible autoloader issue with phpspec/prophecy + +* Mon Sep 26 2022 Remi Collet <remi@remirepo.net> - 7.5.20-11 +- backport upstream fix for new sebastian/comparator + * Tue Nov 23 2021 Remi Collet <remi@remirepo.net> - 7.5.20-8 - additional fix for PHP 8 |