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