Last active
December 16, 2015 17:41
-
-
Save Vp3n/5472469 to your computer and use it in GitHub Desktop.
Custom symfony2 bootstrap with database init.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// app/test.bootstrap.php | |
if (isset($_ENV['BOOTSTRAP_CLEAR_CACHE_ENV'])) { | |
passthru(sprintf( | |
'php "%s/console" cache:clear --env=%s --no-warmup', | |
__DIR__, | |
$_ENV['BOOTSTRAP_CLEAR_CACHE_ENV'] | |
)); | |
} | |
require __DIR__ . '/bootstrap.php.cache'; | |
//drop/create database | |
passthru(sprintf('php "%s/console" doctrine:database:drop --env=test --force', __DIR__)); // force used to avoid interaction | |
//create database | |
passthru(sprintf('php "%s/console" doctrine:database:create --env=test', __DIR__)); | |
//init database | |
passthru(sprintf('php "%s/console" doctrine:schema:create --env=test', __DIR__)); | |
// add custom initializations here, such as loading trigger, stored procedure or custom SQL | |
//insert fixtures | |
passthru(sprintf('php "%s/console" doctrine:fixtures:load --env=test -n', __DIR__)); // -n used to avoid interaction | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment