summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <remi@remirepo.net>2019-08-21 10:24:21 +0200
committerRemi Collet <remi@remirepo.net>2019-08-21 10:24:21 +0200
commit7cfb5a46625e63740714953cafa01a1b2d835d77 (patch)
tree0ff39166be36fb242f3d9541fa2e5f1c80dda6a0
parent2c3f0d32be5147ec6b442899495ea1df18a7d6be (diff)
improve patch for 7.4
-rw-r--r--php-phpunit-PHPUnit-MockObject.spec2
-rw-r--r--phpunit-mock-objects-php74.patch27
2 files changed, 20 insertions, 9 deletions
diff --git a/php-phpunit-PHPUnit-MockObject.spec b/php-phpunit-PHPUnit-MockObject.spec
index 6b654f6..8bdf6ad 100644
--- a/php-phpunit-PHPUnit-MockObject.spec
+++ b/php-phpunit-PHPUnit-MockObject.spec
@@ -135,7 +135,7 @@ EOF
: 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 php71 php72 php73 php74; do
if which $cmd; then
$cmd -d include_path=.:%{buildroot}%{php_home}:%{php_home} \
%{_bindir}/phpunit --no-coverage || ret=1
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()) {