Exemplo n.º 1
0
 /**
  * Tests basic Resource inheritance
  *
  * @return void
  */
 public function testResourceInherits()
 {
     $resourceCity = new Resource\GenericResource('city');
     $resourceBuilding = new Resource\GenericResource('building');
     $resourceRoom = new Resource\GenericResource('room');
     $this->_acl->addResource($resourceCity)->addResource($resourceBuilding, $resourceCity->getResourceId())->addResource($resourceRoom, $resourceBuilding);
     $this->assertTrue($this->_acl->inheritsResource($resourceBuilding, $resourceCity, true));
     $this->assertTrue($this->_acl->inheritsResource($resourceRoom, $resourceBuilding, true));
     $this->assertTrue($this->_acl->inheritsResource($resourceRoom, $resourceCity));
     $this->assertFalse($this->_acl->inheritsResource($resourceCity, $resourceBuilding));
     $this->assertFalse($this->_acl->inheritsResource($resourceBuilding, $resourceRoom));
     $this->assertFalse($this->_acl->inheritsResource($resourceCity, $resourceRoom));
     $this->_acl->removeResource($resourceBuilding);
     $this->assertFalse($this->_acl->hasResource($resourceRoom));
 }