/** * Reader object initialization. * * @return Magento_Acl_Config_Reader */ protected function _getReader() { if (is_null($this->_reader)) { $aclResourceFiles = $this->_getAclResourceFiles(); $this->_reader = $this->_readerFactory->createReader(array($aclResourceFiles)); } return $this->_reader; }
/** * Set up before test */ protected function setUp() { $helper = new Magento_Test_Helper_ObjectManager($this); $this->_config = $this->getMockBuilder('Mage_Core_Model_Config')->disableOriginalConstructor()->setMethods(array('getModuleConfigurationFiles'))->getMock(); $this->_readerFactory = $this->getMockBuilder('Mage_Webapi_Model_Authorization_Config_Reader_Factory')->disableOriginalConstructor()->setMethods(array('createReader'))->getMock(); $this->_configReader = $this->getMockBuilder('Magento_Acl_Config_Reader')->disableOriginalConstructor()->setMethods(array('getAclResources'))->getMock(); $this->_model = $helper->getModel('Mage_Webapi_Model_Authorization_Config', array('config' => $this->_config, 'readerFactory' => $this->_readerFactory)); $this->_config->expects($this->any())->method('getModuleConfigurationFiles')->will($this->returnValue(array())); $this->_readerFactory->expects($this->any())->method('createReader')->will($this->returnValue($this->_configReader)); }
public function testCreateReader() { $arguments = array('5', '6'); $this->_objectManager->expects($this->once())->method('create')->with('Mage_Webapi_Model_Authorization_Config_Reader', $arguments, false)->will($this->returnValue($this->_expectedObject)); $this->assertEquals($this->_expectedObject, $this->_model->createReader($arguments)); }