public function testGetTree()
 {
     $resources = ['resource1', 'resource2', 'resource3'];
     $mappedResources = ['mapped1', 'mapped2', 'mapped3'];
     $this->aclResourceProviderMock->expects($this->once())->method('getAclResources')->willReturn($resources);
     $this->integrationDataMock->expects($this->once())->method('mapResources')->willReturn($mappedResources);
     $this->assertEquals($mappedResources, $this->model->getTree());
 }
Example #2
0
 /**
  * Initialize Integration edit page
  *
  * @return void
  */
 protected function _construct()
 {
     $this->_controller = 'adminhtml_integration';
     $this->_blockGroup = 'Magento_Integration';
     parent::_construct();
     $this->buttonList->remove('reset');
     $this->buttonList->remove('delete');
     if ($this->_integrationHelper->isConfigType($this->_registry->registry(Integration::REGISTRY_KEY_CURRENT_INTEGRATION))) {
         $this->buttonList->remove('save');
     }
     if ($this->_isNewIntegration()) {
         $this->removeButton('save')->addButton('save', array('id' => 'save-split-button', 'label' => __('Save'), 'class_name' => 'Magento\\Backend\\Block\\Widget\\Button\\SplitButton', 'button_class' => '', 'data_attribute' => array('mage-init' => array('button' => array('event' => 'save', 'target' => '#edit_form'))), 'options' => array('save_activate' => array('id' => 'activate', 'label' => __('Save & Activate'), 'data_attribute' => array('mage-init' => array('button' => array('event' => 'saveAndActivate', 'target' => '#edit_form'), 'integration' => array('gridUrl' => $this->getUrl('*/*/'))))))));
     }
 }
 public function testGetTree()
 {
     $this->webapiBlock = $this->getWebapiBlock();
     $resources = [1 => ['children' => [1, 2, 3]]];
     $this->aclResourceProvider->expects($this->once())->method('getAclResources')->will($this->returnValue($resources));
     $rootArray = "rootArrayValue";
     $this->integrationHelper->expects($this->once())->method('mapResources')->with([1, 2, 3])->will($this->returnValue($rootArray));
     $this->assertEquals($rootArray, $this->webapiBlock->getTree());
 }
Example #4
0
 /**
  * Get Json Representation of Resource Tree
  *
  * @return array
  */
 public function getTree()
 {
     $resources = $this->aclResourceProvider->getAclResources();
     $rootArray = $this->integrationData->mapResources(isset($resources[1]['children']) ? $resources[1]['children'] : []);
     return $rootArray;
 }
Example #5
0
 /**
  * Get requested permissions tree.
  *
  * @return string
  */
 public function getResourcesTreeJson()
 {
     $resources = $this->_resourceProvider->getAclResources();
     $aclResourcesTree = $this->_integrationData->mapResources($resources[1]['children']);
     return $this->encoder->encode($aclResourcesTree);
 }
Example #6
0
 /**
  * @dataProvider integrationDataProvider
  */
 public function testIsConfigType($integrationsData, $expectedResult)
 {
     $this->assertEquals($expectedResult, $this->dataHelper->isConfigType($integrationsData));
 }