1
我想测试我ArticleForm
其中包含CKEditor
领域:测试形式CKEditor的
$builder->add('content', CKEditorType::class, array(
'config' => array('uiColor' => '#ffffff'),
'required' => true));
然而,当我运行PHPUnit
我得到了以下错误:
Argument 1 passed to Ivory\CKEditorBundle\Form\Type\CKEditorType::__construct()
must be an instance of Ivory\CKEditorBundle\Model\ConfigManagerInterface, none given
我测试配置是与dev和prod其中CKEditor
工作f国家统计局:
ivory_ck_editor:
default_config: default
configs:
default:
filebrowserBrowseRoute: elfinder
filebrowserBrowseRouteParameters: []
测试用例扩展Symfonys' TypeTestCase
它创建了自己的工厂。这可能是原因。但是我不知道如何强制这个工厂提供合适的CKEditor实例。有人知道该怎么做吗?
伟大的答案!对于最新版本的Ivory CKEditor软件包,您还需要模拟工具栏管理器: '$ toolbarManager = $ this-> getMockBuilder(ToolbarManagerInterface :: class) - > disableOriginalConstructor() - > getMock(); $ type = new CKEditorType($ configManager,$ pluginManager,$ stylesSetManager,$ templateManager,$ toolbarManager);' – guhemama