diff options
| -rw-r--r-- | .gitignore | 8 | ||||
| -rw-r--r-- | 798.patch | 96 | ||||
| -rw-r--r-- | b2f20b33942c2c84bc3b3b169098b448b3e66737.patch | 23 | ||||
| -rw-r--r-- | php-deepend-Mockery.spec | 21 | 
4 files changed, 137 insertions, 11 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..fc9aa8c --- /dev/null +++ b/.gitignore @@ -0,0 +1,8 @@ +clog +package-*.xml +*.tgz +*.tar.gz +*.tar.xz +*.tar.xz.asc +*.src.rpm +*/*rpm diff --git a/798.patch b/798.patch new file mode 100644 index 0000000..c394c24 --- /dev/null +++ b/798.patch @@ -0,0 +1,96 @@ +From ebcef93d662613c48eb8f9b53470992a66aaca9c Mon Sep 17 00:00:00 2001 +From: Remi Collet <remi@remirepo.net> +Date: Fri, 6 Oct 2017 14:51:05 +0200 +Subject: [PATCH 1/2] fix for 7.2 + +--- + tests/Mockery/DemeterChainTest.php | 2 +- + tests/Mockery/ExpectationTest.php  | 6 +++--- + 2 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/tests/Mockery/DemeterChainTest.php b/tests/Mockery/DemeterChainTest.php +index 9767f1ee..deed5eef 100644 +--- a/tests/Mockery/DemeterChainTest.php ++++ b/tests/Mockery/DemeterChainTest.php +@@ -28,7 +28,7 @@ class DemeterChainTest extends MockeryTestCase +  +     public function setUp() +     { +-        $this->mock = $this->mock = Mockery::mock('object')->shouldIgnoreMissing(); ++        $this->mock = $this->mock = Mockery::mock('stdClass')->shouldIgnoreMissing(); +     } +  +     public function tearDown() +diff --git a/tests/Mockery/ExpectationTest.php b/tests/Mockery/ExpectationTest.php +index c3c31993..6d1ddf4d 100644 +--- a/tests/Mockery/ExpectationTest.php ++++ b/tests/Mockery/ExpectationTest.php +@@ -1238,7 +1238,7 @@ public function testNumericConstraintThrowsExceptionWhenConstraintUnmatched() +  +     public function testObjectConstraintMatchesArgument() +     { +-        $this->mock->shouldReceive('foo')->with(Mockery::type('object'))->once(); ++        $this->mock->shouldReceive('foo')->with(Mockery::type('stdClass'))->once(); +         $this->mock->foo(new stdClass); +         $this->container->mockery_verify(); +     } +@@ -1246,7 +1246,7 @@ public function testObjectConstraintMatchesArgument() +     public function testObjectConstraintNonMatchingCase() +     { +         $this->mock->shouldReceive('foo')->times(3); +-        $this->mock->shouldReceive('foo')->with(1, Mockery::type('object`'))->never(); ++        $this->mock->shouldReceive('foo')->with(1, Mockery::type('stdClass`'))->never(); +         $this->mock->foo(); +         $this->mock->foo(1); +         $this->mock->foo(1, 2, 3); +@@ -1258,7 +1258,7 @@ public function testObjectConstraintNonMatchingCase() +      */ +     public function testObjectConstraintThrowsExceptionWhenConstraintUnmatched() +     { +-        $this->mock->shouldReceive('foo')->with(Mockery::type('object'))->once(); ++        $this->mock->shouldReceive('foo')->with(Mockery::type('stdClass'))->once(); +         $this->mock->foo('f'); +         $this->container->mockery_verify(); +     } + +From fe282c1ac52b127e4b8a66e9d46fb1edae1de8c7 Mon Sep 17 00:00:00 2001 +From: Remi Collet <remi@remirepo.net> +Date: Fri, 6 Oct 2017 15:03:10 +0200 +Subject: [PATCH 2/2] change mocked class to avoid Mockery/DateTimeZone.php not + found + +--- + library/Mockery/Loader/EvalLoader.php | 1 - + tests/Mockery/NamedMockTest.php       | 4 ++-- + 2 files changed, 2 insertions(+), 3 deletions(-) + +diff --git a/library/Mockery/Loader/EvalLoader.php b/library/Mockery/Loader/EvalLoader.php +index b9d172af..0fb62117 100644 +--- a/library/Mockery/Loader/EvalLoader.php ++++ b/library/Mockery/Loader/EvalLoader.php +@@ -12,7 +12,6 @@ public function load(MockDefinition $definition) +         if (class_exists($definition->getClassName(), false)) { +             return; +         } +- +         eval("?>" . $definition->getCode()); +     } + } +diff --git a/tests/Mockery/NamedMockTest.php b/tests/Mockery/NamedMockTest.php +index 28920072..28dd2fdd 100644 +--- a/tests/Mockery/NamedMockTest.php ++++ b/tests/Mockery/NamedMockTest.php +@@ -33,11 +33,11 @@ public function itCreatesANamedMock() +     /** @test */ +     public function itCreatesPassesFurtherArgumentsJustLikeMock() +     { +-        $mock = Mockery::namedMock("Mockery\Dave456", "DateTime", array( ++        $mock = Mockery::namedMock("Mockery\Dave456", "DateTimeZone", array( +             "getDave" => "dave" +         )); +  +-        $this->assertInstanceOf("DateTime", $mock); ++        $this->assertInstanceOf("DateTimeZone", $mock); +         $this->assertEquals("dave", $mock->getDave()); +     } +  diff --git a/b2f20b33942c2c84bc3b3b169098b448b3e66737.patch b/b2f20b33942c2c84bc3b3b169098b448b3e66737.patch new file mode 100644 index 0000000..f1e4055 --- /dev/null +++ b/b2f20b33942c2c84bc3b3b169098b448b3e66737.patch @@ -0,0 +1,23 @@ +From b2f20b33942c2c84bc3b3b169098b448b3e66737 Mon Sep 17 00:00:00 2001 +From: Craig Duncan <git@duncanc.co.uk> +Date: Fri, 7 Apr 2017 09:43:56 +0100 +Subject: [PATCH] Avoid warnings in PHP 7.2 from count() + +--- + library/Mockery/Expectation.php | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/library/Mockery/Expectation.php b/library/Mockery/Expectation.php +index bccf82ec..b215890c 100644 +--- a/library/Mockery/Expectation.php ++++ b/library/Mockery/Expectation.php +@@ -310,7 +310,8 @@ public function matchArgs(array $args) +         if (empty($this->_expectedArgs) && !$this->_noArgsExpectation) { +             return true; +         } +-        if (count($args) !== count($this->_expectedArgs)) { ++        $expected = is_array($this->_expectedArgs) ? count($this->_expectedArgs) : 0; ++        if (count($args) !== $expected) { +             return false; +         } +         $argCount = count($args); diff --git a/php-deepend-Mockery.spec b/php-deepend-Mockery.spec index c8435ef..818a9bd 100644 --- a/php-deepend-Mockery.spec +++ b/php-deepend-Mockery.spec @@ -15,7 +15,7 @@  Name:           php-deepend-Mockery  Version:        0.9.9 -Release:        1%{?dist} +Release:        4%{?dist}  Summary:        Mockery is a simple but flexible PHP mock object framework  Group:          Development/Libraries @@ -28,8 +28,9 @@ Source1:        %{gh_project}-autoload.php  # Use our autoloader  Patch0:         %{gh_project}-tests.patch - -BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) +# Upstream patch for 7.2 +Patch1:         https://github.com/mockery/mockery/commit/b2f20b33942c2c84bc3b3b169098b448b3e66737.patch +Patch2:         https://patch-diff.githubusercontent.com/raw/mockery/mockery/pull/798.patch  BuildArch:      noarch  %if %{with_tests} @@ -75,6 +76,8 @@ To use this library, you just have to add, in your project:  cp %{SOURCE1} library/Mockery/autoload.php  %patch0 -p0 -b .rpm +%patch1 -p1 +%patch2 -p1  %build @@ -82,16 +85,10 @@ cp %{SOURCE1} library/Mockery/autoload.php  %install -rm -rf %{buildroot} -  mkdir -p %{buildroot}/%{_datadir}/php  cp -rp library/* %{buildroot}/%{_datadir}/php/ -%clean -rm -rf %{buildroot} - -  %check  %if %{with_tests}  : Use installed tree and our autoloader @@ -99,7 +96,7 @@ sed -e 's:@BUILD@:%{buildroot}/%{_datadir}/php:' -i tests/Bootstrap.php  : Run upstream test suite  ret=0 -for cmd in php56 php70 php71 php; do +for cmd in php php56 php70 php71 php72; do     if which $cmd; then        $cmd %{_bindir}/phpunit --verbose || ret=1     fi @@ -116,7 +113,6 @@ fi  %files -%defattr(-,root,root,-)  %{!?_licensedir:%global license %%doc}  %license LICENSE  %doc README.md docs @@ -126,6 +122,9 @@ fi  %changelog +* Fri Oct  6 2017 Remi Collet <remi@remirepo.net> - 0.9.9-4 +- add patches for PHP 7.2 +  * Tue Feb 28 2017 Remi Collet <remi@remirepo.net> - 0.9.9-1  - Update to 0.9.9  | 
