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


PHP Varien_Event::setQuote方法代码示例

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


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

示例1: testHandleBeforeCollectTotals

 /**
  * When handling the before collect totals event,
  * quote item quantities should be checked by checking
  * quote inventory via the quantity service model.
  */
 public function testHandleBeforeCollectTotals()
 {
     $quote = Mage::getModel('sales/quote');
     $this->_event->setQuote($quote);
     // Side-effect test: just need to make sure quote inventory
     // is checked via the quantity service model.
     $this->_quantityService->expects($this->once())->method('checkQuoteInventory')->with($this->identicalTo($quote))->will($this->returnSelf());
     $this->_inventoryObserver->handleBeforeCollectTotals($this->_eventObserver);
 }
开发者ID:sirishreddyg,项目名称:magento-retail-order-management,代码行数:14,代码来源:ObserverTest.php

示例2: testRedeemVoid

 /**
  * Test voiding the redeemed gift cards.
  */
 public function testRedeemVoid()
 {
     // need to replace the checkout session to prevent errors when instantiating the gift card container
     $this->_replaceSession('checkout/session');
     $exceptionGiftCard = $this->getModelMock('ebayenterprise_giftcard/giftcard', ['void']);
     $exceptionGiftCard->setIsRedeemed(true)->setCardNumber('2222222222222222');
     // the void request may fail but processing should continue
     $exceptionGiftCard->expects($this->once())->method('void')->will($this->throwException(new EbayEnterprise_GiftCard_Exception(__METHOD__ . ': test exception')));
     $giftCard = $this->getModelMock('ebayenterprise_giftcard/giftcard', ['void']);
     $giftCard->setIsRedeemed(true)->setCardNumber('1111111111111111');
     // make sure the card redeem is voided
     $giftCard->expects($this->once())->method('void')->will($this->returnSelf());
     // The set of gift cards in the container that have been redeemed and
     // need to be voided.
     $redeemedGiftCards = new SplObjectStorage();
     $redeemedGiftCards->attach($giftCard);
     $redeemedGiftCards->attach($exceptionGiftCard);
     $container = $this->getModelMock('ebayenterprise_giftcard/container', ['getRedeemedGiftCards']);
     $container->method('getRedeemedGiftCards')->will($this->returnValue($redeemedGiftCards));
     $quote = Mage::getModel('sales/quote');
     $order = Mage::getModel('sales/order');
     $this->_event->setQuote($quote)->setOrder($order);
     $observer = Mage::getModel('ebayenterprise_giftcard/observer', ['gift_card_container' => $container]);
     // invoke the method, should void any redeemed card in the container
     $observer->redeemVoidGiftCards($this->_eventObserver);
 }
开发者ID:sirishreddyg,项目名称:magento-retail-order-management,代码行数:29,代码来源:ObserverTest.php

示例3: testRedeemVoid

 /**
  * Test voiding the redeemed gift cards.
  */
 public function testRedeemVoid()
 {
     // need to replace the checkout session to prevent errors when instantiating the gift card container
     $this->_replaceSession('checkout/session');
     $container = Mage::getModel('ebayenterprise_giftcard/container');
     $exceptionGiftCard = $this->getModelMock('ebayenterprise_giftcard/giftcard', array('void'));
     $exceptionGiftCard->setIsRedeemed(true)->setCardNumber('2222222222222222');
     // the void request may fail but processing should continue
     $exceptionGiftCard->expects($this->once())->method('void')->will($this->throwException(new EbayEnterprise_GiftCard_Exception()));
     $container->updateGiftCard($exceptionGiftCard);
     $giftCard = $this->getModelMock('ebayenterprise_giftcard/giftcard', array('void'));
     $giftCard->setIsRedeemed(true)->setCardNumber('1111111111111111');
     // make sure the card redeem is voided
     $giftCard->expects($this->once())->method('void')->will($this->returnSelf());
     $container->updateGiftCard($giftCard);
     $unredeemedGiftCard = $this->getModelMock('ebayenterprise_giftcard/giftcard', array('void'));
     $unredeemedGiftCard->setIsRedeemed(false)->setCardNumber('2222222222222222');
     // cards that were not redeemed (getIsRedeemed === false) should not be voided
     $unredeemedGiftCard->expects($this->never())->method('void')->will($this->throwException(new EbayEnterprise_GiftCard_Exception()));
     $container->updateGiftCard($unredeemedGiftCard);
     $quote = Mage::getModel('sales/quote');
     $order = Mage::getModel('sales/order');
     $this->_event->setQuote($quote)->setOrder($order);
     $observer = Mage::getModel('ebayenterprise_giftcard/observer', array('gift_card_container' => $container));
     // invoke the method, should void any redeemed card in the container
     $observer->redeemVoidGiftCards($this->_eventObserver);
 }
开发者ID:WinstonN,项目名称:magento-retail-order-management,代码行数:30,代码来源:ObserverTest.php


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