MysqlDatabaseTest   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\MySqlDatabase;
4
use ByJG\DbMigration\Migration;
5
use ByJG\Util\Uri;
6
7
require_once 'BaseDatabase.php';
8
9
/**
10
 * @requires extension pdo_mysql
11
 */
12
class MysqlDatabaseTest extends BaseDatabase
13
{
14
    /**
15
     * @var Migration
16
     */
17
    protected $migrate = null;
18
19
    public function setUp(): void
20
    {
21
        $host = getenv('MYSQL_TEST_HOST');
22
        if (empty($host)) {
23
            $host = "127.0.0.1";
24
        }
25
        $password = getenv('MYSQL_PASSWORD');
26
        if (empty($password)) {
27
            $password = 'password';
28
        }
29
        if ($password == '.') {
30
            $password = "";
31
        }
32
33
        $uri = "mysql://root:{$password}@{$host}/migratedatabase";
34
35
        Migration::registerDatabase(MySqlDatabase::class);
36
37
        $this->migrate = new Migration(new Uri($uri), __DIR__ . '/../example/mysql', true, $this->migrationTable);
38
        parent::setUp();
39
    }
40
}
41