PostgreSQL92PlatformTest.php 1.76 KB
Newer Older
1 2 3 4 5
<?php

namespace Doctrine\Tests\DBAL\Platforms;

use Doctrine\DBAL\Platforms\PostgreSQL92Platform;
6
use Doctrine\DBAL\Types\Type;
7

8
class PostgreSQL92PlatformTest extends AbstractPostgreSqlPlatformTestCase
9 10 11 12 13 14 15 16 17 18 19 20 21 22
{
    /**
     * {@inheritdoc}
     */
    public function createPlatform()
    {
        return new PostgreSQL92Platform();
    }

    /**
     * @group DBAL-553
     */
    public function testHasNativeJsonType()
    {
23
        self::assertTrue($this->_platform->hasNativeJsonType());
24 25 26 27 28 29 30
    }

    /**
     * @group DBAL-553
     */
    public function testReturnsJsonTypeDeclarationSQL()
    {
31
        self::assertSame('JSON', $this->_platform->getJsonTypeDeclarationSQL(array()));
32 33
    }

34 35
    public function testReturnsSmallIntTypeDeclarationSQL()
    {
36
        self::assertSame(
37 38 39 40
            'SMALLSERIAL',
            $this->_platform->getSmallIntTypeDeclarationSQL(array('autoincrement' => true))
        );

41
        self::assertSame(
42 43 44 45
            'SMALLINT',
            $this->_platform->getSmallIntTypeDeclarationSQL(array('autoincrement' => false))
        );

46
        self::assertSame(
47 48 49 50 51
            'SMALLINT',
            $this->_platform->getSmallIntTypeDeclarationSQL(array())
        );
    }

52 53 54 55 56
    /**
     * @group DBAL-553
     */
    public function testInitializesJsonTypeMapping()
    {
57 58
        self::assertTrue($this->_platform->hasDoctrineTypeMappingFor('json'));
        self::assertEquals(Type::JSON, $this->_platform->getDoctrineTypeMapping('json'));
59
    }
60 61 62 63 64 65

    /**
     * @group DBAL-1220
     */
    public function testReturnsCloseActiveDatabaseConnectionsSQL()
    {
66
        self::assertSame(
67 68 69 70
            "SELECT pg_terminate_backend(pid) FROM pg_stat_activity WHERE datname = 'foo'",
            $this->_platform->getCloseActiveDatabaseConnectionsSQL('foo')
        );
    }
71
}