From d93ddcf5b67359ccb0a9a110f20f79308a67f026 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Mon, 19 Aug 2019 17:17:28 +0200 Subject: - update to 1.2.3 - add patch for PHP 7.4 from https://github.com/mockery/mockery/pull/993 --- 993.patch | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ php-mockery.spec | 17 +++++++++++---- 2 files changed, 79 insertions(+), 4 deletions(-) create mode 100644 993.patch diff --git a/993.patch b/993.patch new file mode 100644 index 0000000..1248e23 --- /dev/null +++ b/993.patch @@ -0,0 +1,66 @@ +From 077d174cf14ea2951dd49d9a3b8f1e5ae0309b89 Mon Sep 17 00:00:00 2001 +From: Remi Collet +Date: Mon, 19 Aug 2019 17:10:08 +0200 +Subject: [PATCH 1/2] don't use is_real which is deprecated in 7.4 + +--- + library/Mockery/Matcher/Type.php | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/library/Mockery/Matcher/Type.php b/library/Mockery/Matcher/Type.php +index dc189ab0..d81ce834 100644 +--- a/library/Mockery/Matcher/Type.php ++++ b/library/Mockery/Matcher/Type.php +@@ -30,7 +30,11 @@ class Type extends MatcherAbstract + */ + public function match(&$actual) + { +- $function = 'is_' . strtolower($this->_expected); ++ if ($this->_expected == 'real') { ++ $function = 'is_float'; ++ } else { ++ $function = 'is_' . strtolower($this->_expected); ++ } + if (function_exists($function)) { + return $function($actual); + } elseif (is_string($this->_expected) + +From b06f129832b21f4ba70dd52cd0221cf8dc623bd1 Mon Sep 17 00:00:00 2001 +From: Remi Collet +Date: Mon, 19 Aug 2019 17:13:17 +0200 +Subject: [PATCH 2/2] real => float in test suite + +--- + tests/Mockery/ExpectationTest.php | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/tests/Mockery/ExpectationTest.php b/tests/Mockery/ExpectationTest.php +index e718015d..13774bfa 100644 +--- a/tests/Mockery/ExpectationTest.php ++++ b/tests/Mockery/ExpectationTest.php +@@ -1276,14 +1276,14 @@ public function testObjectConstraintThrowsExceptionWhenConstraintUnmatched() + + public function testRealConstraintMatchesArgument() + { +- $this->mock->shouldReceive('foo')->with(Mockery::type('real'))->once(); ++ $this->mock->shouldReceive('foo')->with(Mockery::type('float'))->once(); + $this->mock->foo(2.25); + } + + public function testRealConstraintNonMatchingCase() + { + $this->mock->shouldReceive('foo')->times(3); +- $this->mock->shouldReceive('foo')->with(1, Mockery::type('real'))->never(); ++ $this->mock->shouldReceive('foo')->with(1, Mockery::type('float'))->never(); + $this->mock->foo(); + $this->mock->foo(1); + $this->mock->foo(1, 2, 3); +@@ -1291,7 +1291,7 @@ public function testRealConstraintNonMatchingCase() + + public function testRealConstraintThrowsExceptionWhenConstraintUnmatched() + { +- $this->mock->shouldReceive('foo')->with(Mockery::type('real')); ++ $this->mock->shouldReceive('foo')->with(Mockery::type('float')); + $this->expectException(\Mockery\Exception::class); + $this->mock->foo('f'); + Mockery::close(); diff --git a/php-mockery.spec b/php-mockery.spec index de799de..2adae20 100644 --- a/php-mockery.spec +++ b/php-mockery.spec @@ -7,7 +7,7 @@ # # Please preserve changelog entries # -%global gh_commit 0eb0b48c3f07b3b89f5169ce005b7d05b18cf1d2 +%global gh_commit 4eff936d83eb809bde2c57a3cea0ee9643769031 %global gh_short %(c=%{gh_commit}; echo ${c:0:7}) %global gh_owner mockery %global gh_project mockery @@ -16,7 +16,7 @@ %global with_tests 0%{!?_without_tests:1} Name: php-mockery -Version: 1.2.2 +Version: 1.2.3 Release: 1%{?dist} Summary: Mockery is a simple but flexible PHP mock object framework @@ -26,6 +26,8 @@ Source0: https://github.com/%{gh_owner}/%{gh_project}/archive/%{gh_commit # Use our autoloader Patch0: %{gh_project}-tests.patch +# For 7.4 +Patch1: https://patch-diff.githubusercontent.com/raw/mockery/mockery/pull/993.patch BuildArch: noarch %if %{with_tests} @@ -91,6 +93,7 @@ cat << 'EOF' | tee -a library/%{ns_project}/autoload.php EOF %patch0 -p0 -b .rpm +%patch1 -p1 rm -f docs/.gitignore @@ -111,9 +114,10 @@ export COMPOSER_VENDOR_DIR=%{buildroot}%{_datadir}/php/%{ns_project}%{major} phpab --output tests/classmap.php --exclude */SemiReservedWordsAsMethods.php tests/Mockery +# TODO 7.4 Function is_real() is deprecated : Run upstream test suite ret=0 -for cmd in "php %{phpunit}" "php70 %{_bindir}/phpunit6" "php71 %{_bindir}/phpunit7" php72 php73; do +for cmd in "php %{phpunit}" "php71 %{_bindir}/phpunit7" php72 php73 php74; do if which $cmd; then set $cmd # see .travis.yml @@ -123,7 +127,7 @@ for cmd in "php %{phpunit}" "php70 %{_bindir}/phpunit6" "php71 %{_bindir}/phpuni fi $1 ${2:-%{_bindir}/phpunit8} \ --no-coverage \ - --verbose --testsuite="$SUITE" + --verbose --testsuite="$SUITE" || ret=1 fi done exit $ret @@ -140,6 +144,11 @@ exit $ret %changelog +* Mon Aug 19 2019 Remi Collet - 1.2.3-1 +- update to 1.2.3 +- add patch for PHP 7.4 from + https://github.com/mockery/mockery/pull/993 + * Wed Feb 13 2019 Remi Collet - 1.2.2-1 - update to 1.2.2 -- cgit