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)); |
|
|
|
|
59
|
|
|
} |
60
|
|
|
|
61
|
|
|
|
62
|
|
|
} |
63
|
|
|
|
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.