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