Skip to content
This repository has been archived by the owner on Jul 3, 2020. It is now read-only.

Commit

Permalink
Fix ObjectRepositoryRoleProviderTest
Browse files Browse the repository at this point in the history
Use RecursiveRoleIterator to traverse children
  • Loading branch information
danizord committed Jan 13, 2014
1 parent aafda31 commit 3934e41
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion tests/ZfcRbacTest/Role/ObjectRepositoryRoleProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 3934e41

Please sign in to comment.