本文整理汇总了PHP中Mage_Payment_Model_Info::setMethodInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Payment_Model_Info::setMethodInstance方法的具体用法?PHP Mage_Payment_Model_Info::setMethodInstance怎么用?PHP Mage_Payment_Model_Info::setMethodInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Payment_Model_Info
的用法示例。
在下文中一共展示了Mage_Payment_Model_Info::setMethodInstance方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUp
protected function setUp()
{
$this->_method = new Varien_Object();
$this->_info = new Mage_Payment_Model_Info();
$this->_instructions = new Mage_Payment_Block_Info_Instructions();
$this->_info->setMethodInstance($this->_method);
$this->_instructions->setInfo($this->_info);
}
示例2: testSetInfoTemplate
public function testSetInfoTemplate()
{
$block = $this->getMock('Mage_Payment_Block_Info_ContainerAbstract', array('getChildBlock', 'getPaymentInfo'));
$paymentInfo = new Mage_Payment_Model_Info();
$methodInstance = new Mage_Payment_Model_Method_Checkmo();
$paymentInfo->setMethodInstance($methodInstance);
$block->expects($this->atLeastOnce())->method('getPaymentInfo')->will($this->returnValue($paymentInfo));
$childBlock = new Mage_Core_Block_Template();
$block->expects($this->atLeastOnce())->method('getChildBlock')->with('payment.info.checkmo')->will($this->returnValue($childBlock));
$template = 'any_template.phtml';
$this->assertNotEquals($template, $childBlock->getTemplate());
$block->setInfoTemplate('checkmo', $template);
$this->assertEquals($template, $childBlock->getTemplate());
}
示例3: testGetChildPdfAsArray
/**
* @magentoConfigFixture current_store payment/banktransfer/title Bank Method Title
* @magentoConfigFixture current_store payment/checkmo/title Checkmo Title Of The Method
*/
public function testGetChildPdfAsArray()
{
$block = new Mage_Payment_Block_Info();
$layout = new Mage_Core_Model_Layout();
$layout->addBlock($block, 'block');
$paymentInfoBank = new Mage_Payment_Model_Info();
$paymentInfoBank->setMethodInstance(new Mage_Payment_Model_Method_Banktransfer());
$childBank = $layout->addBlock('Mage_Payment_Block_Info_Instructions', 'child.one', 'block');
$childBank->setInfo($paymentInfoBank)->setArea('adminhtml');
$nonExpectedHtml = 'non-expected html';
$childHtml = $layout->addBlock('Mage_Core_Block_Text', 'child.html', 'block');
$childHtml->setText($nonExpectedHtml);
$paymentInfoCheckmo = new Mage_Payment_Model_Info();
$paymentInfoCheckmo->setMethodInstance(new Mage_Payment_Model_Method_Checkmo());
$childCheckmo = $layout->addBlock('Mage_Payment_Block_Info_Checkmo', 'child.just.another', 'block');
$childCheckmo->setInfo($paymentInfoCheckmo)->setArea('adminhtml');
$pdfArray = $block->getChildPdfAsArray();
$this->assertInternalType('array', $pdfArray);
$this->assertCount(2, $pdfArray);
$text = implode('', $pdfArray);
$this->assertContains('Bank Method Title', $text);
$this->assertContains('Checkmo Title Of The Method', $text);
$this->assertNotContains($nonExpectedHtml, $text);
}