Failed Conditions
Pull Request — master (#2825)
by Sébastien
11:02
created

MariaDb1027PlatformTest   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 53
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 5

Importance

Changes 0
Metric Value
wmc 5
c 0
b 0
f 0
lcom 1
cbo 5
dl 0
loc 53
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A createPlatform() 0 4 1
A testHasNativeJsonType() 0 4 1
A testReturnsJsonTypeDeclarationSQL() 0 4 1
A testInitializesJsonTypeMapping() 0 5 1
A testDoesNotPropagateDefaultValuesForUnsupportedColumnTypes() 0 21 1
1
<?php
2
3
namespace Doctrine\Tests\DBAL\Platforms;
4
5
use Doctrine\DBAL\Platforms\MariaDb1027Platform;
6
use Doctrine\DBAL\Schema\Comparator;
7
use Doctrine\DBAL\Schema\Table;
8
use Doctrine\DBAL\Types\Type;
9
10
class MariaDb1027PlatformTest extends AbstractMySQLPlatformTestCase
11
{
12
    /**
13
     * {@inheritdoc}
14
     */
15
    public function createPlatform()
16
    {
17
        return new MariaDb1027Platform();
18
    }
19
20
    public function testHasNativeJsonType()
21
    {
22
        self::assertTrue($this->_platform->hasNativeJsonType());
23
    }
24
25
    public function testReturnsJsonTypeDeclarationSQL()
26
    {
27
        self::assertSame('JSON', $this->_platform->getJsonTypeDeclarationSQL([]));
28
    }
29
30
    public function testInitializesJsonTypeMapping()
31
    {
32
        self::assertTrue($this->_platform->hasDoctrineTypeMappingFor('json'));
33
        self::assertSame(Type::JSON, $this->_platform->getDoctrineTypeMapping('json'));
34
    }
35
36
    /**
37
     * Overrides AbstractMySQLPlatformTestCase::testDoesNotPropagateDefaultValuesForUnsupportedColumnTypes()
38
     */
39
    public function testDoesNotPropagateDefaultValuesForUnsupportedColumnTypes()
40
    {
41
        $table = new Table("text_blob_default_value");
42
43
        $table->addColumn('def_text', 'text', array('default' => 'def'));
44
        $table->addColumn('def_blob', 'blob', array('default' => 'def'));
45
46
        self::assertSame(
47
            array('CREATE TABLE text_blob_default_value (def_text LONGTEXT DEFAULT \'def\' NOT NULL, def_blob LONGBLOB DEFAULT \'def\' NOT NULL) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB'),
48
            $this->_platform->getCreateTableSQL($table)
49
        );
50
51
        $diffTable = clone $table;
52
53
        $diffTable->changeColumn('def_text', array('default' => 'def'));
54
        $diffTable->changeColumn('def_blob', array('default' => 'def'));
55
56
        $comparator = new Comparator();
57
58
        self::assertFalse($comparator->diffTable($table, $diffTable));
0 ignored issues
show
Bug introduced by
It seems like $comparator->diffTable($table, $diffTable) targeting Doctrine\DBAL\Schema\Comparator::diffTable() can also be of type object<Doctrine\DBAL\Schema\TableDiff>; however, PHPUnit\Framework\Assert::assertFalse() does only seem to accept boolean, maybe add an additional type check?

This check looks at variables that are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
59
    }
60
61
62
}
63