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

TestHelper   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 6
dl 0
loc 12
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A createTestDb() 0 10 2
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