Commit 6fb7a4b6 authored by Marco Pivetta's avatar Marco Pivetta Committed by GitHub

Merge pull request #2782 from lcobucci/fix/stop-using-deprecated-types

Stop using deprecated "json_array" type
parents 38a76a90 0b50739e
...@@ -876,6 +876,6 @@ class DB2Platform extends AbstractPlatform ...@@ -876,6 +876,6 @@ class DB2Platform extends AbstractPlatform
*/ */
protected function getReservedKeywordsClass() protected function getReservedKeywordsClass()
{ {
return 'Doctrine\DBAL\Platforms\Keywords\DB2Keywords'; return Keywords\DB2Keywords::class;
} }
} }
...@@ -20,9 +20,9 @@ ...@@ -20,9 +20,9 @@
namespace Doctrine\DBAL\Platforms; namespace Doctrine\DBAL\Platforms;
use Doctrine\DBAL\Schema\Identifier; use Doctrine\DBAL\Schema\Identifier;
use Doctrine\DBAL\Schema\TableDiff;
use Doctrine\DBAL\Schema\Index; use Doctrine\DBAL\Schema\Index;
use Doctrine\DBAL\Schema\Table; use Doctrine\DBAL\Schema\Table;
use Doctrine\DBAL\Schema\TableDiff;
use Doctrine\DBAL\Types\BinaryType; use Doctrine\DBAL\Types\BinaryType;
/** /**
...@@ -314,7 +314,7 @@ class DrizzlePlatform extends AbstractPlatform ...@@ -314,7 +314,7 @@ class DrizzlePlatform extends AbstractPlatform
*/ */
protected function getReservedKeywordsClass() protected function getReservedKeywordsClass()
{ {
return 'Doctrine\DBAL\Platforms\Keywords\DrizzleKeywords'; return Keywords\DrizzleKeywords::class;
} }
/** /**
......
...@@ -21,6 +21,7 @@ namespace Doctrine\DBAL\Platforms; ...@@ -21,6 +21,7 @@ namespace Doctrine\DBAL\Platforms;
use Doctrine\DBAL\Schema\Index; use Doctrine\DBAL\Schema\Index;
use Doctrine\DBAL\Schema\TableDiff; use Doctrine\DBAL\Schema\TableDiff;
use Doctrine\DBAL\Types\Type;
/** /**
* Provides the behavior, features and SQL dialect of the MySQL 5.7 (5.7.9 GA) database platform. * Provides the behavior, features and SQL dialect of the MySQL 5.7 (5.7.9 GA) database platform.
...@@ -79,7 +80,7 @@ class MySQL57Platform extends MySqlPlatform ...@@ -79,7 +80,7 @@ class MySQL57Platform extends MySqlPlatform
*/ */
protected function getReservedKeywordsClass() protected function getReservedKeywordsClass()
{ {
return 'Doctrine\DBAL\Platforms\Keywords\MySQL57Keywords'; return Keywords\MySQL57Keywords::class;
} }
/** /**
...@@ -89,6 +90,6 @@ class MySQL57Platform extends MySqlPlatform ...@@ -89,6 +90,6 @@ class MySQL57Platform extends MySqlPlatform
{ {
parent::initializeDoctrineTypeMappings(); parent::initializeDoctrineTypeMappings();
$this->doctrineTypeMapping['json'] = 'json_array'; $this->doctrineTypeMapping['json'] = Type::JSON;
} }
} }
...@@ -19,13 +19,13 @@ ...@@ -19,13 +19,13 @@
namespace Doctrine\DBAL\Platforms; namespace Doctrine\DBAL\Platforms;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Schema\Identifier; use Doctrine\DBAL\Schema\Identifier;
use Doctrine\DBAL\Schema\TableDiff;
use Doctrine\DBAL\Schema\Index; use Doctrine\DBAL\Schema\Index;
use Doctrine\DBAL\Schema\Table; use Doctrine\DBAL\Schema\Table;
use Doctrine\DBAL\Schema\TableDiff;
use Doctrine\DBAL\Types\BlobType; use Doctrine\DBAL\Types\BlobType;
use Doctrine\DBAL\Types\TextType; use Doctrine\DBAL\Types\TextType;
use Doctrine\DBAL\Connection;
/** /**
* The MySqlPlatform provides the behavior, features and SQL dialect of the * The MySqlPlatform provides the behavior, features and SQL dialect of the
...@@ -712,7 +712,7 @@ class MySqlPlatform extends AbstractPlatform ...@@ -712,7 +712,7 @@ class MySqlPlatform extends AbstractPlatform
if (! $diff->fromTable->hasColumn($columnName)) { if (! $diff->fromTable->hasColumn($columnName)) {
continue; continue;
} }
$column = $diff->fromTable->getColumn($columnName); $column = $diff->fromTable->getColumn($columnName);
if ($column->getAutoincrement() === true) { if ($column->getAutoincrement() === true) {
...@@ -1070,7 +1070,7 @@ class MySqlPlatform extends AbstractPlatform ...@@ -1070,7 +1070,7 @@ class MySqlPlatform extends AbstractPlatform
*/ */
protected function getReservedKeywordsClass() protected function getReservedKeywordsClass()
{ {
return 'Doctrine\DBAL\Platforms\Keywords\MySQLKeywords'; return Keywords\MySQLKeywords::class;
} }
/** /**
......
...@@ -19,13 +19,13 @@ ...@@ -19,13 +19,13 @@
namespace Doctrine\DBAL\Platforms; namespace Doctrine\DBAL\Platforms;
use Doctrine\DBAL\DBALException;
use Doctrine\DBAL\Schema\ForeignKeyConstraint; use Doctrine\DBAL\Schema\ForeignKeyConstraint;
use Doctrine\DBAL\Schema\Identifier; use Doctrine\DBAL\Schema\Identifier;
use Doctrine\DBAL\Schema\Index; use Doctrine\DBAL\Schema\Index;
use Doctrine\DBAL\Schema\Sequence; use Doctrine\DBAL\Schema\Sequence;
use Doctrine\DBAL\Schema\Table; use Doctrine\DBAL\Schema\Table;
use Doctrine\DBAL\Schema\TableDiff; use Doctrine\DBAL\Schema\TableDiff;
use Doctrine\DBAL\DBALException;
use Doctrine\DBAL\Types\BinaryType; use Doctrine\DBAL\Types\BinaryType;
/** /**
...@@ -1156,7 +1156,7 @@ END;'; ...@@ -1156,7 +1156,7 @@ END;';
*/ */
protected function getReservedKeywordsClass() protected function getReservedKeywordsClass()
{ {
return 'Doctrine\DBAL\Platforms\Keywords\OracleKeywords'; return Keywords\OracleKeywords::class;
} }
/** /**
......
...@@ -41,7 +41,7 @@ class PostgreSQL91Platform extends PostgreSqlPlatform ...@@ -41,7 +41,7 @@ class PostgreSQL91Platform extends PostgreSqlPlatform
*/ */
protected function getReservedKeywordsClass() protected function getReservedKeywordsClass()
{ {
return 'Doctrine\DBAL\Platforms\Keywords\PostgreSQL91Keywords'; return Keywords\PostgreSQL91Keywords::class;
} }
/** /**
......
...@@ -19,6 +19,8 @@ ...@@ -19,6 +19,8 @@
namespace Doctrine\DBAL\Platforms; namespace Doctrine\DBAL\Platforms;
use Doctrine\DBAL\Types\Type;
/** /**
* Provides the behavior, features and SQL dialect of the PostgreSQL 9.2 database platform. * Provides the behavior, features and SQL dialect of the PostgreSQL 9.2 database platform.
* *
...@@ -61,7 +63,7 @@ class PostgreSQL92Platform extends PostgreSQL91Platform ...@@ -61,7 +63,7 @@ class PostgreSQL92Platform extends PostgreSQL91Platform
*/ */
protected function getReservedKeywordsClass() protected function getReservedKeywordsClass()
{ {
return 'Doctrine\DBAL\Platforms\Keywords\PostgreSQL92Keywords'; return Keywords\PostgreSQL92Keywords::class;
} }
/** /**
...@@ -70,7 +72,8 @@ class PostgreSQL92Platform extends PostgreSQL91Platform ...@@ -70,7 +72,8 @@ class PostgreSQL92Platform extends PostgreSQL91Platform
protected function initializeDoctrineTypeMappings() protected function initializeDoctrineTypeMappings()
{ {
parent::initializeDoctrineTypeMappings(); parent::initializeDoctrineTypeMappings();
$this->doctrineTypeMapping['json'] = 'json_array';
$this->doctrineTypeMapping['json'] = Type::JSON;
} }
/** /**
......
...@@ -19,6 +19,8 @@ ...@@ -19,6 +19,8 @@
namespace Doctrine\DBAL\Platforms; namespace Doctrine\DBAL\Platforms;
use Doctrine\DBAL\Types\Type;
/** /**
* Provides the behavior, features and SQL dialect of the PostgreSQL 9.4 database platform. * Provides the behavior, features and SQL dialect of the PostgreSQL 9.4 database platform.
* *
...@@ -45,7 +47,7 @@ class PostgreSQL94Platform extends PostgreSQL92Platform ...@@ -45,7 +47,7 @@ class PostgreSQL94Platform extends PostgreSQL92Platform
*/ */
protected function getReservedKeywordsClass() protected function getReservedKeywordsClass()
{ {
return 'Doctrine\DBAL\Platforms\Keywords\PostgreSQL94Keywords'; return Keywords\PostgreSQL94Keywords::class;
} }
/** /**
...@@ -54,6 +56,7 @@ class PostgreSQL94Platform extends PostgreSQL92Platform ...@@ -54,6 +56,7 @@ class PostgreSQL94Platform extends PostgreSQL92Platform
protected function initializeDoctrineTypeMappings() protected function initializeDoctrineTypeMappings()
{ {
parent::initializeDoctrineTypeMappings(); parent::initializeDoctrineTypeMappings();
$this->doctrineTypeMapping['jsonb'] = 'json_array';
$this->doctrineTypeMapping['jsonb'] = Type::JSON;
} }
} }
...@@ -1166,7 +1166,7 @@ class PostgreSqlPlatform extends AbstractPlatform ...@@ -1166,7 +1166,7 @@ class PostgreSqlPlatform extends AbstractPlatform
*/ */
protected function getReservedKeywordsClass() protected function getReservedKeywordsClass()
{ {
return 'Doctrine\DBAL\Platforms\Keywords\PostgreSQLKeywords'; return Keywords\PostgreSQLKeywords::class;
} }
/** /**
......
...@@ -42,6 +42,6 @@ class SQLAnywhere11Platform extends SQLAnywherePlatform ...@@ -42,6 +42,6 @@ class SQLAnywhere11Platform extends SQLAnywherePlatform
*/ */
protected function getReservedKeywordsClass() protected function getReservedKeywordsClass()
{ {
return 'Doctrine\DBAL\Platforms\Keywords\SQLAnywhere11Keywords'; return Keywords\SQLAnywhere11Keywords::class;
} }
} }
...@@ -121,7 +121,7 @@ class SQLAnywhere12Platform extends SQLAnywhere11Platform ...@@ -121,7 +121,7 @@ class SQLAnywhere12Platform extends SQLAnywhere11Platform
*/ */
protected function getReservedKeywordsClass() protected function getReservedKeywordsClass()
{ {
return 'Doctrine\DBAL\Platforms\Keywords\SQLAnywhere12Keywords'; return Keywords\SQLAnywhere12Keywords::class;
} }
/** /**
......
...@@ -55,6 +55,6 @@ class SQLAnywhere16Platform extends SQLAnywhere12Platform ...@@ -55,6 +55,6 @@ class SQLAnywhere16Platform extends SQLAnywhere12Platform
*/ */
protected function getReservedKeywordsClass() protected function getReservedKeywordsClass()
{ {
return 'Doctrine\DBAL\Platforms\Keywords\SQLAnywhere16Keywords'; return Keywords\SQLAnywhere16Keywords::class;
} }
} }
...@@ -26,8 +26,8 @@ use Doctrine\DBAL\Schema\Column; ...@@ -26,8 +26,8 @@ use Doctrine\DBAL\Schema\Column;
use Doctrine\DBAL\Schema\ColumnDiff; use Doctrine\DBAL\Schema\ColumnDiff;
use Doctrine\DBAL\Schema\Constraint; use Doctrine\DBAL\Schema\Constraint;
use Doctrine\DBAL\Schema\ForeignKeyConstraint; use Doctrine\DBAL\Schema\ForeignKeyConstraint;
use Doctrine\DBAL\Schema\Index;
use Doctrine\DBAL\Schema\Identifier; use Doctrine\DBAL\Schema\Identifier;
use Doctrine\DBAL\Schema\Index;
use Doctrine\DBAL\Schema\Table; use Doctrine\DBAL\Schema\Table;
use Doctrine\DBAL\Schema\TableDiff; use Doctrine\DBAL\Schema\TableDiff;
...@@ -1429,7 +1429,7 @@ class SQLAnywherePlatform extends AbstractPlatform ...@@ -1429,7 +1429,7 @@ class SQLAnywherePlatform extends AbstractPlatform
*/ */
protected function getReservedKeywordsClass() protected function getReservedKeywordsClass()
{ {
return 'Doctrine\DBAL\Platforms\Keywords\SQLAnywhereKeywords'; return Keywords\SQLAnywhereKeywords::class;
} }
/** /**
......
...@@ -58,6 +58,6 @@ class SQLServer2005Platform extends SQLServerPlatform ...@@ -58,6 +58,6 @@ class SQLServer2005Platform extends SQLServerPlatform
*/ */
protected function getReservedKeywordsClass() protected function getReservedKeywordsClass()
{ {
return 'Doctrine\DBAL\Platforms\Keywords\SQLServer2005Keywords'; return Keywords\SQLServer2005Keywords::class;
} }
} }
...@@ -114,6 +114,6 @@ class SQLServer2008Platform extends SQLServer2005Platform ...@@ -114,6 +114,6 @@ class SQLServer2008Platform extends SQLServer2005Platform
*/ */
protected function getReservedKeywordsClass() protected function getReservedKeywordsClass()
{ {
return 'Doctrine\DBAL\Platforms\Keywords\SQLServer2008Keywords'; return Keywords\SQLServer2008Keywords::class;
} }
} }
...@@ -101,7 +101,7 @@ class SQLServer2012Platform extends SQLServer2008Platform ...@@ -101,7 +101,7 @@ class SQLServer2012Platform extends SQLServer2008Platform
*/ */
protected function getReservedKeywordsClass() protected function getReservedKeywordsClass()
{ {
return 'Doctrine\DBAL\Platforms\Keywords\SQLServer2012Keywords'; return Keywords\SQLServer2012Keywords::class;
} }
/** /**
...@@ -122,7 +122,7 @@ class SQLServer2012Platform extends SQLServer2008Platform ...@@ -122,7 +122,7 @@ class SQLServer2012Platform extends SQLServer2008Platform
if ($matchesCount > 0) { if ($matchesCount > 0) {
$orderByPos = $matches[0][($matchesCount - 1)][1]; $orderByPos = $matches[0][($matchesCount - 1)][1];
} }
if ($orderByPos === false if ($orderByPos === false
|| substr_count($query, "(", $orderByPos) - substr_count($query, ")", $orderByPos) || substr_count($query, "(", $orderByPos) - substr_count($query, ")", $orderByPos)
) { ) {
......
...@@ -22,11 +22,11 @@ namespace Doctrine\DBAL\Platforms; ...@@ -22,11 +22,11 @@ namespace Doctrine\DBAL\Platforms;
use Doctrine\DBAL\LockMode; use Doctrine\DBAL\LockMode;
use Doctrine\DBAL\Schema\Column; use Doctrine\DBAL\Schema\Column;
use Doctrine\DBAL\Schema\ColumnDiff; use Doctrine\DBAL\Schema\ColumnDiff;
use Doctrine\DBAL\Schema\Identifier;
use Doctrine\DBAL\Schema\TableDiff;
use Doctrine\DBAL\Schema\ForeignKeyConstraint; use Doctrine\DBAL\Schema\ForeignKeyConstraint;
use Doctrine\DBAL\Schema\Identifier;
use Doctrine\DBAL\Schema\Index; use Doctrine\DBAL\Schema\Index;
use Doctrine\DBAL\Schema\Table; use Doctrine\DBAL\Schema\Table;
use Doctrine\DBAL\Schema\TableDiff;
/** /**
* The SQLServerPlatform provides the behavior, features and SQL dialect of the * The SQLServerPlatform provides the behavior, features and SQL dialect of the
...@@ -1512,7 +1512,7 @@ class SQLServerPlatform extends AbstractPlatform ...@@ -1512,7 +1512,7 @@ class SQLServerPlatform extends AbstractPlatform
*/ */
protected function getReservedKeywordsClass() protected function getReservedKeywordsClass()
{ {
return 'Doctrine\DBAL\Platforms\Keywords\SQLServerKeywords'; return Keywords\SQLServerKeywords::class;
} }
/** /**
......
...@@ -21,12 +21,12 @@ namespace Doctrine\DBAL\Platforms; ...@@ -21,12 +21,12 @@ namespace Doctrine\DBAL\Platforms;
use Doctrine\DBAL\DBALException; use Doctrine\DBAL\DBALException;
use Doctrine\DBAL\Schema\Column; use Doctrine\DBAL\Schema\Column;
use Doctrine\DBAL\Schema\TableDiff; use Doctrine\DBAL\Schema\Constraint;
use Doctrine\DBAL\Schema\Table;
use Doctrine\DBAL\Schema\ForeignKeyConstraint; use Doctrine\DBAL\Schema\ForeignKeyConstraint;
use Doctrine\DBAL\Schema\Index;
use Doctrine\DBAL\Schema\Identifier; use Doctrine\DBAL\Schema\Identifier;
use Doctrine\DBAL\Schema\Constraint; use Doctrine\DBAL\Schema\Index;
use Doctrine\DBAL\Schema\Table;
use Doctrine\DBAL\Schema\TableDiff;
/** /**
* The SqlitePlatform class describes the specifics and dialects of the SQLite * The SqlitePlatform class describes the specifics and dialects of the SQLite
...@@ -633,7 +633,7 @@ class SqlitePlatform extends AbstractPlatform ...@@ -633,7 +633,7 @@ class SqlitePlatform extends AbstractPlatform
*/ */
protected function getReservedKeywordsClass() protected function getReservedKeywordsClass()
{ {
return 'Doctrine\DBAL\Platforms\Keywords\SQLiteKeywords'; return Keywords\SQLiteKeywords::class;
} }
/** /**
......
...@@ -444,7 +444,7 @@ class PostgreSqlSchemaManager extends AbstractSchemaManager ...@@ -444,7 +444,7 @@ class PostgreSqlSchemaManager extends AbstractSchemaManager
$column->setPlatformOption('collation', $tableColumn['collation']); $column->setPlatformOption('collation', $tableColumn['collation']);
} }
if ($column->getType()->getName() === 'json_array') { if (in_array($column->getType()->getName(), [Type::JSON_ARRAY, Type::JSON], true)) {
$column->setPlatformOption('jsonb', $jsonb); $column->setPlatformOption('jsonb', $jsonb);
} }
......
...@@ -28,7 +28,7 @@ class PostgreSqlSchemaManagerTest extends SchemaManagerFunctionalTestCase ...@@ -28,7 +28,7 @@ class PostgreSqlSchemaManagerTest extends SchemaManagerFunctionalTestCase
$params = $this->_conn->getParams(); $params = $this->_conn->getParams();
$paths = $this->_sm->getSchemaSearchPaths(); $paths = $this->_sm->getSchemaSearchPaths();
$this->assertEquals(array($params['user'], 'public'), $paths); $this->assertEquals([$params['user'], 'public'], $paths);
} }
/** /**
...@@ -40,7 +40,7 @@ class PostgreSqlSchemaManagerTest extends SchemaManagerFunctionalTestCase ...@@ -40,7 +40,7 @@ class PostgreSqlSchemaManagerTest extends SchemaManagerFunctionalTestCase
$this->assertInternalType('array', $names); $this->assertInternalType('array', $names);
$this->assertTrue(count($names) > 0); $this->assertTrue(count($names) > 0);
$this->assertTrue(in_array('public', $names), "The public schema should be found."); $this->assertContains('public', $names, 'The public schema should be found.');
} }
/** /**
...@@ -366,7 +366,10 @@ class PostgreSqlSchemaManagerTest extends SchemaManagerFunctionalTestCase ...@@ -366,7 +366,10 @@ class PostgreSqlSchemaManagerTest extends SchemaManagerFunctionalTestCase
$this->assertSame('(id IS NULL)', $onlineTable->getIndex('simple_partial_index')->getOption('where')); $this->assertSame('(id IS NULL)', $onlineTable->getIndex('simple_partial_index')->getOption('where'));
} }
public function testJsonbColumn() /**
* @dataProvider jsonbColumnTypeProvider
*/
public function testJsonbColumn(string $type): void
{ {
if (!$this->_sm->getDatabasePlatform() instanceof PostgreSQL94Platform) { if (!$this->_sm->getDatabasePlatform() instanceof PostgreSQL94Platform) {
$this->markTestSkipped("Requires PostgresSQL 9.4+"); $this->markTestSkipped("Requires PostgresSQL 9.4+");
...@@ -374,14 +377,22 @@ class PostgreSqlSchemaManagerTest extends SchemaManagerFunctionalTestCase ...@@ -374,14 +377,22 @@ class PostgreSqlSchemaManagerTest extends SchemaManagerFunctionalTestCase
} }
$table = new Schema\Table('test_jsonb'); $table = new Schema\Table('test_jsonb');
$table->addColumn('foo', 'json_array')->setPlatformOption('jsonb', true); $table->addColumn('foo', $type)->setPlatformOption('jsonb', true);
$this->_sm->dropAndCreateTable($table); $this->_sm->dropAndCreateTable($table);
/** @var Schema\Column[] $columns */ /** @var Schema\Column[] $columns */
$columns = $this->_sm->listTableColumns('test_jsonb'); $columns = $this->_sm->listTableColumns('test_jsonb');
$this->assertEquals('json_array', $columns['foo']->getType()->getName()); $this->assertSame(TYPE::JSON, $columns['foo']->getType()->getName());
$this->assertEquals(true, $columns['foo']->getPlatformOption('jsonb')); $this->assertTrue(true, $columns['foo']->getPlatformOption('jsonb'));
}
public function jsonbColumnTypeProvider(): array
{
return [
[Type::JSON],
[Type::JSON_ARRAY],
];
} }
/** /**
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
namespace Doctrine\Tests\DBAL\Platforms; namespace Doctrine\Tests\DBAL\Platforms;
use Doctrine\DBAL\Platforms\MySQL57Platform; use Doctrine\DBAL\Platforms\MySQL57Platform;
use Doctrine\DBAL\Types\Type;
class MySQL57PlatformTest extends AbstractMySQLPlatformTestCase class MySQL57PlatformTest extends AbstractMySQLPlatformTestCase
{ {
...@@ -27,7 +28,7 @@ class MySQL57PlatformTest extends AbstractMySQLPlatformTestCase ...@@ -27,7 +28,7 @@ class MySQL57PlatformTest extends AbstractMySQLPlatformTestCase
public function testInitializesJsonTypeMapping() public function testInitializesJsonTypeMapping()
{ {
$this->assertTrue($this->_platform->hasDoctrineTypeMappingFor('json')); $this->assertTrue($this->_platform->hasDoctrineTypeMappingFor('json'));
$this->assertSame('json_array', $this->_platform->getDoctrineTypeMapping('json')); $this->assertSame(Type::JSON, $this->_platform->getDoctrineTypeMapping('json'));
} }
/** /**
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
namespace Doctrine\Tests\DBAL\Platforms; namespace Doctrine\Tests\DBAL\Platforms;
use Doctrine\DBAL\Platforms\PostgreSQL92Platform; use Doctrine\DBAL\Platforms\PostgreSQL92Platform;
use Doctrine\DBAL\Types\Type;
class PostgreSQL92PlatformTest extends AbstractPostgreSqlPlatformTestCase class PostgreSQL92PlatformTest extends AbstractPostgreSqlPlatformTestCase
{ {
...@@ -54,7 +55,7 @@ class PostgreSQL92PlatformTest extends AbstractPostgreSqlPlatformTestCase ...@@ -54,7 +55,7 @@ class PostgreSQL92PlatformTest extends AbstractPostgreSqlPlatformTestCase
public function testInitializesJsonTypeMapping() public function testInitializesJsonTypeMapping()
{ {
$this->assertTrue($this->_platform->hasDoctrineTypeMappingFor('json')); $this->assertTrue($this->_platform->hasDoctrineTypeMappingFor('json'));
$this->assertEquals('json_array', $this->_platform->getDoctrineTypeMapping('json')); $this->assertEquals(Type::JSON, $this->_platform->getDoctrineTypeMapping('json'));
} }
/** /**
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
namespace Doctrine\Tests\DBAL\Platforms; namespace Doctrine\Tests\DBAL\Platforms;
use Doctrine\DBAL\Platforms\PostgreSQL94Platform; use Doctrine\DBAL\Platforms\PostgreSQL94Platform;
use Doctrine\DBAL\Types\Type;
class PostgreSQL94PlatformTest extends PostgreSQL92PlatformTest class PostgreSQL94PlatformTest extends PostgreSQL92PlatformTest
{ {
...@@ -25,6 +26,6 @@ class PostgreSQL94PlatformTest extends PostgreSQL92PlatformTest ...@@ -25,6 +26,6 @@ class PostgreSQL94PlatformTest extends PostgreSQL92PlatformTest
{ {
parent::testInitializesJsonTypeMapping(); parent::testInitializesJsonTypeMapping();
$this->assertTrue($this->_platform->hasDoctrineTypeMappingFor('jsonb')); $this->assertTrue($this->_platform->hasDoctrineTypeMappingFor('jsonb'));
$this->assertEquals('json_array', $this->_platform->getDoctrineTypeMapping('jsonb')); $this->assertEquals(Type::JSON, $this->_platform->getDoctrineTypeMapping('jsonb'));
} }
} }
...@@ -22,9 +22,11 @@ class PostgreSQLSchemaManagerTest extends \PHPUnit_Framework_TestCase ...@@ -22,9 +22,11 @@ class PostgreSQLSchemaManagerTest extends \PHPUnit_Framework_TestCase
{ {
$driverMock = $this->createMock('Doctrine\DBAL\Driver'); $driverMock = $this->createMock('Doctrine\DBAL\Driver');
$platform = $this->createMock('Doctrine\DBAL\Platforms\PostgreSqlPlatform'); $platform = $this->createMock('Doctrine\DBAL\Platforms\PostgreSqlPlatform');
$this->connection = $this->getMockBuilder('Doctrine\DBAL\Connection') $this->connection = $this->getMockBuilder('Doctrine\DBAL\Connection')
->setConstructorArgs(array(array('platform' => $platform), $driverMock)) ->setConstructorArgs([['platform' => $platform], $driverMock])
->getMock(); ->getMock();
$this->schemaManager = new PostgreSqlSchemaManager($this->connection, $platform); $this->schemaManager = new PostgreSqlSchemaManager($this->connection, $platform);
} }
...@@ -36,12 +38,12 @@ class PostgreSQLSchemaManagerTest extends \PHPUnit_Framework_TestCase ...@@ -36,12 +38,12 @@ class PostgreSQLSchemaManagerTest extends \PHPUnit_Framework_TestCase
$configuration = new Configuration(); $configuration = new Configuration();
$configuration->setFilterSchemaAssetsExpression('/^schema/'); $configuration->setFilterSchemaAssetsExpression('/^schema/');
$sequences = array( $sequences = [
array('relname' => 'foo', 'schemaname' => 'schema'), ['relname' => 'foo', 'schemaname' => 'schema'],
array('relname' => 'bar', 'schemaname' => 'schema'), ['relname' => 'bar', 'schemaname' => 'schema'],
array('relname' => 'baz', 'schemaname' => ''), ['relname' => 'baz', 'schemaname' => ''],
array('relname' => 'bloo', 'schemaname' => 'bloo_schema'), ['relname' => 'bloo', 'schemaname' => 'bloo_schema'],
); ];
$this->connection->expects($this->any()) $this->connection->expects($this->any())
->method('getConfiguration') ->method('getConfiguration')
...@@ -53,20 +55,20 @@ class PostgreSQLSchemaManagerTest extends \PHPUnit_Framework_TestCase ...@@ -53,20 +55,20 @@ class PostgreSQLSchemaManagerTest extends \PHPUnit_Framework_TestCase
$this->connection->expects($this->at(1)) $this->connection->expects($this->at(1))
->method('fetchAll') ->method('fetchAll')
->will($this->returnValue(array(array('min_value' => 1, 'increment_by' => 1)))); ->will($this->returnValue([['min_value' => 1, 'increment_by' => 1]]));
$this->connection->expects($this->at(2)) $this->connection->expects($this->at(2))
->method('fetchAll') ->method('fetchAll')
->will($this->returnValue(array(array('min_value' => 2, 'increment_by' => 2)))); ->will($this->returnValue([['min_value' => 2, 'increment_by' => 2]]));
$this->connection->expects($this->exactly(3)) $this->connection->expects($this->exactly(3))
->method('fetchAll'); ->method('fetchAll');
$this->assertEquals( $this->assertEquals(
array( [
new Sequence('schema.foo', 2, 2), new Sequence('schema.foo', 2, 2),
new Sequence('schema.bar', 1, 1), new Sequence('schema.bar', 1, 1),
), ],
$this->schemaManager->listSequences('database') $this->schemaManager->listSequences('database')
); );
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment