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


PHP Form::expects方法代码示例

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


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

示例1: testBindData

 /**
  * Test data binding
  * It should validate required translations
  *
  * @param array $options
  *
  * @dataProvider bindDataProvider
  */
 public function testBindData(array $options)
 {
     $target = $this->getTargetedClass($options);
     $translatableEntity = $this->getTranslatableEntityMock();
     $locales = $options['locales'];
     foreach ($locales as $index => $locale) {
         $this->form->expects($this->at($index))->method('get')->with($locale)->will($this->returnValue($defaultField = $this->getFormMock()));
         $defaultField->expects($this->any())->method('getData')->will($this->returnValue(null));
     }
     $event = $this->getEventMock($this->form, $translatableEntity, []);
     $target->submit($event);
 }
开发者ID:abdeldayem,项目名称:pim-community-dev,代码行数:20,代码来源:AddTranslatableFieldSubscriberTest.php

示例2: assertProcessSegment

 protected function assertProcessSegment()
 {
     $formData = ['definition' => 'test'];
     $this->form->expects($this->once())->method('getName')->will($this->returnValue('test_form'));
     $this->request->request->set('test_form', $formData);
     $businessUnit = $this->getMockBuilder('Oro\\Bundle\\OrganizationBundle\\Entity\\BusinessUnit')->disableOriginalConstructor()->getMock();
     /** @var \PHPUnit_Framework_MockObject_MockObject|User $owner */
     $owner = $this->getMockBuilder('Oro\\Bundle\\UserBundle\\Entity\\User')->disableOriginalConstructor()->getMock();
     $owner->expects($this->atLeastOnce())->method('getOwner')->will($this->returnValue($businessUnit));
     $this->testEntity->setName('test')->setDescription('description')->setType(new MarketingListType(MarketingListType::TYPE_DYNAMIC))->setOwner($owner);
     $segmentType = new SegmentType(SegmentType::TYPE_DYNAMIC);
     $this->manager->expects($this->once())->method('find')->with('OroSegmentBundle:SegmentType', MarketingListType::TYPE_DYNAMIC)->will($this->returnValue($segmentType));
 }
开发者ID:antrampa,项目名称:crm,代码行数:13,代码来源:MarketingListHandlerTest.php

示例3: testInvalidData

 public function testInvalidData()
 {
     $this->formField->expects($this->any())->method('getData')->will($this->returnValue($this->dateTimeStart));
     $this->context->expects($this->once())->method('addViolation')->with($this->equalTo($this->constraint->message), $this->equalTo(array('{{ ' . $this->constraint->getDefaultOption() . ' }}' => $this->constraint->field)));
     $this->validator->validate($this->dateTimeEnd, $this->constraint);
 }
开发者ID:ramunasd,项目名称:platform,代码行数:6,代码来源:DateEarlierThanValidatorTest.php

示例4: assertSaveData

 /**
  * @param \PHPUnit_Framework_MockObject_MockObject|Form $form
  * @param object $entity
  * @param string $wid
  * @return array
  */
 protected function assertSaveData($form, $entity, $wid = 'WID')
 {
     $this->request->expects($this->atLeastOnce())->method('get')->with('_wid', false)->will($this->returnValue($wid));
     $formView = $this->getMockBuilder('Symfony\\Component\\Form\\FormView')->disableOriginalConstructor()->getMock();
     $form->expects($this->any())->method('createView')->will($this->returnValue($formView));
     return ['entity' => $entity, 'form' => $formView, 'isWidgetContext' => true];
 }
开发者ID:Maksold,项目名称:platform,代码行数:13,代码来源:UpdateHandlerTest.php


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