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

DriverTest::testDriverOptions()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 0
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