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


PHP Varien_Event::setOrder方法代码示例

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


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

示例1: testRedeemCard

 /**
  * Test redeeming gift cards that have been applied to an order - expecetd to
  * cover full total of order.
  */
 public function testRedeemCard()
 {
     // need to replace the checkout session to prevent errors when instantiating the gift card container
     $this->_replaceSession('checkout/session');
     $orderId = '5555555555';
     $container = Mage::getModel('ebayenterprise_giftcard/container');
     // set up a mock, unredeemed gift card - just want to ensure it is redeemed
     $cardToRedeem = $this->getModelMock('ebayenterprise_giftcard/giftcard', array('redeem'))->setCardNumber('1234')->setIsRedeemed(false)->setAmountRedeemed(5.0)->setAmountToRedeem(5.0);
     $cardToRedeem->expects($this->once())->method('redeem')->will($this->returnSelf());
     $container->updateGiftCard($cardToRedeem);
     $order = Mage::getModel('sales/order', array('increment_id' => $orderId));
     $this->_event->setOrder($order);
     Mage::getModel('ebayenterprise_giftcard/observer')->redeemGiftCards($this->_eventObserver);
     $this->assertSame($orderId, $cardToRedeem->getOrderId());
 }
开发者ID:WinstonN,项目名称:magento-retail-order-management,代码行数:19,代码来源:ObserverTest.php

示例2: testRedeemCard

 /**
  * Test redeeming gift cards that have been applied to an order - expecetd to
  * cover full total of order.
  */
 public function testRedeemCard()
 {
     $this->getModelMockBuilder('core/session_abstract')->disableOriginalConstructor()->setMethods(null)->getMock();
     // set up a mock, unredeemed gift card - just want to ensure it is redeemed
     $cardToRedeem = $this->getModelMock('ebayenterprise_giftcard/giftcard', ['redeem'])->setAmountRedeemed(5.0)->setAmountToRedeem(5.0);
     $cardToRedeem->expects($this->once())->method('redeem')->will($this->returnSelf());
     // Set up an object storage of unredeemed cards, will include the card
     // that is expected to be redeemed.
     $unredeemedCards = new SplObjectStorage();
     $unredeemedCards->attach($cardToRedeem);
     $orderId = '5555555555';
     $container = $this->getModelMock('ebayenterprise_giftcard/container', ['getUnredeemedGiftCards']);
     $container->method('getUnredeemedGiftCards')->will($this->returnValue($unredeemedCards));
     $order = Mage::getModel('sales/order', ['increment_id' => $orderId]);
     $this->_event->setOrder($order);
     Mage::getModel('ebayenterprise_giftcard/observer', ['gift_card_container' => $container])->redeemGiftCards($this->_eventObserver);
     $this->assertSame($orderId, $cardToRedeem->getOrderId());
 }
开发者ID:sirishreddyg,项目名称:magento-retail-order-management,代码行数:22,代码来源:ObserverTest.php


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