本文整理汇总了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);
}
示例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));
}
示例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);
}
示例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];
}