symfonydoctrinefunctional-testingfixture

How can I load fixtures from functional test in Symfony 2


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


Solution

  • 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.