当前位置: 首页>>代码示例>>PHP>>正文


PHP Zend_Controller_Request_Abstract::expects方法代码示例

本文整理汇总了PHP中Zend_Controller_Request_Abstract::expects方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Controller_Request_Abstract::expects方法的具体用法?PHP Zend_Controller_Request_Abstract::expects怎么用?PHP Zend_Controller_Request_Abstract::expects使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Zend_Controller_Request_Abstract的用法示例。


在下文中一共展示了Zend_Controller_Request_Abstract::expects方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testQuickCreateActionWithDangerRequest

 /**
  * Test for Mage_Adminhtml_Catalog_ProductController::quickCreateAction
  */
 public function testQuickCreateActionWithDangerRequest()
 {
     $data = array('entity_id' => 234);
     $this->_request->expects($this->any())->method('getParam')->will($this->returnValue($data));
     $typeInstance = $this->getMockBuilder('Mage_Catalog_Model_Product_Type')->setMethods(array('getConfigurableAttributes', 'getEditableAttributes'))->getMock();
     $typeInstance->expects($this->any())->method('getEditableAttributes')->will($this->returnValue(array()));
     $typeInstance->expects($this->any())->method('getConfigurableAttributes')->will($this->returnValue(array()));
     $productMock = $this->getMockBuilder('Mage_Catalog_Model_Product')->setMethods(array('getIdFieldName', 'save', 'getSku', 'isConfigurable', 'setStoreId', 'load', 'setTypeId', 'setAttributeSetId', 'getAttributeSetId', 'getTypeInstance', 'getWebsiteIds'))->disableOriginalConstructor()->getMock();
     $productMock->expects($this->any())->method('getIdFieldName')->will($this->returnValue('entity_id'));
     $productMock->expects($this->any())->method('isConfigurable')->will($this->returnValue(true));
     $productMock->expects($this->any())->method('setStoreId')->will($this->returnSelf());
     $productMock->expects($this->any())->method('load')->will($this->returnSelf());
     $productMock->expects($this->any())->method('setTypeId')->will($this->returnSelf());
     $productMock->expects($this->any())->method('setAttributeSetId')->will($this->returnSelf());
     $productMock->expects($this->any())->method('getTypeInstance')->will($this->returnValue($typeInstance));
     $productMock->expects($this->never())->method('save');
     $this->_response->expects($this->once())->method('setBody')->with('{"attributes":[],"error":{"message":"Unable to create product"}}');
     $helper = $this->getMockBuilder('Mage_Core_Helper_Data')->setMethods(array('jsonEncode'))->getMock();
     $helper->expects($this->once())->method('jsonEncode')->with(array('attributes' => array(), 'error' => array('message' => 'Unable to create product', 'fields' => array('sku' => ''))))->will($this->returnValue('{"attributes":[],"error":{"message":"Unable to create product"}}'));
     $this->_objectManager->expects($this->any())->method('create')->with('Mage_Catalog_Model_Product', array(), true)->will($this->returnValue($productMock));
     $this->_objectManager->expects($this->any())->method('get')->with('Mage_Core_Helper_Data', array())->will($this->returnValue($helper));
     $this->_controller->quickCreateAction();
 }
开发者ID:nickimproove,项目名称:magento2,代码行数:26,代码来源:ProductControllerTest.php


注:本文中的Zend_Controller_Request_Abstract::expects方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。