Exemplo n.º 1
0
 protected function _setAdditionalExpectations()
 {
     $this->_dataHelper->expects($this->once())->method('getDisabledCacheTypes')->will($this->returnValue($this->_cacheTypes));
     $this->_cacheManager->expects($this->at(0))->method('canUse')->with('type1')->will($this->returnValue(true));
     $this->_cacheManager->expects($this->at(1))->method('banUse')->with('type1')->will($this->returnSelf());
     $this->_cacheManager->expects($this->at(2))->method('canUse')->with('type2')->will($this->returnValue(true));
     $this->_cacheManager->expects($this->at(3))->method('banUse')->with('type2')->will($this->returnSelf());
 }
Exemplo n.º 2
0
 /**
  * Test handle method with exception.
  */
 public function testHandleWithException()
 {
     /** Mock cache canUse method to return false. */
     $this->_cacheMock->expects($this->once())->method('canUse')->will($this->returnValue(false));
     $requestedResources = array('res1' => 'v1');
     $exception = new LogicException('getResourceDataMerged Exception');
     $this->_resourceConfigMock->expects($this->once())->method('getResourceDataMerged')->will($this->throwException($exception));
     $this->setExpectedException('Mage_Webapi_Exception', 'getResourceDataMerged Exception', Mage_Webapi_Exception::HTTP_BAD_REQUEST);
     $this->_autoDiscover->handle($requestedResources, 'http://magento.host');
 }
Exemplo n.º 3
0
 /**
  * @covers Mage_Backend_Model_Menu_Config::getMenu
  */
 public function testGetMenuWhenCacheEnabledAndCleaned()
 {
     $xmlString = '<?xml version="1.0" encoding="utf-8"?><config><menu></menu></config>';
     $this->_appConfigMock->expects($this->any())->method('getModelInstance')->will($this->returnCallback(array($this, 'getModelInstance')));
     $this->_cacheInstanceMock->expects($this->any())->method('canUse')->will($this->returnValue(true));
     $this->_cacheInstanceMock->expects($this->exactly(1))->method('load')->will($this->returnValue(null));
     $this->_domDocumentMock->expects($this->exactly(1))->method('saveXML')->will($this->returnValue('<?xml version="1.0" encoding="utf-8"?><config><menu></menu></config>'));
     $this->_configMenuMock->expects($this->exactly(1))->method('getMergedConfig')->will($this->returnValue($this->_domDocumentMock));
     $this->_cacheInstanceMock->expects($this->exactly(1))->method('save')->with($this->equalTo($xmlString));
     $this->_model->getMenu();
 }