當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。