Completed
Push — master ( a4015c...46069b )
by Marco
18s queued 13s
created

testGetCreateTableSQLWithColumnCollation()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 10
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 7
nc 1
nop 0
1
<?php
2
3
namespace Doctrine\Tests\DBAL\Platforms;
4
5
use Doctrine\DBAL\Platforms\PostgreSQL91Platform;
6
use Doctrine\DBAL\Schema\Table;
7
8
class PostgreSql91PlatformTest extends PostgreSqlPlatformTest
9
{
10
    public function createPlatform()
11
    {
12
        return new PostgreSQL91Platform();
13
    }
14
15
    public function testSupportsColumnCollation() : void
16
    {
17
        self::assertTrue($this->_platform->supportsColumnCollation());
18
    }
19
20
    public function testColumnCollationDeclarationSQL() : void
21
    {
22
        self::assertSame(
23
            'COLLATE "en_US.UTF-8"',
24
            $this->_platform->getColumnCollationDeclarationSQL('en_US.UTF-8')
25
        );
26
    }
27
28
    public function testGetCreateTableSQLWithColumnCollation() : void
29
    {
30
        $table = new Table('foo');
31
        $table->addColumn('no_collation', 'string');
32
        $table->addColumn('column_collation', 'string')->setPlatformOption('collation', 'en_US.UTF-8');
33
34
        self::assertSame(
35
            ['CREATE TABLE foo (no_collation VARCHAR(255) NOT NULL, column_collation VARCHAR(255) NOT NULL COLLATE "en_US.UTF-8")'],
36
            $this->_platform->getCreateTableSQL($table),
37
            'Column "no_collation" will use the default collation from the table/database and "column_collation" overwrites the collation on this column'
38
        );
39
    }
40
}
41