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