Example #1
0
 /**
  * @covers Mage_Backend_Model_Menu_Config::getMenu
  */
 public function testGetMenuWhenEnabledCache()
 {
     $xmlString = '<?xml version="1.0" encoding="utf-8"?><config><menu></menu></config>';
     $this->_cacheInstanceMock->expects($this->any())->method('canUse')->with($this->equalTo('config'))->will($this->returnValue(true));
     $this->_cacheInstanceMock->expects($this->exactly(1))->method('load')->will($this->returnValue($xmlString));
     $this->_directorDomMock->expects($this->exactly(1))->method('buildMenu')->with($this->isInstanceOf('Mage_Backend_Model_Menu_Builder'));
     $this->_builderMock->expects($this->exactly(1))->method('getResult')->will($this->returnValue($this->getMock('Mage_Backend_Model_Menu', array(), array(), '', false)));
     $this->_model->getMenu();
     /*
      * Recall the same method to ensure that built menu cached in local protected property
      */
     $this->_model->getMenu();
 }
Example #2
0
 /**
  * @covers Mage_Backend_Model_Menu_Config::getMenu
  */
 public function testGetMenuWhenEnabledCache()
 {
     $xmlString = '<?xml version="1.0" encoding="utf-8"?><config><menu></menu></config>';
     $this->_cacheInstanceMock->expects($this->at(1))->method('load')->will($this->returnValue(false));
     $this->_cacheInstanceMock->expects($this->at(1))->method('load')->will($this->returnValue($xmlString));
     $this->_directorDomMock->expects($this->exactly(1))->method('buildMenu')->with($this->isInstanceOf('Mage_Backend_Model_Menu_Builder'));
     $this->_configMenuMock->expects($this->exactly(1))->method('getMergedConfig')->will($this->returnValue($this->_domDocumentMock));
     $this->_domDocumentMock->expects($this->exactly(1))->method('saveXML')->will($this->returnValue('<?xml version="1.0" encoding="utf-8"?><config><menu></menu></config>'));
     $this->_menuBuilderMock->expects($this->exactly(1))->method('getResult')->will($this->returnValue($this->_menuMock));
     $this->_model->getMenu();
     /*
      * Recall the same method to ensure that built menu cached in local protected property
      */
     $this->_model->getMenu();
 }
Example #3
0
 public function testCommandLogging()
 {
     $this->_loggerMock->expects($this->exactly(4))->method('log');
     $builder = $this->getMock('Mage_Backend_Model_Menu_Builder', array(), array(), '', false);
     $this->_model->buildMenu($builder);
 }