AbstractSQLServerDriverTest.php 2.56 KB
Newer Older
1 2 3 4 5
<?php

namespace Doctrine\Tests\DBAL\Driver;

use Doctrine\DBAL\Connection;
6
use Doctrine\DBAL\Driver\AbstractSQLServerDriver\Exception\PortWithoutHost;
7
use Doctrine\DBAL\Platforms\AbstractPlatform;
Sergei Morozov's avatar
Sergei Morozov committed
8
use Doctrine\DBAL\Platforms\SQLServer2005Platform;
9
use Doctrine\DBAL\Platforms\SQLServer2008Platform;
Sergei Morozov's avatar
Sergei Morozov committed
10 11
use Doctrine\DBAL\Platforms\SQLServer2012Platform;
use Doctrine\DBAL\Platforms\SQLServerPlatform;
12
use Doctrine\DBAL\Schema\AbstractSchemaManager;
13 14
use Doctrine\DBAL\Schema\SQLServerSchemaManager;

15
abstract class AbstractSQLServerDriverTest extends AbstractDriverTest
16
{
17
    protected function createPlatform(): AbstractPlatform
18 19 20 21
    {
        return new SQLServer2008Platform();
    }

22
    protected function createSchemaManager(Connection $connection): AbstractSchemaManager
23 24 25 26
    {
        return new SQLServerSchemaManager($connection);
    }

27 28 29
    /**
     * {@inheritDoc}
     */
30
    protected function getDatabasePlatformsForVersions(): array
31
    {
Sergei Morozov's avatar
Sergei Morozov committed
32
        return [
Sergei Morozov's avatar
Sergei Morozov committed
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
            ['9', SQLServerPlatform::class],
            ['9.00', SQLServerPlatform::class],
            ['9.00.0', SQLServerPlatform::class],
            ['9.00.1398', SQLServerPlatform::class],
            ['9.00.1398.99', SQLServerPlatform::class],
            ['9.00.1399', SQLServer2005Platform::class],
            ['9.00.1399.0', SQLServer2005Platform::class],
            ['9.00.1399.99', SQLServer2005Platform::class],
            ['9.00.1400', SQLServer2005Platform::class],
            ['9.10', SQLServer2005Platform::class],
            ['9.10.9999', SQLServer2005Platform::class],
            ['10.00.1599', SQLServer2005Platform::class],
            ['10.00.1599.99', SQLServer2005Platform::class],
            ['10.00.1600', SQLServer2008Platform::class],
            ['10.00.1600.0', SQLServer2008Platform::class],
            ['10.00.1600.99', SQLServer2008Platform::class],
            ['10.00.1601', SQLServer2008Platform::class],
            ['10.10', SQLServer2008Platform::class],
            ['10.10.9999', SQLServer2008Platform::class],
            ['11.00.2099', SQLServer2008Platform::class],
            ['11.00.2099.99', SQLServer2008Platform::class],
            ['11.00.2100', SQLServer2012Platform::class],
            ['11.00.2100.0', SQLServer2012Platform::class],
            ['11.00.2100.99', SQLServer2012Platform::class],
            ['11.00.2101', SQLServer2012Platform::class],
            ['12', SQLServer2012Platform::class],
Sergei Morozov's avatar
Sergei Morozov committed
59
        ];
60
    }
61

62
    public function testPortWithoutHost(): void
63 64 65 66
    {
        $this->expectException(PortWithoutHost::class);
        $this->driver->connect(['port' => 1433]);
    }
67
}