本文整理匯總了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));
}