DBAL461Test.php 1.14 KB
Newer Older
1 2 3 4 5
<?php

namespace Doctrine\Tests\DBAL\Functional\Ticket;

use Doctrine\DBAL\Schema\SQLServerSchemaManager;
6
use Doctrine\DBAL\Types\DecimalType;
7 8 9 10

/**
 * @group DBAL-461
 */
Luís Cobucci's avatar
Luís Cobucci committed
11
class DBAL461Test extends \PHPUnit\Framework\TestCase
12 13 14
{
    public function testIssue()
    {
15
        $conn = $this->createMock('Doctrine\DBAL\Connection');
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
        $platform = $this->getMockForAbstractClass('Doctrine\DBAL\Platforms\AbstractPlatform');
        $platform->registerDoctrineTypeMapping('numeric', 'decimal');

        $schemaManager = new SQLServerSchemaManager($conn, $platform);

        $reflectionMethod = new \ReflectionMethod($schemaManager, '_getPortableTableColumnDefinition');
        $reflectionMethod->setAccessible(true);
        $column = $reflectionMethod->invoke($schemaManager, array(
            'type' => 'numeric(18,0)',
            'length' => null,
            'default' => null,
            'notnull' => false,
            'scale' => 18,
            'precision' => 0,
            'autoincrement' => false,
            'collation' => 'foo',
Steve Müller's avatar
Steve Müller committed
32
            'comment' => null,
33 34
        ));

35
        $this->assertInstanceOf(DecimalType::class, $column->getType());
36 37
    }
}