Passed
Pull Request — master (#339)
by Alejandro
05:38
created

TestHelper::createTestDb()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 6
nc 2
nop 0
dl 0
loc 10
rs 10
c 0
b 0
f 0
1
<?php
2
declare(strict_types=1);
3
4
namespace ShlinkioTest\Shlink\Common;
5
6
use Symfony\Component\Process\Process;
7
use function file_exists;
8
use function realpath;
9
use function sys_get_temp_dir;
10
use function unlink;
11
12
class TestHelper
13
{
14
    public function createTestDb(): void
15
    {
16
        $shlinkDbPath = realpath(sys_get_temp_dir()) . '/shlink-tests.db';
17
        if (file_exists($shlinkDbPath)) {
18
            unlink($shlinkDbPath);
19
        }
20
21
        $process = new Process(['vendor/bin/doctrine', 'orm:schema-tool:create', '--no-interaction', '-q']);
22
        $process->inheritEnvironmentVariables()
23
                ->mustRun();
24
    }
25
}
26