本文整理汇总了PHP中Magento\Backend\Block\Template::expects方法的典型用法代码示例。如果您正苦于以下问题:PHP Template::expects方法的具体用法?PHP Template::expects怎么用?PHP Template::expects使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Backend\Block\Template
的用法示例。
在下文中一共展示了Template::expects方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testGetItemPrice
public function testGetItemPrice()
{
$html = '$34.28';
$this->layoutMock->expects($this->once())->method('getBlock')->with('item_price')->will($this->returnValue($this->priceRenderBlock));
$this->priceRenderBlock->expects($this->once())->method('setItem')->with($this->itemMock);
$this->priceRenderBlock->expects($this->once())->method('toHtml')->will($this->returnValue($html));
$this->assertEquals($html, $this->block->getItemPrice($this->itemMock));
}
示例2: testExecuteNoPopup
public function testExecuteNoPopup()
{
$attributesData = ['frontend_label' => ''];
$this->request->expects($this->any())->method('getParam')->willReturnMap([['attribute_id', null, null], ['attribute', null, $attributesData], ['popup', null, false]]);
$this->objectManagerMock->expects($this->any())->method('create')->with('Magento\\Catalog\\Model\\ResourceModel\\Eav\\Attribute')->willReturn($this->eavAttribute);
$this->objectManagerMock->expects($this->any())->method('get')->with('Magento\\Backend\\Model\\Session')->willReturn($this->session);
$this->eavAttribute->expects($this->once())->method('setEntityTypeId')->willReturnSelf();
$this->eavAttribute->expects($this->once())->method('addData')->with($attributesData)->willReturnSelf();
$this->registry->expects($this->any())->method('register')->with('entity_attribute', $this->eavAttribute);
$this->resultPage->expects($this->any())->method('addBreadcrumb')->willReturnSelf();
$this->resultPage->expects($this->once())->method('setActiveMenu')->with('Magento_Catalog::catalog_attributes_attributes')->willReturnSelf();
$this->resultPage->expects($this->any())->method('getConfig')->willReturn($this->pageConfig);
$this->resultPage->expects($this->once())->method('getLayout')->willReturn($this->layout);
$this->resultPageFactory->expects($this->atLeastOnce())->method('create')->willReturn($this->resultPage);
$this->pageConfig->expects($this->any())->method('getTitle')->willReturn($this->pageTitle);
$this->pageTitle->expects($this->any())->method('prepend')->willReturnSelf();
$this->eavAttribute->expects($this->any())->method('getName')->willReturn(null);
$this->layout->expects($this->once())->method('getBlock')->willReturn($this->blockTemplate);
$this->blockTemplate->expects($this->any())->method('setIsPopup')->willReturnSelf();
$this->assertSame($this->resultPage, $this->editController->execute());
}