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


PHP Observer::addAdditionalFieldsToResponseFrontend方法代码示例

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


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

示例1: testAddAdditionalFieldsToResponseFrontend

 public function testAddAdditionalFieldsToResponseFrontend()
 {
     $directpostRequest = $this->getMock('Magento\\Authorizenet\\Model\\Directpost\\Request', array());
     $order = $this->getMock('Magento\\Sales\\Model\\Order', array(), array(), '', false);
     $methodInstance = $this->getMock('Magento\\Authorizenet\\Model\\Directpost', array(), array(), '', false);
     $methodInstance->expects($this->once())->method('generateRequestFromOrder')->with($this->identicalTo($order))->will($this->returnValue($directpostRequest));
     $payment = $this->getMock('Magento\\Sales\\Model\\Order\\Payment', array('getMethodInstance', '__wakeup'), array(), '', false);
     $payment->expects($this->once())->method('getMethodInstance')->will($this->returnValue($methodInstance));
     $payment->setMethod('authorizenet_directpost');
     $order->expects($this->once())->method('getId')->will($this->returnValue(1));
     $order->expects($this->atLeastOnce())->method('getPayment')->will($this->returnValue($payment));
     $this->coreRegistry->expects($this->once())->method('registry')->with('directpost_order')->will($this->returnValue($order));
     $request = new \Magento\Framework\Object();
     $response = $this->getMock('Magento\\Framework\\App\\Response\\Http', array(), array(), '', false);
     $controller = $this->getMock('Magento\\Checkout\\Controller\\Action', array('getRequest', 'getResponse'), array(), '', false);
     $controller->expects($this->once())->method('getRequest')->will($this->returnValue($request));
     $controller->expects($this->once())->method('getResponse')->will($this->returnValue($response));
     $observer = new \Magento\Framework\Event\Observer(array('event' => new \Magento\Framework\Object(array('controller_action' => $controller))));
     $this->coreData->expects($this->once())->method('jsonEncode')->with(self::logicalNot(self::isEmpty()))->will($this->returnValue('encoded response'));
     $response->expects($this->once())->method('clearHeader')->with('Location');
     $response->expects($this->once())->method('representJson')->with('encoded response');
     $this->model->addAdditionalFieldsToResponseFrontend($observer);
 }
开发者ID:buskamuza,项目名称:magento2-skeleton,代码行数:23,代码来源:ObserverTest.php


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