Beispiel #1
0
 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);
 }
Beispiel #2
0
 protected function setUp()
 {
     $objectManagerHelper = new Magento_Test_Helper_ObjectManager($this);
     $this->_method = new Varien_Object();
     $this->_info = $objectManagerHelper->getModel('Mage_Payment_Model_Info');
     $this->_instructions = $objectManagerHelper->getBlock('Mage_Payment_Block_Info_Instructions');
     $this->_info->setMethodInstance($this->_method);
     $this->_instructions->setInfo($this->_info);
 }
 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());
 }
Beispiel #4
0
 /**
  * @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);
 }