Passed
Push — master ( a506e2...902f0a )
by Joao
05:33 queued 11s
created

SqlServerDatabaseTest   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
eloc 15
c 1
b 0
f 0
dl 0
loc 31
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 16 3
A getExpectedUsersVersion1() 0 5 1
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 SqlServerDatabaseTest extends BaseDatabase
13
{
14
    /**
15
     * @var Migration
16
     */
17
    protected $migrate = null;
18
19
    public function getExpectedUsersVersion1()
20
    {
21
        return [
22
            ["id" => 1, "name" => 'John Doe', 'createdate' => 'Jan 10 2016 12:00:00:AM'],
23
            ["id" => 2, "name" => 'Jane Doe', 'createdate' => 'Dec 30 2015 12:00:00:AM']
24
        ];
25
    }
26
27
    public function setUp()
28
    {
29
        $host = getenv('MSSQL_TEST_HOST');
30
        if (empty($host)) {
31
            $host = "127.0.0.1";
32
        }
33
        $password = getenv('MSSQL_PASSWORD');
34
        if (empty($password)) {
35
            $password = 'Pa55word';
36
        }
37
38
        $uri = "dblib://sa:${password}@${host}/migratedatabase";
39
40
        $this->migrate = new Migration(new Uri($uri), __DIR__ . '/../example/sql_server', true, $this->migrationTable);
41
        $this->migrate->registerDatabase("dblib", DblibDatabase::class);
42
        parent::setUp();
43
    }
44
}
45