當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。