doctrine2 - Loading Fixtures for functional tests in Symfony 2: Call to undefined method MyControllerTest::loadFixtures()) -


i trying find easy way load fixtures in symfony 2.6 run functional tests. quite common question, , has been asked few times, answers have found far not quite reach expectations:

  • some rely on running command line inside functional test.
  • other run manually each 1 of defined fixtures, , take care of creating , deleting database.

there lot of overhead in both cases (use statements , manual code), task believe standard.

on other hand, these same posts recommend liipfunctionaltestbundle. going it, here read in installation instructions:

write fixture classes , call loadfixtures() method bundled test\webtestcase class. please note loadfixtures() delete contents database before loading fixtures."

so tried...

namespace appbundle\test\controller; use symfony\bundle\frameworkbundle\test\webtestcase;  class mycontrollertest extends webtestcase {     public function setup()     {         $classes = array(                 'appbundle\datafixtures\loaduserdata',         );         $this->loadfixtures($classes);     }     ... } 

with no luck:

call undefined method appbundle\tests\controller\mycontrollertest::loadfixtures() in /gitrepos/myproject/src/appbundle/tests/controller/mycontrollertest.php on line 15

a static call gives same error...

self:loadfixtures($classes); 

i think missing pretty obvious. can me on track ?

i can see you're using

oro\bundle\testframeworkbundle\test\webtestcase 

as base class while think should use

liip\functionaltestbundle\test\webtestcase 

to able call method.


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -