Passed
Pull Request — master (#249)
by Wilmer
02:57
created

OracleHelper::createConnection()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
c 1
b 0
f 0
dl 0
loc 7
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\ActiveRecord\Tests\Support;
6
7
use PDO;
8
use Yiisoft\Db\Connection\ConnectionInterface;
9
use Yiisoft\Db\Oracle\ConnectionPDO;
10
use Yiisoft\Db\Oracle\PDODriver;
11
12
final class OracleHelper extends ConnectionHelper
13
{
14
    private string $dsn = 'oci:dbname=localhost/XE;';
15
    private string $username = 'system';
16
    private string $password = 'root';
17
    private string $charset = 'AL32UTF8';
18
19
    public function createConnection(): ConnectionInterface
20
    {
21
        $pdoDriver = new PDODriver($this->dsn, $this->username, $this->password);
22
        $pdoDriver->charset($this->charset);
23
        $pdoDriver->attributes([PDO::ATTR_STRINGIFY_FETCHES => true]);
24
25
        return new ConnectionPDO($pdoDriver, $this->createSchemaCache());
26
    }
27
}
28