From d210f36ca7272332f0503d649b99fcebf22656c1 Mon Sep 17 00:00:00 2001
From: Remi Collet <fedora@famillecollet.com>
Date: Fri, 13 Jun 2014 14:01:20 +0200
Subject: php-phpunit-PHPUnit-MockObject: 2.1.4 + upstream patch

---
 php-phpunit-PHPUnit-MockObject.spec | 14 ++++++-
 phpunit-mock-objects-pr176.patch    | 82 +++++++++++++++++++++++++++++++++++++
 2 files changed, 94 insertions(+), 2 deletions(-)
 create mode 100644 phpunit-mock-objects-pr176.patch

diff --git a/php-phpunit-PHPUnit-MockObject.spec b/php-phpunit-PHPUnit-MockObject.spec
index ace917a..7ecc2c1 100644
--- a/php-phpunit-PHPUnit-MockObject.spec
+++ b/php-phpunit-PHPUnit-MockObject.spec
@@ -6,7 +6,7 @@
 #
 # Please, preserve the changelog entries
 #
-%global gh_commit    92f4b49d2cd4f2537db7ef969231f3d43c8da957
+%global gh_commit    1a894a16b6c15fcdc5ef2b110f0e6233952c9b0f
 %global gh_short     %(c=%{gh_commit}; echo ${c:0:7})
 %global gh_owner     sebastianbergmann
 %global gh_project   phpunit-mock-objects
@@ -17,7 +17,7 @@
 %global with_tests   %{?_with_tests:1}%{!?_with_tests:0}
 
 Name:           php-phpunit-PHPUnit-MockObject
-Version:        2.1.3
+Version:        2.1.4
 Release:        1%{?dist}
 Summary:        Mock Object library for PHPUnit
 
@@ -32,6 +32,9 @@ Source1:        Autoload.php.in
 # Temporary workaround, under investigation
 Patch0:         %{gh_project}-rpm.patch
 
+# https://github.com/sebastianbergmann/phpunit-mock-objects/pull/176
+Patch1:         %{gh_project}-pr176.patch
+
 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 BuildArch:      noarch
 BuildRequires:  %{_bindir}/phpab
@@ -60,6 +63,7 @@ Mock Object library for PHPUnit
 %setup -q -n %{gh_project}-%{gh_commit}
 
 %patch0 -p1
+%patch1 -p1
 
 find . -name \*.orig -exec rm {} \; -print
 
@@ -82,6 +86,7 @@ cp -pr src %{buildroot}%{php_home}/PHPUnit
 mkdir vendor
 ln -s ../src/Framework/MockObject/Autoload.php vendor/autoload.php
 
+grep -v 'log' phpunit.xml.dist > phpunit.xml
 phpunit \
   -d date.timezone=UTC
 %endif
@@ -107,6 +112,11 @@ fi
 
 
 %changelog
+* Thu Jun 12 2014 Remi Collet <remi@fedoraproject.org> - 2.1.4-1
+- update to 2.1.4
+- add upstream patch to fix unserialize issue
+  https://github.com/sebastianbergmann/phpunit-mock-objects/pull/176
+
 * Sat Jun  7 2014 Remi Collet <remi@fedoraproject.org> - 2.1.3-1
 - update to 2.1.3
 
diff --git a/phpunit-mock-objects-pr176.patch b/phpunit-mock-objects-pr176.patch
new file mode 100644
index 0000000..d13d836
--- /dev/null
+++ b/phpunit-mock-objects-pr176.patch
@@ -0,0 +1,82 @@
+From b49bdba40387a897d91ce24735437a8f2feab86e Mon Sep 17 00:00:00 2001
+From: Remi Collet <fedora@famillecollet.com>
+Date: Thu, 12 Jun 2014 09:03:05 +0200
+Subject: [PATCH 1/2] php 5.6 is not yet released, so use 5.6.0-dev here
+
+---
+ src/Framework/MockObject/Generator.php | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/Framework/MockObject/Generator.php b/src/Framework/MockObject/Generator.php
+index a24171a..b2d99b5 100644
+--- a/src/Framework/MockObject/Generator.php
++++ b/src/Framework/MockObject/Generator.php
+@@ -1105,7 +1105,7 @@ private function isInternalClass(ReflectionClass $class)
+     private function unserializeHackIsSupported()
+     {
+         if (PHP_VERSION == '5.4.29' || PHP_VERSION == '5.5.13' ||
+-            version_compare(PHP_VERSION, '5.6.0', '>=')) {
++            version_compare(PHP_VERSION, '5.6.0-dev', '>=')) {
+             return FALSE;
+         }
+ 
+-- 
+1.9.3
+
+
+From a7dfbd7aa63570a789e0bfaec15046071b33483a Mon Sep 17 00:00:00 2001
+From: Remi Collet <fedora@famillecollet.com>
+Date: Thu, 12 Jun 2014 09:08:22 +0200
+Subject: [PATCH 2/2] fix unzerialize regression in most of the case
+
+---
+ src/Framework/MockObject/Generator.php | 26 +++++---------------------
+ 1 file changed, 5 insertions(+), 21 deletions(-)
+
+diff --git a/src/Framework/MockObject/Generator.php b/src/Framework/MockObject/Generator.php
+index b2d99b5..7e2983c 100644
+--- a/src/Framework/MockObject/Generator.php
++++ b/src/Framework/MockObject/Generator.php
+@@ -274,15 +274,13 @@ protected function getObject($code, $className, $type = '', $callOriginalConstru
+             $class      = new ReflectionClass($className);
+             $isInternal = $this->isInternalClass($class);
+ 
+-            if ($isInternal && !$this->unserializeHackIsSupported()) {
+-                throw new PHPUnit_Framework_MockObject_RuntimeException(
+-                    'Internal classes cannot be mocked without invoking their constructor in PHP ' . PHP_VERSION
+-                );
+-            }
+-
+             if ($isInternal || !$hasNewInstanceWithoutConstructor) {
+                 $object = unserialize(
+-                    sprintf('O:%d:"%s":0:{}', strlen($className), $className)
++                    sprintf('%s:%d:"%s":0:{}',
++                        (version_compare(PHP_VERSION, '5.4', '>') && $class->implementsInterface("Serializable") ? "C" : "O"),
++                        strlen($className),
++                        $className
++                    )
+                 );
+             } else {
+                 $object = $class->newInstanceWithoutConstructor();
+@@ -1097,18 +1095,4 @@ private function isInternalClass(ReflectionClass $class)
+ 
+         return false;
+     }
+-
+-    /**
+-     * @return boolean
+-     * @since  Method available since Release 2.0.9
+-     */
+-    private function unserializeHackIsSupported()
+-    {
+-        if (PHP_VERSION == '5.4.29' || PHP_VERSION == '5.5.13' ||
+-            version_compare(PHP_VERSION, '5.6.0-dev', '>=')) {
+-            return FALSE;
+-        }
+-
+-        return TRUE;
+-    }
+ }
+-- 
+1.9.3
+
-- 
cgit