-
Notifications
You must be signed in to change notification settings - Fork 62
/
Copy pathbootstrap.php
45 lines (34 loc) · 1.14 KB
/
bootstrap.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php
use Doctrine\DBAL\Connection;
use Doctrine\Deprecations\Deprecation;
use Doctrine\Persistence\ManagerRegistry;
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Component\Console\Input\ArrayInput;
use Tests\Functional\app\AppKernel;
require_once __DIR__.'/../vendor/autoload.php';
if (class_exists(Deprecation::class)) {
Deprecation::enableWithTriggerError();
}
function bootstrap(): void
{
$kernel = new AppKernel('test', true);
$kernel->boot();
$application = new Application($kernel);
$application->setCatchExceptions(false);
$application->setAutoExit(false);
$application->run(new ArrayInput([
'command' => 'doctrine:database:drop',
'--if-exists' => '1',
'--force' => '1',
]));
$application->run(new ArrayInput([
'command' => 'doctrine:database:create',
]));
/** @var ManagerRegistry $registry */
$registry = $kernel->getContainer()->get('doctrine');
/** @var Connection $connection */
$connection = $registry->getConnection();
$connection->executeQuery('CREATE TABLE test (test VARCHAR(10))');
$kernel->shutdown();
}
bootstrap();