本文整理匯總了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());
}
示例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());
}