From 00a97b6dc7c70fb8bf1ca3f69d0607f02d7356e0 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Tue, 31 Oct 2017 13:01:54 +0100 Subject: fix FTBFS from Koschei, add patch for tests with PHP 7.2 https://github.com/zendframework/zend-permissions-rbac/pull/31 --- .gitignore | 8 ++++ 31.patch | 67 ++++++++++++++++++++++++++++ composer.json | 35 +++++++++++++++ php-zendframework-zend-permissions-rbac.spec | 31 ++++++------- 4 files changed, 126 insertions(+), 15 deletions(-) create mode 100644 .gitignore create mode 100644 31.patch create mode 100644 composer.json 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/31.patch b/31.patch new file mode 100644 index 0000000..5bc443a --- /dev/null +++ b/31.patch @@ -0,0 +1,67 @@ +From 2cc86d0181dc3d05bbf7d4830a219e7ad5f3f954 Mon Sep 17 00:00:00 2001 +From: Remi Collet +Date: Tue, 31 Oct 2017 12:35:53 +0100 +Subject: [PATCH 1/2] Fix test (and count usage with 7.2) + +--- + test/RbacTest.php | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/test/RbacTest.php b/test/RbacTest.php +index 1c387e25..5bd364db 100644 +--- a/test/RbacTest.php ++++ b/test/RbacTest.php +@@ -136,7 +136,8 @@ public function testAddRoleWithParentsUsingRbac() + $this->rbac->addRole($bar, $foo); + + $this->assertEquals($bar->getParent(), $foo); +- $this->assertEquals(1, count($foo->getChildren())); ++ $this->assertEquals($foo->getChildren(), $bar); ++ $this->assertInstanceOf('Zend\Permissions\Rbac\Role', $foo->getChildren()); + } + + public function testAddRoleWithAutomaticParentsUsingRbac() +@@ -148,7 +149,8 @@ public function testAddRoleWithAutomaticParentsUsingRbac() + $this->rbac->addRole($bar, $foo); + + $this->assertEquals($bar->getParent(), $foo); +- $this->assertEquals(1, count($foo->getChildren())); ++ $this->assertEquals($foo->getChildren(), $bar); ++ $this->assertInstanceOf('Zend\Permissions\Rbac\Role', $foo->getChildren()); + } + + /** + +From 8e8a5ff205c78aaf343355424802da79f07504e3 Mon Sep 17 00:00:00 2001 +From: Remi Collet +Date: Tue, 31 Oct 2017 12:42:26 +0100 +Subject: [PATCH 2/2] also check hasChildren + +--- + test/RbacTest.php | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/test/RbacTest.php b/test/RbacTest.php +index 5bd364db..2326f109 100644 +--- a/test/RbacTest.php ++++ b/test/RbacTest.php +@@ -136,7 +136,9 @@ public function testAddRoleWithParentsUsingRbac() + $this->rbac->addRole($bar, $foo); + + $this->assertEquals($bar->getParent(), $foo); ++ $this->assertTrue($foo->hasChildren()); + $this->assertEquals($foo->getChildren(), $bar); ++ $this->assertFalse($bar->hasChildren()); + $this->assertInstanceOf('Zend\Permissions\Rbac\Role', $foo->getChildren()); + } + +@@ -149,7 +151,9 @@ public function testAddRoleWithAutomaticParentsUsingRbac() + $this->rbac->addRole($bar, $foo); + + $this->assertEquals($bar->getParent(), $foo); ++ $this->assertTrue($foo->hasChildren()); + $this->assertEquals($foo->getChildren(), $bar); ++ $this->assertFalse($bar->hasChildren()); + $this->assertInstanceOf('Zend\Permissions\Rbac\Role', $foo->getChildren()); + } + diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..4837780 --- /dev/null +++ b/composer.json @@ -0,0 +1,35 @@ +{ + "name": "zendframework/zend-permissions-rbac", + "description": "provides a role-based access control management", + "license": "BSD-3-Clause", + "keywords": [ + "zf2", + "Rbac" + ], + "homepage": "https://github.com/zendframework/zend-permissions-rbac", + "autoload": { + "psr-4": { + "Zend\\Permissions\\Rbac\\": "src/" + } + }, + "require": { + "php": ">=5.3.23" + }, + "minimum-stability": "dev", + "prefer-stable": true, + "extra": { + "branch-alias": { + "dev-master": "2.5-dev", + "dev-develop": "2.6-dev" + } + }, + "autoload-dev": { + "psr-4": { + "ZendTest\\Permissions\\Rbac\\": "test/" + } + }, + "require-dev": { + "fabpot/php-cs-fixer": "1.7.*", + "phpunit/PHPUnit": "~4.0" + } +} \ No newline at end of file diff --git a/php-zendframework-zend-permissions-rbac.spec b/php-zendframework-zend-permissions-rbac.spec index 1478932..5a1119d 100644 --- a/php-zendframework-zend-permissions-rbac.spec +++ b/php-zendframework-zend-permissions-rbac.spec @@ -21,7 +21,7 @@ Name: php-%{gh_owner}-%{gh_project} Version: 2.5.1 -Release: 1%{?dist} +Release: 5%{?dist} Summary: Zend Framework Permissions/%{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-permissions-rbac/pull/31.patch + BuildArch: noarch # Tests %if %{with_tests} @@ -65,6 +66,7 @@ Documentation: https://zendframework.github.io/%{gh_project}/ %prep %setup -q -n %{gh_project}-%{gh_commit} +%patch0 -p1 mv LICENSE.md LICENSE @@ -74,8 +76,6 @@ mv LICENSE.md LICENSE %install -rm -rf %{buildroot} - mkdir -p %{buildroot}%{php_home}/Zend/Permissions cp -pr src %{buildroot}%{php_home}/Zend/Permissions/%{library} @@ -90,27 +90,24 @@ Zend\\Loader\\AutoloaderFactory::factory(array( 'Zend\\Loader\\StandardAutoloader' => array( 'namespaces' => array( 'ZendTest\\\\Permissions\\\\%{library}' => dirname(__DIR__).'/test/', - 'Zend\\\\Permissions\\\\%{library}' => '%{buildroot}%{php_home}/Zend/%{library}' + 'Zend\\\\Permissions\\\\%{library}' => '%{buildroot}%{php_home}/Zend/Permissions/%{library}' )))); require_once '%{php_home}/Zend/autoload.php'; EOF -%{_bindir}/phpunit --include-path=%{buildroot}%{php_home} - -if which php70; then - php70 %{_bindir}/phpunit --include-path=%{buildroot}%{php_home} -fi +ret=0 +for cmd in php php56 php70 php71 php72; do + if which $cmd; then + $cmd %{_bindir}/phpunit || 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 @@ -120,5 +117,9 @@ rm -rf %{buildroot} %changelog +* Tue Oct 31 2017 Remi Collet - 2.5.1-5 +- fix FTBFS from Koschei, add patch for tests with PHP 7.2 + https://github.com/zendframework/zend-permissions-rbac/pull/31 + * Tue Aug 4 2015 Remi Collet - 2.5.1-1 - initial package -- cgit