SqlServerDblibDatabaseTest   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 5
eloc 18
c 1
b 0
f 0
dl 0
loc 37
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getExpectedUsersVersion1() 0 9 2
A setUp() 0 17 3
1
<?php
2
3
use ByJG\DbMigration\Database\DblibDatabase;
4
use ByJG\DbMigration\Migration;
5
use ByJG\Util\Uri;
6
7
require_once 'BaseDatabase.php';
8
9
/**
10
 * @requires extension pdo_dblib
11
 */
12
class SqlServerDblibDatabaseTest extends BaseDatabase
13
{
14
    /**
15
     * @var Migration
16
     */
17
    protected $migrate = null;
18
19
    protected $scheme = "dblib";
20
21
    public function setUp(): void
22
    {
23
        $host = getenv('MSSQL_TEST_HOST');
24
        if (empty($host)) {
25
            $host = "127.0.0.1";
26
        }
27
        $password = getenv('MSSQL_PASSWORD');
28
        if (empty($password)) {
29
            $password = 'Pa55word';
30
        }
31
32
        $uri = $this->scheme . "://sa:{$password}@{$host}/migratedatabase";
33
34
        Migration::registerDatabase(DblibDatabase::class);
35
36
        $this->migrate = new Migration(new Uri($uri), __DIR__ . '/../example/sql_server', true, $this->migrationTable);
37
        parent::setUp();
38
    }
39
40
    public function getExpectedUsersVersion1()
41
    {
42
        if ($this->scheme == "sqlsrv") {
43
            return parent::getExpectedUsersVersion1();
44
        }
45
46
        return [
47
            ["id" => 1, "name" => 'John Doe', 'createdate' => '2016-01-10 00:00:00'],
48
            ["id" => 2, "name" => 'Jane Doe', 'createdate' => '2015-12-30 00:00:00']
49
        ];
50
    }
51
52
}
53