PostgresDatabaseTest   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 4
eloc 14
c 0
b 0
f 0
dl 0
loc 27
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 20 4
1
<?php
2
3
use ByJG\DbMigration\Database\PgsqlDatabase;
4
use ByJG\DbMigration\Migration;
5
use ByJG\Util\Uri;
6
7
require_once 'BaseDatabase.php';
8
9
10
/**
11
 * @requires extension pdo_pgsql
12
 */
13
class PostgresDatabaseTest extends BaseDatabase
14
{
15
    /**
16
     * @var Migration
17
     */
18
    protected $migrate = null;
19
20
    public function setUp(): void
21
    {
22
        $host = getenv('PSQL_TEST_HOST');
23
        if (empty($host)) {
24
            $host = "127.0.0.1";
25
        }
26
        $password = getenv('PSQL_PASSWORD');
27
        if (empty($password)) {
28
            $password = 'password';
29
        }
30
        if ($password == '.') {
31
            $password = "";
32
        }
33
34
        $uri = "pgsql://postgres:{$password}@{$host}/migratedatabase";
35
36
        Migration::registerDatabase(PgsqlDatabase::class);
37
38
        $this->migrate = new Migration(new Uri($uri), __DIR__ . '/../example/postgres', true, $this->migrationTable);
39
        parent::setUp();
40
    }
41
}
42