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
Post a Comment