From 3934e413a68451f19bff112027ea1f65c307b417 Mon Sep 17 00:00:00 2001 From: Daniel Gimenes Date: Mon, 13 Jan 2014 18:11:05 -0200 Subject: [PATCH] Fix ObjectRepositoryRoleProviderTest Use RecursiveRoleIterator to traverse children --- .../ZfcRbacTest/Role/ObjectRepositoryRoleProviderTest.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/ZfcRbacTest/Role/ObjectRepositoryRoleProviderTest.php b/tests/ZfcRbacTest/Role/ObjectRepositoryRoleProviderTest.php index 6f67110..02ed88e 100644 --- a/tests/ZfcRbacTest/Role/ObjectRepositoryRoleProviderTest.php +++ b/tests/ZfcRbacTest/Role/ObjectRepositoryRoleProviderTest.php @@ -19,6 +19,7 @@ namespace ZfcRbacTest\Role; use Doctrine\ORM\Tools\SchemaTool; +use Rbac\Traversal\RecursiveRoleIterator; use Zend\ServiceManager\ServiceManager; use ZfcRbac\Role\ObjectRepositoryRoleProvider; use ZfcRbacTest\Asset\FlatRole; @@ -95,7 +96,11 @@ public function testObjectRepositoryProviderForHierarchicalRole() $this->assertInstanceOf('Rbac\Role\HierarchicalRoleInterface', $roles[0]); $this->assertEquals('admin', $roles[0]->getName()); - $iteratorIterator = new \RecursiveIteratorIterator($roles[0], \RecursiveIteratorIterator::SELF_FIRST); + $iteratorIterator = new \RecursiveIteratorIterator( + new RecursiveRoleIterator($roles[0]->getChildren()), + \RecursiveIteratorIterator::SELF_FIRST + ); + $childRolesString = ''; foreach ($iteratorIterator as $childRole) {