/** * Tests basic Role multiple inheritance * * @return void */ public function testRoleRegistryInheritsMultiple() { $roleParent1 = new Zend_Acl_Role('parent1'); $roleParent2 = new Zend_Acl_Role('parent2'); $roleChild = new Zend_Acl_Role('child'); $roleRegistry = new Zend_Acl_Role_Registry(); $roleRegistry->add($roleParent1)->add($roleParent2)->add($roleChild, array($roleParent1, $roleParent2)); $roleChildParents = $roleRegistry->getParents($roleChild); $this->assertTrue(2 === count($roleChildParents)); $i = 1; foreach ($roleChildParents as $roleParentId => $roleParent) { $this->assertTrue("parent{$i}" === $roleParentId); $i++; } $this->assertTrue($roleRegistry->inherits($roleChild, $roleParent1)); $this->assertTrue($roleRegistry->inherits($roleChild, $roleParent2)); $roleRegistry->remove($roleParent1); $roleChildParents = $roleRegistry->getParents($roleChild); $this->assertTrue(1 === count($roleChildParents)); $this->assertTrue(isset($roleChildParents['parent2'])); $this->assertTrue($roleRegistry->inherits($roleChild, $roleParent2)); }