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


PHP Form::expects方法代码示例

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


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

示例1: testGetAttributeFieldName

 public function testGetAttributeFieldName()
 {
     $name = 'product[image]';
     $attribute = $this->getMock('Magento\\Catalog\\Model\\ResourceModel\\Eav\\Attribute', [], [], '', false);
     $attribute->expects($this->once())->method('getAttributeCode')->willReturn('image');
     $this->formMock->expects($this->once())->method('addSuffixToName')->willReturn($name);
     $this->assertSame($name, $this->gallery->getAttributeFieldName($attribute));
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:8,代码来源:GalleryTest.php

示例2: testAddFields

 /**
  * @dataProvider dataAddFields
  */
 public function testAddFields($expected)
 {
     $this->moduleManagerMock->expects($this->once())->method('isOutputEnabled')->willReturn($expected['isOutputEnabled']);
     $this->eventObserverMock->expects($this->exactly($expected['methods_count']))->method('getForm')->willReturn($this->formMock);
     $element = $this->getMock('Magento\\Framework\\Data\\Form\\Element\\AbstractElement', [], [], '', false);
     $this->formMock->expects($this->exactly($expected['methods_count']))->method('getElement')->with('base_fieldset')->willReturn($element);
     $element->expects($this->exactly($expected['addField_count']))->method('addField');
     $this->yesNoMock->expects($this->exactly($expected['yesno_count']))->method('toOptionArray');
     $this->observerMock->execute($this->eventObserverMock);
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:13,代码来源:AddFieldsToAttributeObserverTest.php

示例3: testLock

 /**
  * @covers \Magento\Eav\Block\Adminhtml\Attribute\PropertyLocker::lock
  */
 public function testLock()
 {
     $lockedFields = ['is_searchable' => 'is_searchable', 'is_filterable' => 'is_filterable'];
     $this->attributeMock->expects($this->once())->method('getId')->willReturn(1);
     $this->attributeConfigMock->expects($this->once())->method('getLockedFields')->willReturn($lockedFields);
     $elementMock = $this->getMockBuilder('\\Magento\\Framework\\Data\\Form\\Element\\AbstractElement')->setMethods(['setDisabled', 'setReadonly'])->disableOriginalConstructor()->getMockForAbstractClass();
     $elementMock->expects($this->exactly(2))->method('setDisabled');
     $elementMock->expects($this->exactly(2))->method('setReadonly');
     $this->formMock->expects($this->exactly(2))->method('getElement')->willReturn($elementMock);
     $this->object->lock($this->formMock);
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:14,代码来源:PropertyLockerTest.php

示例4: setUp

 protected function setUp()
 {
     parent::setUp();
     $this->formFactoryMock = $this->getMockBuilder(FormFactory::class)->disableOriginalConstructor()->setMethods(['create'])->getMock();
     $this->formMock = $this->getMockBuilder(Form::class)->disableOriginalConstructor()->getMock();
     $this->wysiwygConfig = $this->getMockBuilder(ConfigInterface::class)->getMockForAbstractClass();
     $this->editorMock = $this->getMockBuilder(Editor::class)->disableOriginalConstructor()->getMock();
     $this->formFactoryMock->expects($this->any())->method('create')->willReturn($this->formMock);
     $this->formMock->expects($this->once())->method('addField')->willReturn($this->editorMock);
     $this->editorMock->expects($this->once())->method('getElementHtml');
 }
开发者ID:BlackIkeEagle,项目名称:magento2-continuousphp,代码行数:11,代码来源:WysiwygTest.php

示例5: testToHtmlCoreRegistryRatingData

 public function testToHtmlCoreRegistryRatingData()
 {
     $this->registry->expects($this->any())->method('registry')->will($this->returnValue($this->rating));
     $this->form->expects($this->at(7))->method('getElement')->will($this->returnValue($this->element));
     $this->form->expects($this->at(13))->method('getElement')->will($this->returnValue($this->element));
     $this->form->expects($this->at(16))->method('getElement')->will($this->returnValue($this->element));
     $this->form->expects($this->at(17))->method('getElement')->will($this->returnValue($this->element));
     $this->form->expects($this->any())->method('getElement')->will($this->returnValue(false));
     $this->session->expects($this->any())->method('getRatingData')->will($this->returnValue(false));
     $ratingCodes = ['rating_codes' => ['0' => 'rating_code']];
     $this->rating->expects($this->any())->method('getRatingCodes')->will($this->returnValue($ratingCodes));
     $this->block->toHtml();
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:13,代码来源:FormTest.php


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