本文整理汇总了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();
}