示例#1
0
 /**
  * Add list of nodes and their children to acl
  *
  * @param Magento_Acl $acl
  * @param DOMNodeList $resources
  * @param Magento_Acl_Resource $parent
  */
 protected function _addResourceTree(Magento_Acl $acl, DOMNodeList $resources, Magento_Acl_Resource $parent = null)
 {
     /** @var $resourceConfig DOMElement */
     foreach ($resources as $resourceConfig) {
         if (!$resourceConfig instanceof DOMElement) {
             continue;
         }
         /** @var $resource Magento_Acl_Resource */
         $resource = $this->_resourceFactory->createResource(array($resourceConfig->getAttribute('id')));
         $acl->addResource($resource, $parent);
         if ($resourceConfig->hasChildNodes()) {
             $this->_addResourceTree($acl, $resourceConfig->childNodes, $resource);
         }
     }
 }
示例#2
0
 public function testCreateResource()
 {
     $arguments = array('5', '6');
     $this->_objectManager->expects($this->once())->method('create')->with('Magento_Acl_Resource', $arguments, false)->will($this->returnValue($this->_expectedObject));
     $this->assertEquals($this->_expectedObject, $this->_model->createResource($arguments));
 }