예제 #1
0
 /**
  * Test for Mage_Webapi_Model_Authorization_Loader_Resource::populateAcl with invalid Virtual resources DOM
  */
 public function testPopulateAclWithInvalidDOM()
 {
     $this->_config->expects($this->once())->method('getAclVirtualResources')->will($this->returnValue(array(3)));
     $this->_acl->expects($this->once())->method('getResources')->will($this->returnValue(array('customer/get', 'customer/list')));
     $this->_acl->expects($this->exactly(2))->method('deny')->with(null, $this->logicalOr('customer/get', 'customer/list'));
     $this->_model->populateAcl($this->_acl);
 }
예제 #2
0
 /**
  * Test _prepareForm method
  *
  * @dataProvider prepareFormDataProvider
  * @param array $originResTree
  * @param array $selectedRes
  * @param array $expectedRes
  */
 public function testPrepareForm($originResTree, $selectedRes, $expectedRes)
 {
     // TODO Move to unit tests after MAGETWO-4015 complete
     $apiRole = new Varien_Object(array('role_id' => 1));
     $apiRole->setIdFieldName('role_id');
     $this->_block->setApiRole($apiRole);
     $this->_authorizationConfig->expects($this->once())->method('getAclResourcesAsArray')->with(false)->will($this->returnValue($originResTree));
     $this->_ruleResource->expects($this->once())->method('getResourceIdsByRole')->with($apiRole->getId())->will($this->returnValue($selectedRes));
     $this->_block->toHtml();
     $this->assertEquals($expectedRes, $this->_block->getResourcesTree());
 }