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


PHP FormBuilder::expects方法代码示例

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


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

示例1: setUp

 public function setUp()
 {
     $this->query = $this->getMock('Sonata\\AdminBundle\\Datagrid\\ProxyQueryInterface');
     $this->columns = new FieldDescriptionCollection();
     $this->pager = $this->getMock('Sonata\\AdminBundle\\Datagrid\\PagerInterface');
     $this->formTypes = array();
     // php 5.3 BC
     $formTypes =& $this->formTypes;
     $this->formBuilder = $this->getMockBuilder('Symfony\\Component\\Form\\FormBuilder')->disableOriginalConstructor()->getMock();
     $this->formBuilder->expects($this->any())->method('get')->will($this->returnCallback(function ($name) use(&$formTypes) {
         if (isset($formTypes[$name])) {
             return $formTypes[$name];
         }
         return;
     }));
     // php 5.3 BC
     $eventDispatcher = $this->getMock('Symfony\\Component\\EventDispatcher\\EventDispatcherInterface');
     $formFactory = $this->getMock('Symfony\\Component\\Form\\FormFactoryInterface');
     $this->formBuilder->expects($this->any())->method('add')->will($this->returnCallback(function ($name, $type, $options) use(&$formTypes, $eventDispatcher, $formFactory) {
         $formTypes[$name] = new FormBuilder($name, 'Sonata\\AdminBundle\\Tests\\Fixtures\\Entity\\Form\\TestEntity', $eventDispatcher, $formFactory, $options);
         return;
     }));
     // php 5.3 BC
     $form = $this->getMockBuilder('Symfony\\Component\\Form\\Form')->disableOriginalConstructor()->getMock();
     $this->formBuilder->expects($this->any())->method('getForm')->will($this->returnCallback(function () use($form) {
         return $form;
     }));
     $values = array();
     $this->datagrid = new Datagrid($this->query, $this->columns, $this->pager, $this->formBuilder, $values);
 }
开发者ID:robhunt3r,项目名称:SonataAdminBundle,代码行数:30,代码来源:DatagridTest.php

示例2: testBuildForm

 public function testBuildForm()
 {
     $fields = [];
     $this->builder->expects($this->exactly(4))->method('add')->will($this->returnCallback(function ($filedName, $fieldType) use(&$fields) {
         $fields[$filedName] = $fieldType;
     }));
     $this->type->buildForm($this->builder, []);
     $this->assertSame(['name' => 'text', 'entities' => 'orocrm_channel_entities', 'channelType' => 'genemu_jqueryselect2_choice', 'status' => 'choice'], $fields);
 }
开发者ID:antrampa,项目名称:crm,代码行数:9,代码来源:ChannelTypeTest.php

示例3: testBuildForm

 public function testBuildForm()
 {
     $test = $this;
     $this->reg->expects($this->once())->method('getManager')->with(null)->will($this->returnValue($this->dm));
     $this->builder->expects($this->once())->method('addModelTransformer')->will($this->returnCallback(function ($transformer) use($test) {
         $test->assertInstanceOf('Doctrine\\Bundle\\PHPCRBundle\\Form\\DataTransformer\\DocumentToPathTransformer', $transformer);
         return;
     }));
     $this->type->buildForm($this->builder, array('manager_name' => null));
 }
开发者ID:xabbuh,项目名称:DoctrinePHPCRBundle,代码行数:10,代码来源:PathTypeTest.php

示例4: testBuildForm

 public function testBuildForm()
 {
     $this->builder->expects($this->at(0))->method('addEventSubscriber')->with($this->isInstanceOf('Oro\\Bundle\\IntegrationBundle\\Form\\EventListener\\ChannelFormSubscriber'));
     $this->builder->expects($this->at(1))->method('addEventSubscriber')->with($this->isInstanceOf('Oro\\Bundle\\IntegrationBundle\\Form\\EventListener\\DefaultOwnerSubscriber'));
     $this->type->buildForm($this->builder, []);
 }
开发者ID:Maksold,项目名称:platform,代码行数:6,代码来源:IntegrationTypeTest.php


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