如何从 Symfony 2 中的功能测试加载装置 [英] How can I load fixtures from functional test in Symfony 2

查看:29
本文介绍了如何从 Symfony 2 中的功能测试加载装置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的 DoctrineFixturesBundle 已安装,我可以通过命令行加载夹具,但是,如何从我的功能测试中加载夹具?

解决方案

您可以在测试的 setUp() 方法中加载装置,正如您在 这个问题.>

您可以使用问题中的代码,但需要将--append附加到doctrine:fixtures:load命令中,以避免被fixtures确认-捆绑.

更好的解决方案是查看 LiipFunctionalTestBundle,它可以更轻松地使用数据夹具.

My DoctrineFixturesBundle is installed and I can load fixture trough the command-line but , how can I load fixtures from my functional test ?

解决方案

You can load the fixtures in your test's setUp() method as you can see in this question.

You can use the code in the question but need to append --appendto the doctrine:fixtures:load command in order to avoid the confirmation by the fixtures-bundle.

The better solution is to have a look at the LiipFunctionalTestBundle which makes using data-fixtures easier.

这篇关于如何从 Symfony 2 中的功能测试加载装置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆