Failed Conditions
Push — master ( 01143c...7811e4 )
by Sergei
21s queued 14s
created

SQLServerPlatform2012Test   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 4
eloc 12
dl 0
loc 36
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A createPlatform() 0 3 1
A testAppendsLockHint() 0 6 1
A testGeneratesTypeDeclarationForDateTimeTz() 0 3 1
A getLockHints() 0 8 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Doctrine\Tests\DBAL\Platforms;
6
7
use Doctrine\DBAL\LockMode;
8
use Doctrine\DBAL\Platforms\AbstractPlatform;
9
use Doctrine\DBAL\Platforms\SQLServer2012Platform;
10
11
class SQLServerPlatform2012Test extends AbstractSQLServerPlatformTestCase
12
{
13
    public function createPlatform() : AbstractPlatform
14
    {
15
        return new SQLServer2012Platform();
16
    }
17
18
    /**
19
     * @group DDC-2310
20
     * @dataProvider getLockHints
21
     */
22
    public function testAppendsLockHint(?int $lockMode, string $lockHint) : void
23
    {
24
        $fromClause     = 'FROM users';
25
        $expectedResult = $fromClause . $lockHint;
26
27
        self::assertSame($expectedResult, $this->platform->appendLockHint($fromClause, $lockMode));
28
    }
29
30
    /**
31
     * @return mixed[][]
32
     */
33
    public static function getLockHints() : iterable
34
    {
35
        return [
36
            [null, ''],
37
            [LockMode::NONE, ' WITH (NOLOCK)'],
38
            [LockMode::OPTIMISTIC, ''],
39
            [LockMode::PESSIMISTIC_READ, ' WITH (HOLDLOCK, ROWLOCK)'],
40
            [LockMode::PESSIMISTIC_WRITE, ' WITH (UPDLOCK, ROWLOCK)'],
41
        ];
42
    }
43
44
    public function testGeneratesTypeDeclarationForDateTimeTz() : void
45
    {
46
        self::assertEquals('DATETIMEOFFSET(6)', $this->platform->getDateTimeTzTypeDeclarationSQL([]));
47
    }
48
}
49