示例#1
0
 protected function setUp()
 {
     $this->_helper = new Magento_Test_Helper_ObjectManager($this);
     $this->_objectManager = $this->getMockBuilder('Magento_ObjectManager')->disableOriginalConstructor()->setMethods(array('create'))->getMockForAbstractClass();
     $this->_roleResource = $this->getMockBuilder('Mage_Webapi_Model_Resource_Acl_Role')->disableOriginalConstructor()->setMethods(array('getIdFieldName', 'getReadConnection'))->getMock();
     $this->_roleResource->expects($this->any())->method('getIdFieldName')->withAnyParameters()->will($this->returnValue('id'));
     $this->_roleResource->expects($this->any())->method('getReadConnection')->withAnyParameters()->will($this->returnValue($this->getMock('Varien_Db_Adapter_Pdo_Mysql', array(), array(), '', false)));
 }
示例#2
0
 /**
  * Test for Mage_Webapi_Model_Authorization_Loader_Role::populateAcl
  *
  * Test with No existing role Ids
  */
 public function testPopulateAclWithNoRoles()
 {
     $this->_resourceModelMock->expects($this->once())->method('getRolesIds')->will($this->returnValue(array()));
     $this->_roleFactory->expects($this->never())->method('createRole');
     $this->_acl->expects($this->never())->method('addRole');
     $this->_acl->expects($this->never())->method('deny');
     $this->_model->populateAcl($this->_acl);
 }