Failed Conditions
Pull Request — master (#3033)
by Aleksey
15:03
created

DriverTest   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 6
dl 0
loc 28
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A testReturnsName() 0 3 1
A checkForSkippingTest() 0 7 3
A createDriver() 0 3 1
A testDriverOptions() 0 7 1
1
<?php
2
3
namespace Doctrine\Tests\DBAL\Driver\PDOSqlsrv;
4
5
use Doctrine\DBAL\Driver\AbstractSQLServerDriver;
6
use Doctrine\DBAL\Driver\PDOSqlsrv\Driver;
7
use Doctrine\Tests\DBAL\Driver\AbstractSQLServerDriverTest;
8
use PDO;
9
use function extension_loaded;
10
11
class DriverTest extends AbstractSQLServerDriverTest
12
{
13
    public function testReturnsName()
14
    {
15
        self::assertSame('pdo_sqlsrv', $this->driver->getName());
16
    }
17
18
    protected function createDriver()
19
    {
20
        return new Driver();
21
    }
22
23
    protected function checkForSkippingTest(AbstractSQLServerDriver $driver) : void
24
    {
25
        if (extension_loaded('pdo_sqlsrv') && $driver instanceof Driver) {
26
            return;
27
        }
28
29
        $this->markTestSkipped('The test is only for the pdo_sqlsrv drivers');
30
    }
31
32
    public function testDriverOptions() : void
33
    {
34
        $driver = $this->getDriver();
35
        $this->checkForSkippingTest($driver);
36
        $connection = $this->getConnection($driver, [PDO::ATTR_CASE => PDO::CASE_UPPER]);
37
38
        self::assertSame(PDO::CASE_UPPER, $connection->getAttribute(PDO::ATTR_CASE));
39
    }
40
}
41