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


PHP Column::expects方法代码示例

本文整理汇总了PHP中Magento\Backend\Block\Widget\Grid\Column::expects方法的典型用法代码示例。如果您正苦于以下问题:PHP Column::expects方法的具体用法?PHP Column::expects怎么用?PHP Column::expects使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Magento\Backend\Block\Widget\Grid\Column的用法示例。


在下文中一共展示了Column::expects方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testRender

 /**
  * @param bool $editable
  * @param bool $onlyEdit
  * @param string $expectedResult
  * @return void
  * @dataProvider renderDataProvider
  */
 public function testRender($editable, $onlyEdit, $expectedResult)
 {
     $value = 'some value';
     $keyValue = 'key';
     $this->columnMock->expects($this->once())->method('getEditable')->willReturn($editable);
     $this->columnMock->expects($this->any())->method('getEditOnly')->willReturn($onlyEdit);
     $this->columnMock->expects($this->any())->method('getIndex')->willReturn($keyValue);
     $this->columnMock->expects($this->any())->method('getId')->willReturn('test');
     $this->dataObjectMock->expects($this->any())->method('getData')->with($keyValue)->willReturn($value);
     $this->renderer->setColumn($this->columnMock);
     $this->assertEquals($expectedResult, $this->renderer->render($this->dataObjectMock));
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:19,代码来源:AbstractRendererTest.php

示例2: testGetHtmlSuccessfulTimestamp

 public function testGetHtmlSuccessfulTimestamp()
 {
     $uniqueHash = 'H@$H';
     $id = 3;
     $format = 'mm/dd/yyyy';
     $yesterday = new \DateTime();
     $yesterday->add(\DateInterval::createFromDateString('yesterday'));
     $tomorrow = new \DateTime();
     $tomorrow->add(\DateInterval::createFromDateString('tomorrow'));
     $value = ['locale' => 'en_US', 'from' => $yesterday->getTimestamp(), 'to' => $tomorrow->getTimestamp()];
     $this->mathRandomMock->expects($this->any())->method('getUniqueHash')->willReturn($uniqueHash);
     $this->columnMock->expects($this->once())->method('getHtmlId')->willReturn($id);
     $this->localeDateMock->expects($this->any())->method('getDateFormat')->willReturn($format);
     $this->columnMock->expects($this->any())->method('getTimezone')->willReturn(false);
     $this->localeResolverMock->expects($this->any())->method('getLocale')->willReturn('en_US');
     $this->model->setColumn($this->columnMock);
     $this->model->setValue($value);
     $output = $this->model->getHtml();
     $this->assertContains('id="' . $uniqueHash . '_from" value="' . $yesterday->getTimestamp(), $output);
     $this->assertContains('id="' . $uniqueHash . '_to" value="' . $tomorrow->getTimestamp(), $output);
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:21,代码来源:DateTest.php


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