本文整理汇总了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);
}
示例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);
}
示例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);
}