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

testGeneratesTypeDeclarationForDateTimeTz()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

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