MySQL57PlatformTest.php 2.02 KB
Newer Older
1 2 3 4 5
<?php

namespace Doctrine\Tests\DBAL\Platforms;

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

8
class MySQL57PlatformTest extends AbstractMySQLPlatformTestCase
9 10 11 12 13 14 15 16 17
{
    /**
     * {@inheritdoc}
     */
    public function createPlatform()
    {
        return new MySQL57Platform();
    }

18 19
    public function testHasNativeJsonType()
    {
20
        self::assertTrue($this->_platform->hasNativeJsonType());
21 22 23 24
    }

    public function testReturnsJsonTypeDeclarationSQL()
    {
25
        self::assertSame('JSON', $this->_platform->getJsonTypeDeclarationSQL(array()));
26 27 28 29
    }

    public function testInitializesJsonTypeMapping()
    {
30 31
        self::assertTrue($this->_platform->hasDoctrineTypeMappingFor('json'));
        self::assertSame(Type::JSON, $this->_platform->getDoctrineTypeMapping('json'));
32 33
    }

34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
    /**
     * @group DBAL-234
     */
    protected function getAlterTableRenameIndexSQL()
    {
        return array(
            'ALTER TABLE mytable RENAME INDEX idx_foo TO idx_bar',
        );
    }

    /**
     * @group DBAL-234
     */
    protected function getQuotedAlterTableRenameIndexSQL()
    {
        return array(
            'ALTER TABLE `table` RENAME INDEX `create` TO `select`',
            'ALTER TABLE `table` RENAME INDEX `foo` TO `bar`',
        );
    }
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74

    /**
     * @group DBAL-807
     */
    protected function getAlterTableRenameIndexInSchemaSQL()
    {
        return array(
            'ALTER TABLE myschema.mytable RENAME INDEX idx_foo TO idx_bar',
        );
    }

    /**
     * @group DBAL-807
     */
    protected function getQuotedAlterTableRenameIndexInSchemaSQL()
    {
        return array(
            'ALTER TABLE `schema`.`table` RENAME INDEX `create` TO `select`',
            'ALTER TABLE `schema`.`table` RENAME INDEX `foo` TO `bar`',
        );
    }
75 76 77 78 79 80 81 82 83 84

    /**
     * {@inheritdoc}
     */
    protected function getGeneratesAlterTableRenameIndexUsedByForeignKeySQL()
    {
        return array(
            'ALTER TABLE mytable RENAME INDEX idx_foo TO idx_foo_renamed',
        );
    }
85
}