php - PHPUnit and Doctrine: How to setup the database -


i'm trying write functional tests symfony2 app. tests interacts database, using, obviously, doctrine.

now, setup configuration call test database, empty , has no tables, tests fail.

how can build database schema test database before execution of tests?

i have tried this

namespace appbundle\tests\controller;  use symfony\bundle\frameworkbundle\test\webtestcase;  class getstartedcontrollertest extends webtestcase {     public function setup()     {         passthru(sprintf('php "%s/console" cache:clear --env=test --no-warmup --no-interaction', __dir__));         passthru(sprintf('php "%s/console" doctrine:database:drop --env=test --force --no-interaction', __dir__));         passthru(sprintf('php "%s/console" doctrine:database:create --env=test --no-interaction', __dir__));         passthru(sprintf('php "%s/console" doctrine:schema:update --force --env=test --no-interaction', __dir__));     }      /**      *      */     public function testregisternewuser()     {      ... 

but seems not working...

any ideas? thank you!


Comments

Popular posts from this blog

facebook - android ACTION_SEND to share with specific application only -

python - Creating a new virtualenv gives a permissions error -

javascript - cocos2d-js draw circle not instantly -