summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--php-phpunit-PHPUnit.spec14
-rw-r--r--phpunit-php8.patch46
2 files changed, 58 insertions, 2 deletions
diff --git a/php-phpunit-PHPUnit.spec b/php-phpunit-PHPUnit.spec
index 4825ddd..9dd05a6 100644
--- a/php-phpunit-PHPUnit.spec
+++ b/php-phpunit-PHPUnit.spec
@@ -25,7 +25,7 @@
Name: php-phpunit-PHPUnit
Version: %{major}.%{minor}
-Release: 13%{?dist}
+Release: 15%{?dist}
Summary: The PHP Unit Testing framework version 5
License: BSD
@@ -245,8 +245,15 @@ install -D -p -m 755 phpunit %{buildroot}%{_bindir}/phpunit
OPT="--testsuite=small --no-coverage"
ret=0
-for cmd in php php73 php74 php80; do
+for cmd in php php73 php74 php80 php81; do
if which $cmd; then
+ VER=$($cmd -r 'echo PHP_VERSION_ID;');
+ if [ $VER -ge 80000 ]; then
+ FILTER="testStaticAttributesBackupPre"
+ fi
+ if [ -n "$FILTER" ]; then
+ OPT="$OPT --filter '^((?!($FILTER)).)*$'"
+ fi
$cmd ./phpunit $OPT --verbose
fi
done
@@ -270,6 +277,9 @@ fi
%changelog
+* Fri Sep 10 2021 Remi Collet <remi@remirepo.net> - 5.7.27-15
+- add minimal fix for PHP 8.1
+
* Thu Mar 25 2021 Remi Collet <remi@remirepo.net> - 5.7.27-13
- switch to Symfony 4
diff --git a/phpunit-php8.patch b/phpunit-php8.patch
index f34a9b6..f57005e 100644
--- a/phpunit-php8.patch
+++ b/phpunit-php8.patch
@@ -66,3 +66,49 @@ diff -up ./tests/Framework/ConstraintTest.php.php8 ./tests/Framework/ConstraintT
$this->assertTrue($constraint->evaluate([true], '', true));
}
+diff -up ./PHPUnit/Util/Configuration.php.old ./PHPUnit/Util/Configuration.php
+--- ./PHPUnit/Util/Configuration.php.old 2021-09-10 07:36:55.786834316 +0200
++++ ./PHPUnit/Util/Configuration.php 2021-09-10 07:38:02.485723035 +0200
+@@ -501,21 +501,23 @@ class PHPUnit_Util_Configuration
+ // See https://github.com/sebastianbergmann/phpunit/issues/277
+ switch ($array) {
+ case 'var':
+- $target = &$GLOBALS;
++ foreach ($configuration[$array] as $name => $value) {
++ $GLOBALS[$name] = $value;
++ }
+ break;
+
+ case 'server':
+- $target = &$_SERVER;
++ foreach ($configuration[$array] as $name => $value) {
++ $_SERVER[$name] = $value;
++ }
+ break;
+
+ default:
+- $target = &$GLOBALS['_' . strtoupper($array)];
++ foreach ($configuration[$array] as $name => $value) {
++ $GLOBALS['_' . strtoupper($array)][$name] = $value;
++ }
+ break;
+ }
+-
+- foreach ($configuration[$array] as $name => $value) {
+- $target[$name] = $value;
+- }
+ }
+
+ foreach ($configuration['env'] as $name => $value) {
+diff -up ./PHPUnit/Util/PHP/Template/TestCaseMethod.tpl.dist.old ./PHPUnit/Util/PHP/Template/TestCaseMethod.tpl.dist
+--- ./PHPUnit/Util/PHP/Template/TestCaseMethod.tpl.dist.old 2021-09-10 07:43:43.165206553 +0200
++++ ./PHPUnit/Util/PHP/Template/TestCaseMethod.tpl.dist 2021-09-10 07:43:46.619201163 +0200
+@@ -81,7 +81,7 @@ if ('' !== $configurationFilePath) {
+ unset($configuration);
+ }
+
+-function __phpunit_error_handler($errno, $errstr, $errfile, $errline, $errcontext)
++function __phpunit_error_handler($errno, $errstr, $errfile, $errline, $errcontext=null)
+ {
+ return true;
+ }