Last active
November 13, 2018 13:29
-
-
Save ahmed-bhs/0d2732b02a543cbfea77bcb943746a98 to your computer and use it in GitHub Desktop.
Unit test bootstrap file
This file contains hidden or 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 | |
declare(strict_types=1); | |
if (!is_file($autoloadFile = __DIR__.'/../vendor/autoload.php')) { | |
throw new \LogicException('Run "composer install --dev" to create autoloader.'); | |
} | |
require_once $autoloadFile; | |
$kernel = new \App\Kernel('test', true); | |
$kernel->boot(); | |
$application = new \Symfony\Bundle\FrameworkBundle\Console\Application($kernel); | |
$application->setAutoExit(false); | |
$application->run(new \Symfony\Component\Console\Input\ArrayInput([ | |
'command' => 'doctrine:database:drop', | |
'--force' => '1', | |
])); | |
$application->run(new \Symfony\Component\Console\Input\ArrayInput([ | |
'command' => 'doctrine:database:create', | |
])); | |
$application->run(new \Symfony\Component\Console\Input\ArrayInput([ | |
'command' => 'doctrine:schema:create', | |
])); | |
$application->run(new \Symfony\Component\Console\Input\ArrayInput([ | |
'command' => 'doctrine:fixtures:load', | |
'--no-interaction' => '1', | |
])); | |
$kernel->shutdown(); | |
sqlite:///:memory: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment