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

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

问题描述

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

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

推荐答案

您可以在测试的 setUp()方法中加载灯具,您可以在这个问题

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

您可以使用问题中的代码,但需要将 - 追加添加到教条:fixtures:load 命令,以避免fixtures-bundle的确认。

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.

更好的解决方案是查看 LiipFunctionalTestBundle ,这使得使用数据夹具更容易。

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

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

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