aus*_*der 6 forms entity unit-testing symfony custom-type
我正在尝试测试我创建的表单类型,它使用带有类实体的字段
这是表单的创建
$builder
->add('name', 'text')
->add('description', 'textarea')
->add('services', 'entity', array('class' => 'MyBundle:Service', 'group_by' => 'category.name', 'property' => 'name', 'multiple' => true, 'required' => false));
Run Code Online (Sandbox Code Playgroud)
当我构建表单时,这非常好用,但后来我试图对这种类型进行单元测试
按照此示例介绍如何测试自定义表单类型
我收到了这个错误
Symfony\Component\Form\Exception\Exception:无法加载类型"entity"
在此命令的单元测试开始时引发错误:
$type = new MyType();
$form = $this->factory->create($type);
Run Code Online (Sandbox Code Playgroud)
有关如何修复此错误以便使用实体测试我的自定义表单类型的任何想法?
提前致谢
| 归档时间: |
|
| 查看次数: |
3451 次 |
| 最近记录: |