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

namespace Doctrine\Tests\DBAL\Platforms;

use Doctrine\DBAL\Platforms\PostgreSQL92Platform;

7
class PostgreSQL92PlatformTest extends AbstractPostgreSqlPlatformTestCase
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
{
    /**
     * {@inheritdoc}
     */
    public function createPlatform()
    {
        return new PostgreSQL92Platform();
    }

    /**
     * @group DBAL-553
     */
    public function testHasNativeJsonType()
    {
        $this->assertTrue($this->_platform->hasNativeJsonType());
    }

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

33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
    public function testReturnsSmallIntTypeDeclarationSQL()
    {
        $this->assertSame(
            'SMALLSERIAL',
            $this->_platform->getSmallIntTypeDeclarationSQL(array('autoincrement' => true))
        );

        $this->assertSame(
            'SMALLINT',
            $this->_platform->getSmallIntTypeDeclarationSQL(array('autoincrement' => false))
        );

        $this->assertSame(
            'SMALLINT',
            $this->_platform->getSmallIntTypeDeclarationSQL(array())
        );
    }

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

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