public function testPrepareLayoutInfoEmpty() { $this->_payment->expects($this->once())->method('getInfoValue')->will($this->returnValue('1')); $this->_block->setAddressType('shipping'); $parentBlock = $this->getMockBuilder('Magento\\Framework\\View\\Element\\Template')->disableOriginalConstructor()->setMethods(array('unsetChild'))->getMock(); $parentBlock->expects($this->once())->method('unsetChild'); $layout = $this->getMockBuilder('Magento\\Framework\\View\\Layout')->disableOriginalConstructor()->setMethods(array('getParentName', 'getBlock'))->getMock(); $layout->expects($this->once())->method('getParentName')->will($this->returnValue('name')); $layout->expects($this->once())->method('getBlock')->will($this->returnValue($parentBlock)); $this->_block->setLayout($layout); $this->assertEmpty($this->_block->getRenderedInfo()); }
public function testPrepareLayout() { $objectManager = new \Magento\TestFramework\Helper\ObjectManager($this); $this->_payment = $this->getMockBuilder('Magento\\RecurringPayment\\Model\\Payment')->disableOriginalConstructor()->setMethods(array('setStore', 'getFieldLabel', '__wakeup'))->getMock(); $this->_payment->expects($this->once())->method('setStore')->will($this->returnValue($this->_payment)); $registry = $this->getMockBuilder('Magento\\Framework\\Registry')->disableOriginalConstructor()->setMethods(array('registry'))->getMock(); $registry->expects($this->once())->method('registry')->with('current_recurring_payment')->will($this->returnValue($this->_payment)); $store = $this->getMockBuilder('Magento\\Store\\Model\\Store')->disableOriginalConstructor()->getMock(); $storeManager = $this->getMockBuilder('Magento\\Store\\Model\\StoreManager')->disableOriginalConstructor()->setMethods(array('getStore'))->getMock(); $storeManager->expects($this->once())->method('getStore')->will($this->returnValue($store)); $this->_block = $objectManager->getObject('Magento\\RecurringPayment\\Block\\Payment\\View\\Item', array('registry' => $registry, 'storeManager' => $storeManager)); $layout = $this->getMockBuilder('Magento\\Framework\\View\\Layout')->disableOriginalConstructor()->setMethods(array('helper'))->getMock(); $this->_block->setLayout($layout); }
public function testAddRecurringPaymentIdsToSession() { $this->_prepareRecurringPayments(); $this->_quote->expects($this->once())->method('import')->will($this->returnValue(array($this->_payment))); $this->_payment->expects($this->once())->method('isValid')->will($this->returnValue(true)); $this->_payment->expects($this->once())->method('submit'); $this->_testModel->submitRecurringPayments($this->_observer); $this->_testModel->addRecurringPaymentIdsToSession(); }