diff options
author | Remi Collet <remi@remirepo.net> | 2017-10-24 13:33:36 +0200 |
---|---|---|
committer | Remi Collet <remi@remirepo.net> | 2017-10-24 13:33:36 +0200 |
commit | ac4c0cc2049225302dba0e37cce9e3c7f3ae4c94 (patch) | |
tree | c3038045e946773630dbc229d737884efde7d331 | |
parent | 9744fd87fac0b1ea98e4563fe5d8cfc31b6f829c (diff) |
fix FTBFS from Koschei, add patch for PHP 7.2 from https://github.com/zendframework/zend-stdlib/pull/81
-rw-r--r-- | .gitignore | 8 | ||||
-rw-r--r-- | 81.patch | 68 | ||||
-rw-r--r-- | php-zendframework-zend-stdlib.spec | 36 |
3 files changed, 89 insertions, 23 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/81.patch b/81.patch new file mode 100644 index 0000000..c90600d --- /dev/null +++ b/81.patch @@ -0,0 +1,68 @@ +From 5c2f528c5e3b775b960adc128efc7717ff2db64c Mon Sep 17 00:00:00 2001 +From: Remi Collet <remi@remirepo.net> +Date: Tue, 24 Oct 2017 10:49:02 +0200 +Subject: [PATCH] Fix testCount for PHP 7.2 + +PHP 7.2 raise a deprecated message + Parameter must be an array or an object that implements Countable + +I think this should not be hidden (count could take care of this), +so this change declare the message as expected. + +A new test is added for object which are really countable +--- + test/ArrayObjectTest.php | 12 ++++++++++++ + test/TestAsset/ArrayObjectObjectCount.php | 17 +++++++++++++++++ + 2 files changed, 29 insertions(+) + create mode 100644 test/TestAsset/ArrayObjectObjectCount.php + +diff --git a/test/ArrayObjectTest.php b/test/ArrayObjectTest.php +index b09cab7e..1ab3e97b 100644 +--- a/test/ArrayObjectTest.php ++++ b/test/ArrayObjectTest.php +@@ -103,10 +103,22 @@ public function testAsort() + + public function testCount() + { ++ if (version_compare(PHP_VERSION, '7.2', '>=')) { ++ $this->setExpectedException( ++ 'PHPUnit_Framework_Error_Warning', ++ 'Parameter must be an array or an object that implements Countable' ++ ); ++ } + $ar = new ArrayObject(new TestAsset\ArrayObjectObjectVars()); + $this->assertEquals(1, $ar->count()); + } + ++ public function testCountable() ++ { ++ $ar = new ArrayObject(new TestAsset\ArrayObjectObjectCount()); ++ $this->assertEquals(42, $ar->count()); ++ } ++ + public function testExchangeArray() + { + $ar = new ArrayObject(['foo' => 'bar']); +diff --git a/test/TestAsset/ArrayObjectObjectCount.php b/test/TestAsset/ArrayObjectObjectCount.php +new file mode 100644 +index 00000000..7b40dbee +--- /dev/null ++++ b/test/TestAsset/ArrayObjectObjectCount.php +@@ -0,0 +1,17 @@ ++<?php ++/** ++ * Zend Framework (http://framework.zend.com/) ++ * ++ * @link http://github.com/zendframework/zf2 for the canonical source repository ++ * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) ++ * @license http://framework.zend.com/license/new-bsd New BSD License ++ */ ++ ++namespace ZendTest\Stdlib\TestAsset; ++ ++class ArrayObjectObjectCount implements \Countable ++{ ++ public function count() { ++ return 42; ++ } ++} diff --git a/php-zendframework-zend-stdlib.spec b/php-zendframework-zend-stdlib.spec index c1d226a..c9e0732 100644 --- a/php-zendframework-zend-stdlib.spec +++ b/php-zendframework-zend-stdlib.spec @@ -21,7 +21,7 @@ Name: php-%{gh_owner}-%{gh_project} Version: 3.1.0 -Release: 1%{?dist} +Release: 4%{?dist} Summary: Zend Framework %{library} component Group: Development/Libraries @@ -30,7 +30,8 @@ URL: https://zendframework.github.io/%{gh_project}/ Source0: %{gh_commit}/%{name}-%{version}-%{gh_short}.tgz Source1: makesrc.sh -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root +Patch0: https://patch-diff.githubusercontent.com/raw/zendframework/zend-stdlib/pull/81.patch + BuildArch: noarch # Tests %if %{with_tests} @@ -87,6 +88,7 @@ Documentation: https://zendframework.github.io/%{gh_project}/ %prep %setup -q -n %{gh_project}-%{gh_commit} +%patch0 -p1 mv LICENSE.md LICENSE @@ -96,8 +98,6 @@ mv LICENSE.md LICENSE %install -rm -rf %{buildroot} - mkdir -p %{buildroot}%{php_home}/Zend/ cp -pr src %{buildroot}%{php_home}/Zend/%{library} @@ -117,33 +117,19 @@ Zend\Loader\AutoloaderFactory::factory(array( require_once '%{php_home}/Zend/autoload.php'; EOF -# remirepo:11 -run=0 ret=0 -if which php56; then - php56 %{_bindir}/phpunit --include-path=%{buildroot}%{php_home} || ret=1 - run=1 -fi -if which php71; then - php70 %{_bindir}/phpunit --include-path=%{buildroot}%{php_home} || ret=1 - run=1 -fi -if [ $run -eq 0 ]; then -%{_bindir}/phpunit --include-path=%{buildroot}%{php_home} --verbose -# remirepo:2 -fi +for cmd in php php56 php70 php71 php72; do + if which $cmd; then + $cmd %{_bindir}/phpunit --include-path=%{buildroot}%{php_home} --verbose || ret=1 + fi +done exit $ret %else : Test suite disabled %endif -%clean -rm -rf %{buildroot} - - %files -%defattr(-,root,root,-) %{!?_licensedir:%global license %%doc} %license LICENSE %doc *.md @@ -152,6 +138,10 @@ rm -rf %{buildroot} %changelog +* Tue Oct 24 2017 Remi Collet <remi@fedoraproject.org> - 3.1.0-4 +- fix FTBFS from Koschei, add patch for PHP 7.2 from + https://github.com/zendframework/zend-stdlib/pull/81 + * Tue Sep 13 2016 Remi Collet <remi@fedoraproject.org> - 3.1.0-1 - update to 3.1.0 - raise dependency on PHP >= 5.6 |