本文整理汇总了PHP中Magento\Payment\Helper\Data::getMethodFormBlock方法的典型用法代码示例。如果您正苦于以下问题:PHP Data::getMethodFormBlock方法的具体用法?PHP Data::getMethodFormBlock怎么用?PHP Data::getMethodFormBlock使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Payment\Helper\Data
的用法示例。
在下文中一共展示了Data::getMethodFormBlock方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _prepareLayout
/**
* Prepare children blocks
*
* @return $this
*/
protected function _prepareLayout()
{
/**
* Create child blocks for payment methods forms
*/
foreach ($this->getMethods() as $method) {
$this->setChild('payment.method.' . $method->getCode(), $this->_paymentHelper->getMethodFormBlock($method, $this->_layout));
}
return parent::_prepareLayout();
}
示例2: testGetMethodFormBlock
public function testGetMethodFormBlock()
{
list($blockType, $methodCode) = ['method_block_type', 'method_code'];
$methodMock = $this->getMockBuilder('Magento\\Payment\\Model\\MethodInterface')->getMockForAbstractClass();
$layoutMock = $this->getMockBuilder('Magento\\Framework\\View\\LayoutInterface')->disableOriginalConstructor()->setMethods([])->getMock();
$blockMock = $this->getMockBuilder('Magento\\Framework\\View\\Element\\BlockInterface')->disableOriginalConstructor()->setMethods(['setMethod', 'toHtml'])->getMock();
$methodMock->expects($this->once())->method('getFormBlockType')->willReturn($blockType);
$methodMock->expects($this->once())->method('getCode')->willReturn($methodCode);
$layoutMock->expects($this->once())->method('createBlock')->with($blockType, $methodCode)->willReturn($blockMock);
$blockMock->expects($this->once())->method('setMethod')->with($methodMock);
$this->assertSame($blockMock, $this->helper->getMethodFormBlock($methodMock, $layoutMock));
}