diff options
-rw-r--r-- | php-phpunit-PHPUnit-MockObject.spec | 19 | ||||
-rw-r--r-- | phpunit-mock-objects-php74.patch | 27 | ||||
-rw-r--r-- | phpunit-mock-objects-php80.patch | 20 |
3 files changed, 53 insertions, 13 deletions
diff --git a/php-phpunit-PHPUnit-MockObject.spec b/php-phpunit-PHPUnit-MockObject.spec index 6b654f6..ae744e3 100644 --- a/php-phpunit-PHPUnit-MockObject.spec +++ b/php-phpunit-PHPUnit-MockObject.spec @@ -1,6 +1,6 @@ # remirepo/fedora spec file for php-phpunit-PHPUnit-MockObject # -# Copyright (c) 2013-2018 Remi Collet +# Copyright (c) 2013-2021 Remi Collet # License: CC-BY-SA # http://creativecommons.org/licenses/by-sa/4.0/ # @@ -17,7 +17,6 @@ %global pear_channel pear.phpunit.de %global major 3.4 %global minor 4 -%global specrel 5 %if %{bootstrap} %global with_tests %{?_with_tests:1}%{!?_with_tests:0} %else @@ -26,7 +25,7 @@ Name: php-phpunit-PHPUnit-MockObject Version: %{major}.%{minor} -Release: %{?gh_date:1%{specrel}.%{?prever}%{!?prever:%{gh_date}git%{gh_short}}}%{!?gh_date:%{specrel}}%{?dist} +Release: 6%{?dist} Summary: Mock Object library for PHPUnit License: BSD @@ -37,6 +36,8 @@ Source0: https://github.com/%{gh_owner}/%{gh_project}/archive/%{gh_commit Patch0: %{gh_project}-3.0.0-rpm.patch # For 7.4 Patch1: %{gh_project}-php74.patch +# For 8.0 +Patch2: %{gh_project}-php80.patch BuildArch: noarch BuildRequires: php-fedora-autoloader-devel @@ -97,6 +98,7 @@ Mock Object library for PHPUnit %patch0 -p0 %patch1 -p1 +%patch2 -p1 find . -name \*.orig -exec rm {} \; -print @@ -133,12 +135,16 @@ cat <<EOF >>tests/bootstrap.php require __DIR__ . '/_fixture/autoload.php'; EOF +FILTER="testGetMockForSingletonWithReflectionSuccess" + : Run tests - set include_path to ensure PHPUnit autoloader use it ret=0 -for cmd in php php70 php71 php72 php73 php74; do +for cmd in php php73 php74 php80; do if which $cmd; then $cmd -d include_path=.:%{buildroot}%{php_home}:%{php_home} \ - %{_bindir}/phpunit --no-coverage || ret=1 + %{_bindir}/phpunit \ + --filter "^((?!($FILTER)).)*$" \ + --no-coverage || ret=1 fi done exit $ret @@ -162,6 +168,9 @@ fi %changelog +* Thu Mar 18 2021 Remi Collet <remi@remirepo.net> - 3.4.4-6 +- fix more deprecated usages + * Wed Aug 21 2019 Remi Collet <remi@remirepo.net> - 3.4.4-5 - fix deprecated usage of ReflectionType::__toString() diff --git a/phpunit-mock-objects-php74.patch b/phpunit-mock-objects-php74.patch index fe31d0f..fc1c9fd 100644 --- a/phpunit-mock-objects-php74.patch +++ b/phpunit-mock-objects-php74.patch @@ -1,30 +1,41 @@ Backported from PHPUnit 7 for PHPUnit 5 https://github.com/sebastianbergmann/phpunit/commit/e11397fed729bfef7a9c76f7b193c27ad5710f6b -diff -up ./src/Framework/MockObject/Generator.php.old ./src/Framework/MockObject/Generator.php ---- ./src/Framework/MockObject/Generator.php.old 2019-08-21 09:46:14.255390916 +0200 -+++ ./src/Framework/MockObject/Generator.php 2019-08-21 09:47:30.829930292 +0200 -@@ -1007,7 +1007,7 @@ class PHPUnit_Framework_MockObject_Gener +diff -up ./src/Framework/MockObject/Generator.php.php74 ./src/Framework/MockObject/Generator.php +--- ./src/Framework/MockObject/Generator.php.php74 2019-08-21 10:15:13.489571552 +0200 ++++ ./src/Framework/MockObject/Generator.php 2019-08-21 10:19:40.211435595 +0200 +@@ -1007,7 +1007,11 @@ class PHPUnit_Framework_MockObject_Gener } if ($this->hasReturnType($method)) { - $returnType = (string) $method->getReturnType(); -+ $returnType = $method->getReturnType()->getName(); ++ if (PHP_VERSION_ID >= 70100) { ++ $returnType = $method->getReturnType()->getName(); ++ } else { ++ $returnType = (string) $method->getReturnType(); ++ } } else { $returnType = ''; } -@@ -1190,12 +1190,12 @@ class PHPUnit_Framework_MockObject_Gener +@@ -1190,12 +1194,19 @@ class PHPUnit_Framework_MockObject_Gener $typeDeclaration = ''; if (!$forCall) { - if ($this->hasType($parameter) && (string) $parameter->getType() !== 'self') { -+ if ($this->hasType($parameter) && $parameter->getType()->getName() !== 'self') { ++ if ($this->hasType($parameter)) { ++ if (PHP_VERSION_ID >= 70100) { ++ $typename = $parameter->getType()->getName(); ++ } else { ++ $typename = (string) $parameter->getType(); ++ } ++ } ++ if ($this->hasType($parameter) && $typename !== 'self') { if (version_compare(PHP_VERSION, '7.1', '>=') && $parameter->allowsNull() && !$parameter->isVariadic()) { $nullable = '?'; } - $typeDeclaration = (string) $parameter->getType() . ' '; -+ $typeDeclaration = $parameter->getType()->getName() . ' '; ++ $typeDeclaration = $typename . ' '; } elseif ($parameter->isArray()) { $typeDeclaration = 'array '; } elseif ($parameter->isCallable()) { diff --git a/phpunit-mock-objects-php80.patch b/phpunit-mock-objects-php80.patch new file mode 100644 index 0000000..918de51 --- /dev/null +++ b/phpunit-mock-objects-php80.patch @@ -0,0 +1,20 @@ +diff -up ./src/Framework/MockObject/Generator.php.old ./src/Framework/MockObject/Generator.php +--- ./src/Framework/MockObject/Generator.php.old 2021-03-18 14:27:57.237056358 +0100 ++++ ./src/Framework/MockObject/Generator.php 2021-03-18 14:28:03.916026672 +0100 +@@ -1207,13 +1207,13 @@ class PHPUnit_Framework_MockObject_Gener + } + + $typeDeclaration = $typename . ' '; +- } elseif ($parameter->isArray()) { ++ } elseif (@$parameter->isArray()) { + $typeDeclaration = 'array '; +- } elseif ($parameter->isCallable()) { ++ } elseif (@$parameter->isCallable()) { + $typeDeclaration = 'callable '; + } else { + try { +- $class = $parameter->getClass(); ++ $class = @$parameter->getClass(); + } catch (ReflectionException $e) { + throw new PHPUnit_Framework_MockObject_RuntimeException( + sprintf( |