当前位置: 首页>>代码示例>>PHP>>正文


PHP Template::expects方法代码示例

本文整理汇总了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));
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:8,代码来源:DefaultItemsTest.php

示例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());
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:21,代码来源:EditTest.php


注:本文中的Magento\Backend\Block\Template::expects方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。