Exemplo n.º 1
0
 public function testAddCCForZeroAmountCheckout()
 {
     $block = new Mage_Payment_Block_Form_Container();
     $method = new Varien_Object();
     $method->setCode('ops_ideal');
     $block->setData('methods', array($method));
     $quote = Mage::getModel('sales/quote');
     $block->setQuote($quote);
     $featureModelMock = $this->getModelMock('ops/payment_features_zeroAmountAuth', array('isCCAndZeroAmountAuthAllowed'));
     $featureModelMock->expects($this->any())->method('isCCAndZeroAmountAuthAllowed')->will($this->returnValue(true));
     $this->replaceByMock('model', 'ops/payment_features_zeroAmountAuth', $featureModelMock);
     $this->_helper->addCCForZeroAmountCheckout($block);
     $methods = $block->getMethods();
     $this->assertTrue($methods[1] instanceof Netresearch_OPS_Model_Payment_Cc);
     $this->assertFalse($methods[0] instanceof Netresearch_OPS_Model_Payment_Cc);
 }
Exemplo n.º 2
0
 public function testAddCcPaymentMethod()
 {
     $observer = Mage::getModel('ops/observer');
     $event = new Varien_Event_Observer();
     $block = new Mage_Payment_Block_Form_Container();
     $quote = Mage::getModel('sales/quote');
     $block->setQuote($quote);
     $eventData = new Varien_Event();
     $event->setEvent($eventData);
     $event->getEvent()->setData('block', $block);
     $versionHelperMock = $this->getHelperMock('ops/version', array('canUseApplicableForQuote'));
     $versionHelperMock->expects($this->any())->method('canUseApplicableForQuote')->will($this->returnvalue(false));
     $this->replaceByMock('helper', 'ops/version', $versionHelperMock);
     $paymentHelperMock = $this->getHelperMock('ops/payment', array('addCCForZeroAmountCheckout'));
     $paymentHelperMock->expects($this->once())->method('addCCForZeroAmountCheckout')->will($this->returnValue($paymentHelperMock));
     $this->replaceByMock('helper', 'ops/payment', $paymentHelperMock);
     $observer->addCcPaymentMethod($event);
 }