Unverified Commit cedf3a28 authored by Sergei Morozov's avatar Sergei Morozov

Merge branch '2.10.x' into 2.11.x

parents 034ed255 61a01133
......@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "96af831c0d8835949c93dc63c83da332",
"content-hash": "1bf73ef9ed03dfdeaedaf678dde8ba13",
"packages": [
{
"name": "doctrine/cache",
......@@ -477,22 +477,22 @@
},
{
"name": "dealerdirect/phpcodesniffer-composer-installer",
"version": "v0.6.2",
"version": "v0.7.0",
"source": {
"type": "git",
"url": "https://github.com/Dealerdirect/phpcodesniffer-composer-installer.git",
"reference": "8001af8eb107fbfcedc31a8b51e20b07d85b457a"
"reference": "e8d808670b8f882188368faaf1144448c169c0b7"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Dealerdirect/phpcodesniffer-composer-installer/zipball/8001af8eb107fbfcedc31a8b51e20b07d85b457a",
"reference": "8001af8eb107fbfcedc31a8b51e20b07d85b457a",
"url": "https://api.github.com/repos/Dealerdirect/phpcodesniffer-composer-installer/zipball/e8d808670b8f882188368faaf1144448c169c0b7",
"reference": "e8d808670b8f882188368faaf1144448c169c0b7",
"shasum": ""
},
"require": {
"composer-plugin-api": "^1.0",
"php": "^5.3|^7",
"squizlabs/php_codesniffer": "^2|^3"
"composer-plugin-api": "^1.0 || ^2.0",
"php": ">=5.3",
"squizlabs/php_codesniffer": "^2 || ^3 || 4.0.x-dev"
},
"require-dev": {
"composer/composer": "*",
......@@ -539,26 +539,26 @@
"stylecheck",
"tests"
],
"time": "2020-01-29T20:22:20+00:00"
"time": "2020-06-25T14:57:39+00:00"
},
{
"name": "doctrine/coding-standard",
"version": "8.0.0",
"version": "8.1.0",
"source": {
"type": "git",
"url": "https://github.com/doctrine/coding-standard.git",
"reference": "742200e29fb8ffd58ba9abec8a9ec33db0884677"
"reference": "637003febec655f1b27f4301b44bf2264be57434"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/coding-standard/zipball/742200e29fb8ffd58ba9abec8a9ec33db0884677",
"reference": "742200e29fb8ffd58ba9abec8a9ec33db0884677",
"url": "https://api.github.com/repos/doctrine/coding-standard/zipball/637003febec655f1b27f4301b44bf2264be57434",
"reference": "637003febec655f1b27f4301b44bf2264be57434",
"shasum": ""
},
"require": {
"dealerdirect/phpcodesniffer-composer-installer": "^0.6.2",
"dealerdirect/phpcodesniffer-composer-installer": "^0.6.2 || ^0.7",
"php": "^7.2 || ^8.0",
"slevomat/coding-standard": "^6.3.8",
"slevomat/coding-standard": "^6.3.9",
"squizlabs/php_codesniffer": "^3.5.5"
},
"type": "phpcodesniffer-standard",
......@@ -595,7 +595,7 @@
"standard",
"style"
],
"time": "2020-06-02T17:58:43+00:00"
"time": "2020-07-05T20:35:22+00:00"
},
{
"name": "doctrine/instantiator",
......
......@@ -10,7 +10,7 @@ use Doctrine\DBAL\Platforms\DB2Platform;
use Doctrine\DBAL\Schema\DB2SchemaManager;
/**
* Abstract base implementation of the {@link Doctrine\DBAL\Driver} interface for IBM DB2 based drivers.
* Abstract base implementation of the {@link Driver} interface for IBM DB2 based drivers.
*/
abstract class AbstractDB2Driver implements Driver
{
......
......@@ -19,7 +19,7 @@ use function preg_match;
use function version_compare;
/**
* Abstract base implementation of the {@link Doctrine\DBAL\Driver} interface for Microsoft SQL Server based drivers.
* Abstract base implementation of the {@link Driver} interface for Microsoft SQL Server based drivers.
*/
abstract class AbstractSQLServerDriver implements Driver, VersionAwarePlatformDriver
{
......
......@@ -23,7 +23,7 @@ use Doctrine\DBAL\Schema\SqliteSchemaManager;
use function strpos;
/**
* Abstract base implementation of the {@link Doctrine\DBAL\Driver} interface for SQLite based drivers.
* Abstract base implementation of the {@link Driver} interface for SQLite based drivers.
*/
abstract class AbstractSQLiteDriver implements Driver, ExceptionConverterDriver
{
......
......@@ -4,11 +4,6 @@ namespace Doctrine\DBAL\Driver\PDOSqlsrv;
use Doctrine\DBAL\Driver\PDO;
use Doctrine\DBAL\Driver\Result;
use Doctrine\DBAL\ParameterType;
use function is_string;
use function strpos;
use function substr;
/**
* Sqlsrv Connection implementation.
......@@ -46,19 +41,4 @@ class Connection extends PDO\Connection
return $stmt->fetchColumn();
}
/**
* {@inheritDoc}
*/
public function quote($value, $type = ParameterType::STRING)
{
$val = parent::quote($value, $type);
// Fix for a driver version terminating all values with null byte
if (is_string($val) && strpos($val, "\0") !== false) {
$val = substr($val, 0, -1);
}
return $val;
}
}
......@@ -33,7 +33,7 @@ interface ResultStatement extends Traversable
*
* @deprecated Use one of the fetch- or iterate-related methods.
*
* @param int $fetchMode The fetch mode must be one of the {@link \Doctrine\DBAL\FetchMode} constants.
* @param int $fetchMode The fetch mode must be one of the {@link FetchMode} constants.
* @param mixed $arg2
* @param mixed $arg3
*
......@@ -47,8 +47,8 @@ interface ResultStatement extends Traversable
* @deprecated Use fetchNumeric(), fetchAssociative() or fetchOne() instead.
*
* @param int|null $fetchMode Controls how the next row will be returned to the caller.
* The value must be one of the {@link \Doctrine\DBAL\FetchMode} constants,
* defaulting to {@link \Doctrine\DBAL\FetchMode::MIXED}.
* The value must be one of the {@link FetchMode} constants,
* defaulting to {@link FetchMode::MIXED}.
* @param int $cursorOrientation For a ResultStatement object representing a scrollable cursor,
* this value determines which row will be returned to the caller.
* This value must be one of the \PDO::FETCH_ORI_* constants,
......@@ -76,19 +76,19 @@ interface ResultStatement extends Traversable
* @deprecated Use fetchAllNumeric(), fetchAllAssociative() or fetchFirstColumn() instead.
*
* @param int|null $fetchMode Controls how the next row will be returned to the caller.
* The value must be one of the {@link \Doctrine\DBAL\FetchMode} constants,
* defaulting to {@link \Doctrine\DBAL\FetchMode::MIXED}.
* The value must be one of the {@link FetchMode} constants,
* defaulting to {@link FetchMode::MIXED}.
* @param int|null $fetchArgument This argument has a different meaning depending on the value of the $fetchMode parameter:
* * {@link \Doctrine\DBAL\FetchMode::COLUMN}:
* * {@link FetchMode::COLUMN}:
* Returns the indicated 0-indexed column.
* * {@link \Doctrine\DBAL\FetchMode::CUSTOM_OBJECT}:
* * {@link FetchMode::CUSTOM_OBJECT}:
* Returns instances of the specified class, mapping the columns of each row
* to named properties in the class.
* * \PDO::FETCH_FUNC: Returns the results of calling the specified function, using each row's
* * {@link PDO::FETCH_FUNC}: Returns the results of calling the specified function, using each row's
* columns as parameters in the call.
* @param mixed[]|null $ctorArgs Controls how the next row will be returned to the caller.
* The value must be one of the {@link \Doctrine\DBAL\FetchMode} constants,
* defaulting to {@link \Doctrine\DBAL\FetchMode::MIXED}.
* The value must be one of the {@link FetchMode} constants,
* defaulting to {@link FetchMode::MIXED}.
*
* @return mixed[]
*/
......
......@@ -23,7 +23,7 @@ interface Statement extends ResultStatement
* this will be a parameter name of the form :name. For a prepared statement
* using question mark placeholders, this will be the 1-indexed position of the parameter.
* @param mixed $value The value to bind to the parameter.
* @param int $type Explicit data type for the parameter using the {@link \Doctrine\DBAL\ParameterType}
* @param int $type Explicit data type for the parameter using the {@link ParameterType}
* constants.
*
* @return bool TRUE on success or FALSE on failure.
......@@ -48,7 +48,7 @@ interface Statement extends ResultStatement
* this will be a parameter name of the form :name. For a prepared statement using
* question mark placeholders, this will be the 1-indexed position of the parameter.
* @param mixed $variable Name of the PHP variable to bind to the SQL statement parameter.
* @param int $type Explicit data type for the parameter using the {@link \Doctrine\DBAL\ParameterType}
* @param int $type Explicit data type for the parameter using the {@link ParameterType}
* constants. To return an INOUT parameter from a stored procedure, use the bitwise
* OR operator to set the PDO::PARAM_INPUT_OUTPUT bits for the data_type parameter.
* @param int|null $length You must specify maxlength when using an OUT bind
......
......@@ -3234,8 +3234,7 @@ abstract class AbstractPlatform
* Whether this platform can emulate schemas.
*
* Platforms that either support or emulate schemas don't automatically
* filter a schema for the namespaced elements in {@link
* AbstractManager#createSchema}.
* filter a schema for the namespaced elements in {@link AbstractManager::createSchema()}.
*
* @return bool
*/
......
......@@ -589,6 +589,22 @@ END;';
return $identifier->isQuoted() ? $identifier : new Identifier(strtoupper($name));
}
/**
* Adds suffix to identifier,
*
* if the new string exceeds max identifier length,
* keeps $suffix, cuts from $identifier as much as the part exceeding.
*/
private function addSuffix(string $identifier, string $suffix): string
{
$maxPossibleLengthWithoutSuffix = $this->getMaxIdentifierLength() - strlen($suffix);
if (strlen($identifier) > $maxPossibleLengthWithoutSuffix) {
$identifier = substr($identifier, 0, $maxPossibleLengthWithoutSuffix);
}
return $identifier . $suffix;
}
/**
* Returns the autoincrement primary key identifier name for the given table identifier.
*
......@@ -601,7 +617,7 @@ END;';
*/
private function getAutoincrementIdentifierName(Identifier $table)
{
$identifierName = $table->getName() . '_AI_PK';
$identifierName = $this->addSuffix($table->getName(), '_AI_PK');
return $table->isQuoted()
? $this->quoteSingleIdentifier($identifierName)
......@@ -970,7 +986,7 @@ SQL
$table = new Identifier($tableName);
// No usage of column name to preserve BC compatibility with <2.5
$identitySequenceName = $table->getName() . '_SEQ';
$identitySequenceName = $this->addSuffix($table->getName(), '_SEQ');
if ($table->isQuoted()) {
$identitySequenceName = '"' . $identitySequenceName . '"';
......
......@@ -646,9 +646,8 @@ SQL
* Checks whether a given column diff is a logically unchanged binary type column.
*
* Used to determine whether a column alteration for a binary type column can be skipped.
* Doctrine's {@link \Doctrine\DBAL\Types\BinaryType} and {@link \Doctrine\DBAL\Types\BlobType}
* are mapped to the same database column type on this platform as this platform
* does not have a native VARBINARY/BINARY column type. Therefore the {@link \Doctrine\DBAL\Schema\Comparator}
* Doctrine's {@link BinaryType} and {@link BlobType} are mapped to the same database column type on this platform
* as this platform does not have a native VARBINARY/BINARY column type. Therefore the comparator
* might detect differences for binary type columns which do not have to be propagated
* to database as there actually is no difference at database level.
*
......
......@@ -266,7 +266,7 @@ class QueryBuilder
*
* @param string|int $key The parameter position or name.
* @param mixed $value The parameter value.
* @param string|int|null $type One of the {@link \Doctrine\DBAL\ParameterType} constants.
* @param string|int|null $type One of the {@link ParameterType} constants.
*
* @return $this This QueryBuilder instance.
*/
......
......@@ -187,7 +187,7 @@ class SQLParserUtils
array_slice($types, 0, $needle),
$count ?
// array needles are at {@link \Doctrine\DBAL\ParameterType} constants
// + {@link Doctrine\DBAL\Connection::ARRAY_PARAM_OFFSET}
// + {@link \Doctrine\DBAL\Connection::ARRAY_PARAM_OFFSET}
array_fill(0, $count, $types[$needle] - Connection::ARRAY_PARAM_OFFSET) :
[],
array_slice($types, $needle + 1)
......
......@@ -64,7 +64,7 @@ interface ShardManager
* Queries all shards in undefined order and return the results appended to
* each other. Restore the previous distribution value after execution.
*
* Using {@link \Doctrine\DBAL\Connection::fetchAll} to retrieve rows internally.
* Using {@link Connection::fetchAll()} to retrieve rows internally.
*
* @param string $sql
* @param mixed[] $params
......
......@@ -278,7 +278,7 @@ abstract class Type
* Gets the (preferred) binding type for values of this type that
* can be used when binding parameters to prepared statements.
*
* This method should return one of the {@link \Doctrine\DBAL\ParameterType} constants.
* This method should return one of the {@link ParameterType} constants.
*
* @return int
*/
......
......@@ -6,8 +6,9 @@ use Doctrine\DBAL\Driver\IBMDB2\DB2Connection;
use Doctrine\Tests\DbalTestCase;
use PHPUnit\Framework\MockObject\MockObject;
use function extension_loaded;
/**
* @requires extension ibm_db2
*/
class DB2ConnectionTest extends DbalTestCase
{
/**
......@@ -19,10 +20,6 @@ class DB2ConnectionTest extends DbalTestCase
protected function setUp(): void
{
if (! extension_loaded('ibm_db2')) {
$this->markTestSkipped('ibm_db2 is not installed.');
}
parent::setUp();
$this->connectionMock = $this->getMockBuilder(DB2Connection::class)
......
......@@ -8,10 +8,12 @@ use Doctrine\DBAL\Platforms\MySqlPlatform;
use Doctrine\Tests\DbalFunctionalTestCase;
use PHPUnit\Framework\MockObject\MockObject;
use function extension_loaded;
use function restore_error_handler;
use function set_error_handler;
/**
* @requires extension mysqli
*/
class MysqliConnectionTest extends DbalFunctionalTestCase
{
/**
......@@ -23,10 +25,6 @@ class MysqliConnectionTest extends DbalFunctionalTestCase
protected function setUp(): void
{
if (! extension_loaded('mysqli')) {
$this->markTestSkipped('mysqli is not installed.');
}
parent::setUp();
if (! $this->connection->getDatabasePlatform() instanceof MySqlPlatform) {
......
......@@ -6,8 +6,9 @@ use Doctrine\DBAL\Driver\OCI8\OCI8Connection;
use Doctrine\Tests\DbalTestCase;
use PHPUnit\Framework\MockObject\MockObject;
use function extension_loaded;
/**
* @requires extension oci8
*/
class OCI8ConnectionTest extends DbalTestCase
{
/**
......@@ -19,10 +20,6 @@ class OCI8ConnectionTest extends DbalTestCase
protected function setUp(): void
{
if (! extension_loaded('oci8')) {
$this->markTestSkipped('oci8 is not installed.');
}
parent::setUp();
$this->connectionMock = $this->getMockBuilder(OCI8Connection::class)
......
......@@ -8,19 +8,11 @@ use Doctrine\DBAL\Driver\OCI8\OCI8Statement;
use Doctrine\Tests\DbalTestCase;
use ReflectionProperty;
use function extension_loaded;
/**
* @requires extension oci8
*/
class OCI8StatementTest extends DbalTestCase
{
protected function setUp(): void
{
if (! extension_loaded('oci8')) {
$this->markTestSkipped('oci8 is not installed.');
}
parent::setUp();
}
/**
* This scenario shows that when the first parameter is not null
* it properly sets $hasZeroIndex to 1 and calls bindValue starting at 1.
......
......@@ -7,8 +7,9 @@ use Doctrine\Tests\DbalTestCase;
use PDOException;
use PHPUnit\Framework\MockObject\MockObject;
use function extension_loaded;
/**
* @requires extension pdo
*/
class ExceptionTest extends DbalTestCase
{
public const ERROR_CODE = 666;
......@@ -33,10 +34,6 @@ class ExceptionTest extends DbalTestCase
protected function setUp(): void
{
if (! extension_loaded('PDO')) {
$this->markTestSkipped('PDO is not installed.');
}
parent::setUp();
$this->wrappedException = new PDOException(self::MESSAGE, self::SQLSTATE);
......
......@@ -6,8 +6,9 @@ use Doctrine\DBAL\Driver\SQLAnywhere\SQLAnywhereConnection;
use Doctrine\Tests\DbalTestCase;
use PHPUnit\Framework\MockObject\MockObject;
use function extension_loaded;
/**
* @requires extension sqlanywhere
*/
class SQLAnywhereConnectionTest extends DbalTestCase
{
/**
......@@ -19,10 +20,6 @@ class SQLAnywhereConnectionTest extends DbalTestCase
protected function setUp(): void
{
if (! extension_loaded('sqlanywhere')) {
$this->markTestSkipped('sqlanywhere is not installed.');
}
parent::setUp();
$this->connectionMock = $this->getMockBuilder(SQLAnywhereConnection::class)
......
......@@ -6,8 +6,6 @@ use Doctrine\DBAL\Driver\SQLSrv\SQLSrvConnection;
use Doctrine\Tests\DbalTestCase;
use PHPUnit\Framework\MockObject\MockObject;
use function extension_loaded;
class SQLSrvConnectionTest extends DbalTestCase
{
/**
......@@ -17,12 +15,11 @@ class SQLSrvConnectionTest extends DbalTestCase
*/
private $connectionMock;
/**
* @requires extension sqlsrv
*/
protected function setUp(): void
{
if (! extension_loaded('sqlsrv')) {
$this->markTestSkipped('sqlsrv is not installed.');
}
parent::setUp();
$this->connectionMock = $this->getMockBuilder(SQLSrvConnection::class)
......
......@@ -6,16 +6,13 @@ use Doctrine\DBAL\Driver as DriverInterface;
use Doctrine\DBAL\Driver\IBMDB2\Driver;
use Doctrine\Tests\DBAL\Functional\Driver\AbstractDriverTest;
use function extension_loaded;
/**
* @requires extension ibm_db2
*/
class DriverTest extends AbstractDriverTest
{
protected function setUp(): void
{
if (! extension_loaded('ibm_db2')) {
$this->markTestSkipped('ibm_db2 is not installed.');
}
parent::setUp();
if ($this->connection->getDriver() instanceof Driver) {
......
......@@ -8,18 +8,15 @@ use Doctrine\DBAL\Driver\Mysqli\MysqliException;
use Doctrine\Tests\DbalFunctionalTestCase;
use Doctrine\Tests\TestUtil;
use function extension_loaded;
use const MYSQLI_OPT_CONNECT_TIMEOUT;
/**
* @requires extension mysqli
*/
class ConnectionTest extends DbalFunctionalTestCase
{
protected function setUp(): void
{
if (! extension_loaded('mysqli')) {
$this->markTestSkipped('mysqli is not installed.');
}
parent::setUp();
if ($this->connection->getDriver() instanceof Driver) {
......
......@@ -6,16 +6,13 @@ use Doctrine\DBAL\Driver as DriverInterface;
use Doctrine\DBAL\Driver\Mysqli\Driver;
use Doctrine\Tests\DBAL\Functional\Driver\AbstractDriverTest;
use function extension_loaded;
/**
* @requires extension mysqli
*/
class DriverTest extends AbstractDriverTest
{
protected function setUp(): void
{
if (! extension_loaded('mysqli')) {
$this->markTestSkipped('mysqli is not installed.');
}
parent::setUp();
if ($this->connection->getDriver() instanceof Driver) {
......
......@@ -7,8 +7,9 @@ use Doctrine\DBAL\Driver\OCI8\Driver;
use Doctrine\DBAL\Schema\Table;
use Doctrine\Tests\DbalFunctionalTestCase;
use function extension_loaded;
/**
* @requires extension oci8
*/
class ConnectionTest extends DbalFunctionalTestCase
{
/** @var Connection */
......@@ -16,10 +17,6 @@ class ConnectionTest extends DbalFunctionalTestCase
protected function setUp(): void
{
if (! extension_loaded('oci8')) {
$this->markTestSkipped('oci8 is not installed.');
}
parent::setUp();
if (! $this->connection->getDriver() instanceof Driver) {
......
......@@ -6,16 +6,13 @@ use Doctrine\DBAL\Driver as DriverInterface;
use Doctrine\DBAL\Driver\OCI8\Driver;
use Doctrine\Tests\DBAL\Functional\Driver\AbstractDriverTest;
use function extension_loaded;
/**
* @requires extension oci8
*/
class DriverTest extends AbstractDriverTest
{
protected function setUp(): void
{
if (! extension_loaded('oci8')) {
$this->markTestSkipped('oci8 is not installed.');
}
parent::setUp();
if ($this->connection->getDriver() instanceof Driver) {
......
......@@ -5,16 +5,13 @@ namespace Doctrine\Tests\DBAL\Functional\Driver\OCI8;
use Doctrine\DBAL\Driver\OCI8\Driver;
use Doctrine\Tests\DbalFunctionalTestCase;
use function extension_loaded;
/**
* @requires extension oci8
*/
class StatementTest extends DbalFunctionalTestCase
{
protected function setUp(): void
{
if (! extension_loaded('oci8')) {
$this->markTestSkipped('oci8 is not installed.');
}
parent::setUp();
if ($this->connection->getDriver() instanceof Driver) {
......
......@@ -10,10 +10,12 @@ use Doctrine\DBAL\Driver\PDO\SQLSrv\Driver as PDOSQLSrvDriver;
use Doctrine\Tests\DbalFunctionalTestCase;
use PDO;
use function extension_loaded;
use function get_class;
use function sprintf;
/**
* @requires extension pdo
*/
class ConnectionTest extends DbalFunctionalTestCase
{
/**
......@@ -25,10 +27,6 @@ class ConnectionTest extends DbalFunctionalTestCase
protected function setUp(): void
{
if (! extension_loaded('PDO')) {
$this->markTestSkipped('PDO is not installed.');
}
parent::setUp();
$this->driverConnection = $this->connection->getWrappedConnection();
......
......@@ -6,16 +6,13 @@ use Doctrine\DBAL\Driver as DriverInterface;
use Doctrine\DBAL\Driver\PDO\MySQL\Driver;
use Doctrine\Tests\DBAL\Functional\Driver\AbstractDriverTest;
use function extension_loaded;
/**
* @requires extension pdo_mysql
*/
class DriverTest extends AbstractDriverTest
{
protected function setUp(): void
{
if (! extension_loaded('pdo_mysql')) {
$this->markTestSkipped('pdo_mysql is not installed.');
}
parent::setUp();
if ($this->connection->getDriver() instanceof Driver) {
......
......@@ -6,16 +6,13 @@ use Doctrine\DBAL\Driver as DriverInterface;
use Doctrine\DBAL\Driver\PDO\OCI\Driver;
use Doctrine\Tests\DBAL\Functional\Driver\AbstractDriverTest;
use function extension_loaded;
/**
* @requires extension pdo_oci
*/
class DriverTest extends AbstractDriverTest
{
protected function setUp(): void
{
if (! extension_loaded('PDO_OCI')) {
$this->markTestSkipped('PDO_OCI is not installed.');
}
parent::setUp();
if ($this->connection->getDriver() instanceof Driver) {
......
......@@ -7,16 +7,13 @@ use Doctrine\DBAL\FetchMode;
use Doctrine\DBAL\Platforms\PostgreSqlPlatform;
use Doctrine\Tests\DbalFunctionalTestCase;
use function extension_loaded;
/**
* @requires extension pdo_pgsql
*/
class ConnectionTest extends DbalFunctionalTestCase
{
protected function setUp(): void
{
if (! extension_loaded('pdo_pgsql')) {
$this->markTestSkipped('pdo_pgsql is not loaded.');
}
parent::setUp();
if ($this->connection->getDatabasePlatform() instanceof PostgreSqlPlatform) {
......
......@@ -9,18 +9,16 @@ use Doctrine\Tests\DBAL\Functional\Driver\AbstractDriverTest;
use Doctrine\Tests\TestUtil;
use function array_key_exists;
use function extension_loaded;
use function microtime;
use function sprintf;
/**
* @requires extension pdo_pgsql
*/
class DriverTest extends AbstractDriverTest
{
protected function setUp(): void
{
if (! extension_loaded('pdo_pgsql')) {
$this->markTestSkipped('pdo_pgsql is not installed.');
}
parent::setUp();
if ($this->connection->getDriver() instanceof Driver) {
......
......@@ -6,16 +6,13 @@ use Doctrine\DBAL\Driver as DriverInterface;
use Doctrine\DBAL\Driver\PDO\SQLite\Driver;
use Doctrine\Tests\DBAL\Functional\Driver\AbstractDriverTest;
use function extension_loaded;
/**
* @requires extension pdo_sqlite
*/
class DriverTest extends AbstractDriverTest
{
protected function setUp(): void
{
if (! extension_loaded('pdo_sqlite')) {
$this->markTestSkipped('pdo_sqlite is not installed.');
}
parent::setUp();
if ($this->connection->getDriver() instanceof Driver) {
......
......@@ -9,16 +9,13 @@ use Doctrine\Tests\DBAL\Functional\Driver\AbstractDriverTest;
use Doctrine\Tests\TestUtil;
use PDO;
use function extension_loaded;
/**
* @requires extension pdo_sqlsrv
*/
class DriverTest extends AbstractDriverTest
{
protected function setUp(): void
{
if (! extension_loaded('pdo_sqlsrv')) {
$this->markTestSkipped('pdo_sqlsrv is not installed.');
}
parent::setUp();
if ($this->connection->getDriver() instanceof Driver) {
......
......@@ -6,16 +6,13 @@ use Doctrine\DBAL\Driver\SQLAnywhere\Driver;
use Doctrine\DBAL\DriverManager;
use Doctrine\Tests\DbalFunctionalTestCase;
use function extension_loaded;
/**
* @requires extension sqlanywhere
*/
class ConnectionTest extends DbalFunctionalTestCase
{
protected function setUp(): void
{
if (! extension_loaded('sqlanywhere')) {
$this->markTestSkipped('sqlanywhere is not installed.');
}
parent::setUp();
if ($this->connection->getDriver() instanceof Driver) {
......
......@@ -7,16 +7,13 @@ use Doctrine\DBAL\Driver as DriverInterface;
use Doctrine\DBAL\Driver\SQLAnywhere\Driver;
use Doctrine\Tests\DBAL\Functional\Driver\AbstractDriverTest;
use function extension_loaded;
/**
* @requires extension sqlanywhere
*/
class DriverTest extends AbstractDriverTest
{
protected function setUp(): void
{
if (! extension_loaded('sqlanywhere')) {
$this->markTestSkipped('sqlanywhere is not installed.');
}
parent::setUp();
if ($this->connection->getDriver() instanceof Driver) {
......
......@@ -6,16 +6,13 @@ use Doctrine\DBAL\Driver\SQLAnywhere\Driver;
use Doctrine\DBAL\DriverManager;
use Doctrine\Tests\DbalFunctionalTestCase;
use function extension_loaded;
/**
* @requires extension sqlanywhere
*/
class StatementTest extends DbalFunctionalTestCase
{
protected function setUp(): void
{
if (! extension_loaded('sqlanywhere')) {
$this->markTestSkipped('sqlanywhere is not installed.');
}
parent::setUp();
if ($this->connection->getDriver() instanceof Driver) {
......
......@@ -6,16 +6,13 @@ use Doctrine\DBAL\Driver as DriverInterface;
use Doctrine\DBAL\Driver\SQLSrv\Driver;
use Doctrine\Tests\DBAL\Functional\Driver\AbstractDriverTest;
use function extension_loaded;
/**
* @requires extension sqlsrv
*/
class DriverTest extends AbstractDriverTest
{
protected function setUp(): void
{
if (! extension_loaded('sqlsrv')) {
$this->markTestSkipped('sqlsrv is not installed.');
}
parent::setUp();
if ($this->connection->getDriver() instanceof Driver) {
......
......@@ -6,16 +6,13 @@ use Doctrine\DBAL\Driver\SQLSrv\Driver;
use Doctrine\DBAL\Driver\SQLSrv\SQLSrvException;
use Doctrine\Tests\DbalFunctionalTestCase;
use function extension_loaded;
/**
* @requires extension sqlsrv
*/
class StatementTest extends DbalFunctionalTestCase
{
protected function setUp(): void
{
if (! extension_loaded('sqlsrv')) {
self::markTestSkipped('sqlsrv is not installed.');
}
parent::setUp();
if ($this->connection->getDriver() instanceof Driver) {
......
......@@ -7,16 +7,13 @@ use Doctrine\DBAL\Schema\Table;
use Doctrine\Tests\DbalFunctionalTestCase;
use PDO;
use function extension_loaded;
/**
* @requires extension pdo
*/
class PDOStatementTest extends DbalFunctionalTestCase
{
protected function setUp(): void
{
if (! extension_loaded('pdo')) {
$this->markTestSkipped('PDO is not installed');
}
parent::setUp();
if (! $this->connection->getWrappedConnection() instanceof Connection) {
......
<?php
namespace Doctrine\Tests\DBAL\Functional\Platform;
use Doctrine\DBAL\Schema\Table;
use Doctrine\Tests\DbalFunctionalTestCase;
use function str_repeat;
/**
* This class holds tests that make sure generated SQL statements respect to platform restrictions
* like maximum element name length
*/
class PlatformRestrictionsTest extends DbalFunctionalTestCase
{
/**
* Tests element names that are at the boundary of the identifier length limit.
* Ensures generated auto-increment identifier name respects to platform restrictions.
*/
public function testMaxIdentifierLengthLimitWithAutoIncrement(): void
{
$platform = $this->connection->getDatabasePlatform();
$tableName = str_repeat('x', $platform->getMaxIdentifierLength());
$columnName = str_repeat('y', $platform->getMaxIdentifierLength());
$table = new Table($tableName);
$table->addColumn($columnName, 'integer', ['autoincrement' => true]);
$table->setPrimaryKey([$columnName]);
$this->connection->getSchemaManager()->dropAndCreateTable($table);
$createdTable = $this->connection->getSchemaManager()->listTableDetails($tableName);
$this->assertTrue($createdTable->hasColumn($columnName));
$this->assertTrue($createdTable->hasPrimaryKey());
}
}
......@@ -9,12 +9,8 @@ use Doctrine\DBAL\Schema\Table;
use Doctrine\DBAL\Types\BlobType;
use Doctrine\DBAL\Types\Type;
use Doctrine\DBAL\Types\Types;
use SQLite3;
use function array_map;
use function dirname;
use function extension_loaded;
use function version_compare;
class SqliteSchemaManagerTest extends SchemaManagerFunctionalTestCase
{
......@@ -160,34 +156,6 @@ EOS
self::assertFalse($table->getColumn('column_binary')->getFixed());
}
public function testNonDefaultPKOrder(): void
{
if (! extension_loaded('sqlite3')) {
$this->markTestSkipped('This test requires the SQLite3 extension.');
}
$version = SQLite3::version();
if (version_compare($version['versionString'], '3.7.16', '<')) {
$this->markTestSkipped('This version of sqlite doesn\'t return the order of the Primary Key.');
}
$this->connection->exec(<<<EOS
CREATE TABLE non_default_pk_order (
id INTEGER,
other_id INTEGER,
PRIMARY KEY(other_id, id)
)
EOS
);
$tableIndexes = $this->schemaManager->listTableIndexes('non_default_pk_order');
self::assertCount(1, $tableIndexes);
self::assertArrayHasKey('primary', $tableIndexes, 'listTableIndexes() has to return a "primary" array key.');
self::assertEquals(['other_id', 'id'], array_map('strtolower', $tableIndexes['primary']->getColumns()));
}
/**
* @group DBAL-1779
*/
......
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