summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--php-phpunit-PHPUnit.spec23
-rw-r--r--phpunit-php8.patch68
2 files changed, 81 insertions, 10 deletions
diff --git a/php-phpunit-PHPUnit.spec b/php-phpunit-PHPUnit.spec
index 7648657..0e28da6 100644
--- a/php-phpunit-PHPUnit.spec
+++ b/php-phpunit-PHPUnit.spec
@@ -1,6 +1,6 @@
# remirepo/fedora spec file for php-phpunit-PHPUnit
#
-# Copyright (c) 2010-2018 Remi Collet
+# Copyright (c) 2010-2021 Remi Collet
# Copyright (c) 2006-2009 Christopher Stone
#
# License: MIT
@@ -25,23 +25,20 @@
Name: php-phpunit-PHPUnit
Version: %{major}.%{minor}
-Release: 6%{?dist}
+Release: 11%{?dist}
Summary: The PHP Unit Testing framework version 5
License: BSD
URL: https://github.com/%{gh_owner}/%{gh_project}
-%if 1
Source0: https://github.com/%{gh_owner}/%{gh_project}/archive/%{gh_commit}/%{name}-%{version}-%{gh_short}.tar.gz
-%else
-Source0: %{gh_commit}/%{name}-%{version}-%{gh_short}.tgz
-Source1: makesrc.sh
-%endif
# Autoload template, from version 3.7
Source2: %{gh_project}-5.4.0-Autoload.php.in
# Fix command for autoload
Patch0: %{gh_project}-rpm.patch
+# Minimal fix for PHP 8
+Patch1: %{gh_project}-php8.patch
BuildArch: noarch
BuildRequires: php(language) >= 5.6
@@ -208,10 +205,13 @@ Documentation: https://phpunit.readthedocs.io/
%prep
%setup -q -n %{gh_project}-%{gh_commit}
-%patch0 -p0 -b .rpm
-
+%patch0 -p1 -b .rpm
# Restore PSR-0 tree
mv src PHPUnit
+%patch1 -p1 -b .php8
+
+find . \( -name \*.rpm -o -name \*.php8 \) -delete -print
+
%build
@@ -238,7 +238,7 @@ install -D -p -m 755 phpunit %{buildroot}%{_bindir}/phpunit
OPT="--testsuite=small --no-coverage"
ret=0
-for cmd in php70 php71 php; do
+for cmd in php php73 php74 php80; do
if which $cmd; then
$cmd ./phpunit $OPT --verbose
fi
@@ -263,6 +263,9 @@ fi
%changelog
+* Fri Mar 19 2021 Remi Collet <remi@remirepo.net> - 5.7.27-11
+- add minimal fix for PHP 8
+
* Mon Mar 18 2019 Remi Collet <remi@remirepo.net> - 5.7.27-6
- improve package description
diff --git a/phpunit-php8.patch b/phpunit-php8.patch
new file mode 100644
index 0000000..f34a9b6
--- /dev/null
+++ b/phpunit-php8.patch
@@ -0,0 +1,68 @@
+diff -up ./PHPUnit/Framework/TestCase.php.php8 ./PHPUnit/Framework/TestCase.php
+--- ./PHPUnit/Framework/TestCase.php.php8 2021-03-19 12:29:00.122960437 +0100
++++ ./PHPUnit/Framework/TestCase.php 2021-03-19 12:29:16.926880988 +0100
+@@ -1059,7 +1059,7 @@ abstract class PHPUnit_Framework_TestCas
+ $this->registerMockObjectsFromTestArguments($testArguments);
+
+ try {
+- $testResult = $method->invokeArgs($this, $testArguments);
++ $testResult = $method->invokeArgs($this, array_values($testArguments));
+ } catch (Throwable $_e) {
+ $e = $_e;
+ } catch (Exception $_e) {
+diff -up ./PHPUnit/Util/Configuration.php.php8 ./PHPUnit/Util/Configuration.php
+--- ./PHPUnit/Util/Configuration.php.php8 2018-02-01 06:50:59.000000000 +0100
++++ ./PHPUnit/Util/Configuration.php 2021-03-19 12:28:10.627194461 +0100
+@@ -159,7 +159,7 @@ class PHPUnit_Util_Configuration
+ $this->xpath = new DOMXPath($this->document);
+ }
+
+- final private function __clone()
++ private function __clone()
+ {
+ }
+
+diff -up ./tests/_files/Singleton.php.php8 ./tests/_files/Singleton.php
+--- ./tests/_files/Singleton.php.php8 2018-02-01 06:50:59.000000000 +0100
++++ ./tests/_files/Singleton.php 2021-03-19 12:28:10.627194461 +0100
+@@ -7,7 +7,7 @@ class Singleton
+ {
+ }
+
+- final private function __clone()
++ private function __clone()
+ {
+ }
+
+diff -up ./tests/Framework/Constraint/JsonMatches/ErrorMessageProviderTest.php.php8 ./tests/Framework/Constraint/JsonMatches/ErrorMessageProviderTest.php
+--- ./tests/Framework/Constraint/JsonMatches/ErrorMessageProviderTest.php.php8 2018-02-01 06:50:59.000000000 +0100
++++ ./tests/Framework/Constraint/JsonMatches/ErrorMessageProviderTest.php 2021-03-19 12:28:10.627194461 +0100
+@@ -39,7 +39,7 @@ class Framework_Constraint_JsonMatches_E
+ {
+ return [
+ 'JSON_ERROR_NONE' => [
+- null, 'json_error_none', ''
++ null, JSON_ERROR_NONE, ''
+ ],
+ 'JSON_ERROR_DEPTH' => [
+ 'Maximum stack depth exceeded', JSON_ERROR_DEPTH, ''
+diff -up ./tests/Framework/ConstraintTest.php.php8 ./tests/Framework/ConstraintTest.php
+--- ./tests/Framework/ConstraintTest.php.php8 2018-02-01 06:50:59.000000000 +0100
++++ ./tests/Framework/ConstraintTest.php 2021-03-19 12:28:10.627194461 +0100
+@@ -1233,7 +1233,7 @@ EOF
+
+ $this->assertTrue($constraint->evaluate($resource, '', true));
+
+- @fclose($resource);
++ if (is_resource($resource)) @fclose($resource);
+ }
+
+ public function testConstraintIsNotType()
+@@ -2547,7 +2547,6 @@ EOF
+ // Default case.
+ $constraint = new PHPUnit_Framework_Constraint_TraversableContains('foo');
+
+- $this->assertTrue($constraint->evaluate([0], '', true));
+ $this->assertTrue($constraint->evaluate([true], '', true));
+ }
+