diff --git a/lib/Doctrine/DBAL/Configuration.php b/lib/Doctrine/DBAL/Configuration.php index 9b525b85dff..71b002006ce 100644 --- a/lib/Doctrine/DBAL/Configuration.php +++ b/lib/Doctrine/DBAL/Configuration.php @@ -23,7 +23,7 @@ class Configuration * * @var array */ - protected $_attributes = []; + protected $attributes = []; /** * Sets the SQL logger to use. Defaults to NULL which means SQL logging is disabled. @@ -34,7 +34,7 @@ class Configuration */ public function setSQLLogger(SQLLogger $logger = null) { - $this->_attributes['sqlLogger'] = $logger; + $this->attributes['sqlLogger'] = $logger; } /** @@ -44,7 +44,7 @@ public function setSQLLogger(SQLLogger $logger = null) */ public function getSQLLogger() { - return $this->_attributes['sqlLogger'] ?? null; + return $this->attributes['sqlLogger'] ?? null; } /** @@ -54,7 +54,7 @@ public function getSQLLogger() */ public function getResultCacheImpl() { - return $this->_attributes['resultCacheImpl'] ?? null; + return $this->attributes['resultCacheImpl'] ?? null; } /** @@ -66,7 +66,7 @@ public function getResultCacheImpl() */ public function setResultCacheImpl(Cache $cacheImpl) { - $this->_attributes['resultCacheImpl'] = $cacheImpl; + $this->attributes['resultCacheImpl'] = $cacheImpl; } /** @@ -82,7 +82,7 @@ public function setResultCacheImpl(Cache $cacheImpl) */ public function setFilterSchemaAssetsExpression($filterExpression) { - $this->_attributes['filterSchemaAssetsExpression'] = $filterExpression; + $this->attributes['filterSchemaAssetsExpression'] = $filterExpression; } /** @@ -92,7 +92,7 @@ public function setFilterSchemaAssetsExpression($filterExpression) */ public function getFilterSchemaAssetsExpression() { - return $this->_attributes['filterSchemaAssetsExpression'] ?? null; + return $this->attributes['filterSchemaAssetsExpression'] ?? null; } /** @@ -108,7 +108,7 @@ public function getFilterSchemaAssetsExpression() */ public function setAutoCommit($autoCommit) { - $this->_attributes['autoCommit'] = (boolean) $autoCommit; + $this->attributes['autoCommit'] = (boolean) $autoCommit; } /** @@ -120,6 +120,6 @@ public function setAutoCommit($autoCommit) */ public function getAutoCommit() { - return $this->_attributes['autoCommit'] ?? true; + return $this->attributes['autoCommit'] ?? true; } } diff --git a/lib/Doctrine/DBAL/Connection.php b/lib/Doctrine/DBAL/Connection.php index dcebd4fb8f7..97ca90c10ca 100644 --- a/lib/Doctrine/DBAL/Connection.php +++ b/lib/Doctrine/DBAL/Connection.php @@ -78,29 +78,29 @@ class Connection implements DriverConnection * * @var \Doctrine\DBAL\Driver\Connection */ - protected $_conn; + protected $conn; /** * @var \Doctrine\DBAL\Configuration */ - protected $_config; + protected $config; /** * @var \Doctrine\Common\EventManager */ - protected $_eventManager; + protected $eventManager; /** * @var \Doctrine\DBAL\Query\Expression\ExpressionBuilder */ - protected $_expr; + protected $expr; /** * Whether or not a connection has been established. * * @var boolean */ - private $_isConnected = false; + private $isConnected = false; /** * The current auto-commit mode of this connection. @@ -114,28 +114,28 @@ class Connection implements DriverConnection * * @var integer */ - private $_transactionNestingLevel = 0; + private $transactionNestingLevel = 0; /** * The currently active transaction isolation level. * * @var integer */ - private $_transactionIsolationLevel; + private $transactionIsolationLevel; /** * If nested transactions should use savepoints. * * @var boolean */ - private $_nestTransactionsWithSavepoints = false; + private $nestTransactionsWithSavepoints = false; /** * The parameters used during creation of the Connection instance. * * @var array */ - private $_params = []; + private $params = []; /** * The DatabasePlatform object that provides information about the @@ -150,21 +150,21 @@ class Connection implements DriverConnection * * @var \Doctrine\DBAL\Schema\AbstractSchemaManager */ - protected $_schemaManager; + protected $schemaManager; /** * The used DBAL driver. * * @var \Doctrine\DBAL\Driver */ - protected $_driver; + protected $driver; /** * Flag that indicates whether the current transaction is marked for rollback only. * * @var boolean */ - private $_isRollbackOnly = false; + private $isRollbackOnly = false; /** * @var integer @@ -184,13 +184,13 @@ class Connection implements DriverConnection public function __construct(array $params, Driver $driver, Configuration $config = null, EventManager $eventManager = null) { - $this->_driver = $driver; - $this->_params = $params; + $this->driver = $driver; + $this->params = $params; if (isset($params['pdo'])) { - $this->_conn = $params['pdo']; - $this->_isConnected = true; - unset($this->_params['pdo']); + $this->conn = $params['pdo']; + $this->isConnected = true; + unset($this->params['pdo']); } if (isset($params["platform"])) { @@ -199,7 +199,7 @@ public function __construct(array $params, Driver $driver, Configuration $config } $this->platform = $params["platform"]; - unset($this->_params["platform"]); + unset($this->params["platform"]); } // Create default config and event manager if none given @@ -211,10 +211,10 @@ public function __construct(array $params, Driver $driver, Configuration $config $eventManager = new EventManager(); } - $this->_config = $config; - $this->_eventManager = $eventManager; + $this->config = $config; + $this->eventManager = $eventManager; - $this->_expr = new Query\Expression\ExpressionBuilder($this); + $this->expr = new Query\Expression\ExpressionBuilder($this); $this->autoCommit = $config->getAutoCommit(); } @@ -226,7 +226,7 @@ public function __construct(array $params, Driver $driver, Configuration $config */ public function getParams() { - return $this->_params; + return $this->params; } /** @@ -236,7 +236,7 @@ public function getParams() */ public function getDatabase() { - return $this->_driver->getDatabase($this); + return $this->driver->getDatabase($this); } /** @@ -246,7 +246,7 @@ public function getDatabase() */ public function getHost() { - return $this->_params['host'] ?? null; + return $this->params['host'] ?? null; } /** @@ -256,7 +256,7 @@ public function getHost() */ public function getPort() { - return $this->_params['port'] ?? null; + return $this->params['port'] ?? null; } /** @@ -266,7 +266,7 @@ public function getPort() */ public function getUsername() { - return $this->_params['user'] ?? null; + return $this->params['user'] ?? null; } /** @@ -276,7 +276,7 @@ public function getUsername() */ public function getPassword() { - return $this->_params['password'] ?? null; + return $this->params['password'] ?? null; } /** @@ -286,7 +286,7 @@ public function getPassword() */ public function getDriver() { - return $this->_driver; + return $this->driver; } /** @@ -296,7 +296,7 @@ public function getDriver() */ public function getConfiguration() { - return $this->_config; + return $this->config; } /** @@ -306,7 +306,7 @@ public function getConfiguration() */ public function getEventManager() { - return $this->_eventManager; + return $this->eventManager; } /** @@ -332,7 +332,7 @@ public function getDatabasePlatform() */ public function getExpressionBuilder() { - return $this->_expr; + return $this->expr; } /** @@ -343,24 +343,24 @@ public function getExpressionBuilder() */ public function connect() { - if ($this->_isConnected) { + if ($this->isConnected) { return false; } - $driverOptions = $this->_params['driverOptions'] ?? []; - $user = $this->_params['user'] ?? null; - $password = $this->_params['password'] ?? null; + $driverOptions = $this->params['driverOptions'] ?? []; + $user = $this->params['user'] ?? null; + $password = $this->params['password'] ?? null; - $this->_conn = $this->_driver->connect($this->_params, $user, $password, $driverOptions); - $this->_isConnected = true; + $this->conn = $this->driver->connect($this->params, $user, $password, $driverOptions); + $this->isConnected = true; if (false === $this->autoCommit) { $this->beginTransaction(); } - if ($this->_eventManager->hasListeners(Events::postConnect)) { + if ($this->eventManager->hasListeners(Events::postConnect)) { $eventArgs = new Event\ConnectionEventArgs($this); - $this->_eventManager->dispatchEvent(Events::postConnect, $eventArgs); + $this->eventManager->dispatchEvent(Events::postConnect, $eventArgs); } return true; @@ -378,12 +378,12 @@ private function detectDatabasePlatform() $version = $this->getDatabasePlatformVersion(); if (null !== $version) { - $this->platform = $this->_driver->createDatabasePlatformForVersion($version); + $this->platform = $this->driver->createDatabasePlatformForVersion($version); } else { - $this->platform = $this->_driver->getDatabasePlatform(); + $this->platform = $this->driver->getDatabasePlatform(); } - $this->platform->setEventManager($this->_eventManager); + $this->platform->setEventManager($this->eventManager); } /** @@ -401,28 +401,28 @@ private function detectDatabasePlatform() private function getDatabasePlatformVersion() { // Driver does not support version specific platforms. - if ( ! $this->_driver instanceof VersionAwarePlatformDriver) { + if ( ! $this->driver instanceof VersionAwarePlatformDriver) { return null; } // Explicit platform version requested (supersedes auto-detection). - if (isset($this->_params['serverVersion'])) { - return $this->_params['serverVersion']; + if (isset($this->params['serverVersion'])) { + return $this->params['serverVersion']; } // If not connected, we need to connect now to determine the platform version. - if (null === $this->_conn) { + if (null === $this->conn) { try { $this->connect(); } catch (\Exception $originalException) { - if (empty($this->_params['dbname'])) { + if (empty($this->params['dbname'])) { throw $originalException; } // The database to connect to might not yet exist. // Retry detection without database name connection parameter. - $databaseName = $this->_params['dbname']; - $this->_params['dbname'] = null; + $databaseName = $this->params['dbname']; + $this->params['dbname'] = null; try { $this->connect(); @@ -430,13 +430,13 @@ private function getDatabasePlatformVersion() // Either the platform does not support database-less connections // or something else went wrong. // Reset connection parameters and rethrow the original exception. - $this->_params['dbname'] = $databaseName; + $this->params['dbname'] = $databaseName; throw $originalException; } // Reset connection parameters. - $this->_params['dbname'] = $databaseName; + $this->params['dbname'] = $databaseName; $serverVersion = $this->getServerVersion(); // Close "temporary" connection to allow connecting to the real database again. @@ -458,10 +458,10 @@ private function getDatabasePlatformVersion() private function getServerVersion() { // Automatic platform version detection. - if ($this->_conn instanceof ServerInfoAwareConnection && - ! $this->_conn->requiresQueryForServerVersion() + if ($this->conn instanceof ServerInfoAwareConnection && + ! $this->conn->requiresQueryForServerVersion() ) { - return $this->_conn->getServerVersion(); + return $this->conn->getServerVersion(); } // Unable to detect platform version. @@ -506,7 +506,7 @@ public function setAutoCommit($autoCommit) $this->autoCommit = $autoCommit; // Commit all currently active transactions if any when switching auto-commit mode. - if (true === $this->_isConnected && 0 !== $this->_transactionNestingLevel) { + if (true === $this->isConnected && 0 !== $this->transactionNestingLevel) { $this->commitAll(); } } @@ -580,7 +580,7 @@ public function fetchColumn($statement, array $params = [], $column = 0, array $ */ public function isConnected() { - return $this->_isConnected; + return $this->isConnected; } /** @@ -590,7 +590,7 @@ public function isConnected() */ public function isTransactionActive() { - return $this->_transactionNestingLevel > 0; + return $this->transactionNestingLevel > 0; } /** @@ -659,9 +659,9 @@ public function delete($tableExpression, array $identifier, array $types = []) */ public function close() { - $this->_conn = null; + $this->conn = null; - $this->_isConnected = false; + $this->isConnected = false; } /** @@ -673,7 +673,7 @@ public function close() */ public function setTransactionIsolation($level) { - $this->_transactionIsolationLevel = $level; + $this->transactionIsolationLevel = $level; return $this->executeUpdate($this->getDatabasePlatform()->getSetTransactionIsolationSQL($level)); } @@ -685,11 +685,11 @@ public function setTransactionIsolation($level) */ public function getTransactionIsolation() { - if (null === $this->_transactionIsolationLevel) { - $this->_transactionIsolationLevel = $this->getDatabasePlatform()->getDefaultTransactionIsolationLevel(); + if (null === $this->transactionIsolationLevel) { + $this->transactionIsolationLevel = $this->getDatabasePlatform()->getDefaultTransactionIsolationLevel(); } - return $this->_transactionIsolationLevel; + return $this->transactionIsolationLevel; } /** @@ -821,7 +821,7 @@ public function quote($input, $type = null) list($value, $bindingType) = $this->getBindingInfo($input, $type); - return $this->_conn->quote($value, $bindingType); + return $this->conn->quote($value, $bindingType); } /** @@ -852,7 +852,7 @@ public function prepare($statement) try { $stmt = new Statement($statement, $this); } catch (Exception $ex) { - throw DBALException::driverExceptionDuringQuery($this->_driver, $ex, $statement); + throw DBALException::driverExceptionDuringQuery($this->driver, $ex, $statement); } $stmt->setFetchMode($this->defaultFetchMode); @@ -883,7 +883,7 @@ public function executeQuery($query, array $params = [], $types = [], QueryCache $this->connect(); - $logger = $this->_config->getSQLLogger(); + $logger = $this->config->getSQLLogger(); if ($logger) { $logger->startQuery($query, $params, $types); } @@ -892,18 +892,18 @@ public function executeQuery($query, array $params = [], $types = [], QueryCache if ($params) { list($query, $params, $types) = SQLParserUtils::expandListParameters($query, $params, $types); - $stmt = $this->_conn->prepare($query); + $stmt = $this->conn->prepare($query); if ($types) { - $this->_bindTypedValues($stmt, $params, $types); + $this->bindTypedValues($stmt, $params, $types); $stmt->execute(); } else { $stmt->execute($params); } } else { - $stmt = $this->_conn->query($query); + $stmt = $this->conn->query($query); } } catch (Exception $ex) { - throw DBALException::driverExceptionDuringQuery($this->_driver, $ex, $query, $this->resolveParams($params, $types)); + throw DBALException::driverExceptionDuringQuery($this->driver, $ex, $query, $this->resolveParams($params, $types)); } $stmt->setFetchMode($this->defaultFetchMode); @@ -929,7 +929,7 @@ public function executeQuery($query, array $params = [], $types = [], QueryCache */ public function executeCacheQuery($query, $params, $types, QueryCacheProfile $qcp) { - $resultCache = $qcp->getResultCacheDriver() ?: $this->_config->getResultCacheImpl(); + $resultCache = $qcp->getResultCacheDriver() ?: $this->config->getResultCacheImpl(); if ( ! $resultCache) { throw CacheException::noResultDriverConfigured(); } @@ -994,15 +994,15 @@ public function query() $args = func_get_args(); - $logger = $this->_config->getSQLLogger(); + $logger = $this->config->getSQLLogger(); if ($logger) { $logger->startQuery($args[0]); } try { - $statement = $this->_conn->query(...$args); + $statement = $this->conn->query(...$args); } catch (Exception $ex) { - throw DBALException::driverExceptionDuringQuery($this->_driver, $ex, $args[0]); + throw DBALException::driverExceptionDuringQuery($this->driver, $ex, $args[0]); } $statement->setFetchMode($this->defaultFetchMode); @@ -1032,7 +1032,7 @@ public function executeUpdate($query, array $params = [], array $types = []) { $this->connect(); - $logger = $this->_config->getSQLLogger(); + $logger = $this->config->getSQLLogger(); if ($logger) { $logger->startQuery($query, $params, $types); } @@ -1041,19 +1041,19 @@ public function executeUpdate($query, array $params = [], array $types = []) if ($params) { list($query, $params, $types) = SQLParserUtils::expandListParameters($query, $params, $types); - $stmt = $this->_conn->prepare($query); + $stmt = $this->conn->prepare($query); if ($types) { - $this->_bindTypedValues($stmt, $params, $types); + $this->bindTypedValues($stmt, $params, $types); $stmt->execute(); } else { $stmt->execute($params); } $result = $stmt->rowCount(); } else { - $result = $this->_conn->exec($query); + $result = $this->conn->exec($query); } } catch (Exception $ex) { - throw DBALException::driverExceptionDuringQuery($this->_driver, $ex, $query, $this->resolveParams($params, $types)); + throw DBALException::driverExceptionDuringQuery($this->driver, $ex, $query, $this->resolveParams($params, $types)); } if ($logger) { @@ -1076,15 +1076,15 @@ public function exec($statement) { $this->connect(); - $logger = $this->_config->getSQLLogger(); + $logger = $this->config->getSQLLogger(); if ($logger) { $logger->startQuery($statement); } try { - $result = $this->_conn->exec($statement); + $result = $this->conn->exec($statement); } catch (Exception $ex) { - throw DBALException::driverExceptionDuringQuery($this->_driver, $ex, $statement); + throw DBALException::driverExceptionDuringQuery($this->driver, $ex, $statement); } if ($logger) { @@ -1101,7 +1101,7 @@ public function exec($statement) */ public function getTransactionNestingLevel() { - return $this->_transactionNestingLevel; + return $this->transactionNestingLevel; } /** @@ -1113,7 +1113,7 @@ public function errorCode() { $this->connect(); - return $this->_conn->errorCode(); + return $this->conn->errorCode(); } /** @@ -1125,7 +1125,7 @@ public function errorInfo() { $this->connect(); - return $this->_conn->errorInfo(); + return $this->conn->errorInfo(); } /** @@ -1144,7 +1144,7 @@ public function lastInsertId($seqName = null) { $this->connect(); - return $this->_conn->lastInsertId($seqName); + return $this->conn->lastInsertId($seqName); } /** @@ -1189,7 +1189,7 @@ public function transactional(Closure $func) */ public function setNestTransactionsWithSavepoints($nestTransactionsWithSavepoints) { - if ($this->_transactionNestingLevel > 0) { + if ($this->transactionNestingLevel > 0) { throw ConnectionException::mayNotAlterNestedTransactionWithSavepointsInTransaction(); } @@ -1197,7 +1197,7 @@ public function setNestTransactionsWithSavepoints($nestTransactionsWithSavepoint throw ConnectionException::savepointsNotSupported(); } - $this->_nestTransactionsWithSavepoints = (bool) $nestTransactionsWithSavepoints; + $this->nestTransactionsWithSavepoints = (bool) $nestTransactionsWithSavepoints; } /** @@ -1207,7 +1207,7 @@ public function setNestTransactionsWithSavepoints($nestTransactionsWithSavepoint */ public function getNestTransactionsWithSavepoints() { - return $this->_nestTransactionsWithSavepoints; + return $this->nestTransactionsWithSavepoints; } /** @@ -1216,9 +1216,9 @@ public function getNestTransactionsWithSavepoints() * * @return mixed A string with the savepoint name or false. */ - protected function _getNestedTransactionSavePointName() + protected function getNestedTransactionSavePointName() { - return 'DOCTRINE2_SAVEPOINT_'.$this->_transactionNestingLevel; + return 'DOCTRINE2_SAVEPOINT_'.$this->transactionNestingLevel; } /** @@ -1230,23 +1230,23 @@ public function beginTransaction() { $this->connect(); - ++$this->_transactionNestingLevel; + ++$this->transactionNestingLevel; - $logger = $this->_config->getSQLLogger(); + $logger = $this->config->getSQLLogger(); - if ($this->_transactionNestingLevel == 1) { + if ($this->transactionNestingLevel == 1) { if ($logger) { $logger->startQuery('"START TRANSACTION"'); } - $this->_conn->beginTransaction(); + $this->conn->beginTransaction(); if ($logger) { $logger->stopQuery(); } - } elseif ($this->_nestTransactionsWithSavepoints) { + } elseif ($this->nestTransactionsWithSavepoints) { if ($logger) { $logger->startQuery('"SAVEPOINT"'); } - $this->createSavepoint($this->_getNestedTransactionSavePointName()); + $this->createSavepoint($this->getNestedTransactionSavePointName()); if ($logger) { $logger->stopQuery(); } @@ -1263,38 +1263,38 @@ public function beginTransaction() */ public function commit() { - if ($this->_transactionNestingLevel == 0) { + if ($this->transactionNestingLevel == 0) { throw ConnectionException::noActiveTransaction(); } - if ($this->_isRollbackOnly) { + if ($this->isRollbackOnly) { throw ConnectionException::commitFailedRollbackOnly(); } $this->connect(); - $logger = $this->_config->getSQLLogger(); + $logger = $this->config->getSQLLogger(); - if ($this->_transactionNestingLevel == 1) { + if ($this->transactionNestingLevel == 1) { if ($logger) { $logger->startQuery('"COMMIT"'); } - $this->_conn->commit(); + $this->conn->commit(); if ($logger) { $logger->stopQuery(); } - } elseif ($this->_nestTransactionsWithSavepoints) { + } elseif ($this->nestTransactionsWithSavepoints) { if ($logger) { $logger->startQuery('"RELEASE SAVEPOINT"'); } - $this->releaseSavepoint($this->_getNestedTransactionSavePointName()); + $this->releaseSavepoint($this->getNestedTransactionSavePointName()); if ($logger) { $logger->stopQuery(); } } - --$this->_transactionNestingLevel; + --$this->transactionNestingLevel; - if (false === $this->autoCommit && 0 === $this->_transactionNestingLevel) { + if (false === $this->autoCommit && 0 === $this->transactionNestingLevel) { $this->beginTransaction(); } } @@ -1304,8 +1304,8 @@ public function commit() */ private function commitAll() { - while (0 !== $this->_transactionNestingLevel) { - if (false === $this->autoCommit && 1 === $this->_transactionNestingLevel) { + while (0 !== $this->transactionNestingLevel) { + if (false === $this->autoCommit && 1 === $this->transactionNestingLevel) { // When in no auto-commit mode, the last nesting commit immediately starts a new transaction. // Therefore we need to do the final commit here and then leave to avoid an infinite loop. $this->commit(); @@ -1324,21 +1324,21 @@ private function commitAll() */ public function rollBack() { - if ($this->_transactionNestingLevel == 0) { + if ($this->transactionNestingLevel == 0) { throw ConnectionException::noActiveTransaction(); } $this->connect(); - $logger = $this->_config->getSQLLogger(); + $logger = $this->config->getSQLLogger(); - if ($this->_transactionNestingLevel == 1) { + if ($this->transactionNestingLevel == 1) { if ($logger) { $logger->startQuery('"ROLLBACK"'); } - $this->_transactionNestingLevel = 0; - $this->_conn->rollBack(); - $this->_isRollbackOnly = false; + $this->transactionNestingLevel = 0; + $this->conn->rollBack(); + $this->isRollbackOnly = false; if ($logger) { $logger->stopQuery(); } @@ -1346,18 +1346,18 @@ public function rollBack() if (false === $this->autoCommit) { $this->beginTransaction(); } - } elseif ($this->_nestTransactionsWithSavepoints) { + } elseif ($this->nestTransactionsWithSavepoints) { if ($logger) { $logger->startQuery('"ROLLBACK TO SAVEPOINT"'); } - $this->rollbackSavepoint($this->_getNestedTransactionSavePointName()); - --$this->_transactionNestingLevel; + $this->rollbackSavepoint($this->getNestedTransactionSavePointName()); + --$this->transactionNestingLevel; if ($logger) { $logger->stopQuery(); } } else { - $this->_isRollbackOnly = true; - --$this->_transactionNestingLevel; + $this->isRollbackOnly = true; + --$this->transactionNestingLevel; } } @@ -1376,7 +1376,7 @@ public function createSavepoint($savepoint) throw ConnectionException::savepointsNotSupported(); } - $this->_conn->exec($this->platform->createSavePoint($savepoint)); + $this->conn->exec($this->platform->createSavePoint($savepoint)); } /** @@ -1395,7 +1395,7 @@ public function releaseSavepoint($savepoint) } if ($this->platform->supportsReleaseSavepoints()) { - $this->_conn->exec($this->platform->releaseSavePoint($savepoint)); + $this->conn->exec($this->platform->releaseSavePoint($savepoint)); } } @@ -1414,7 +1414,7 @@ public function rollbackSavepoint($savepoint) throw ConnectionException::savepointsNotSupported(); } - $this->_conn->exec($this->platform->rollbackSavePoint($savepoint)); + $this->conn->exec($this->platform->rollbackSavePoint($savepoint)); } /** @@ -1426,7 +1426,7 @@ public function getWrappedConnection() { $this->connect(); - return $this->_conn; + return $this->conn; } /** @@ -1437,11 +1437,11 @@ public function getWrappedConnection() */ public function getSchemaManager() { - if ( ! $this->_schemaManager) { - $this->_schemaManager = $this->_driver->getSchemaManager($this); + if ( ! $this->schemaManager) { + $this->schemaManager = $this->driver->getSchemaManager($this); } - return $this->_schemaManager; + return $this->schemaManager; } /** @@ -1454,10 +1454,10 @@ public function getSchemaManager() */ public function setRollbackOnly() { - if ($this->_transactionNestingLevel == 0) { + if ($this->transactionNestingLevel == 0) { throw ConnectionException::noActiveTransaction(); } - $this->_isRollbackOnly = true; + $this->isRollbackOnly = true; } /** @@ -1469,11 +1469,11 @@ public function setRollbackOnly() */ public function isRollbackOnly() { - if ($this->_transactionNestingLevel == 0) { + if ($this->transactionNestingLevel == 0) { throw ConnectionException::noActiveTransaction(); } - return $this->_isRollbackOnly; + return $this->isRollbackOnly; } /** @@ -1517,7 +1517,7 @@ public function convertToPHPValue($value, $type) * @internal Duck-typing used on the $stmt parameter to support driver statements as well as * raw PDOStatement instances. */ - private function _bindTypedValues($stmt, array $params, array $types) + private function bindTypedValues($stmt, array $params, array $types) { // Check whether parameters are positional or named. Mixing is not allowed, just like in PDO. if (is_int(key($params))) { @@ -1654,8 +1654,8 @@ public function ping() { $this->connect(); - if ($this->_conn instanceof PingableConnection) { - return $this->_conn->ping(); + if ($this->conn instanceof PingableConnection) { + return $this->conn->ping(); } try { diff --git a/lib/Doctrine/DBAL/Connections/MasterSlaveConnection.php b/lib/Doctrine/DBAL/Connections/MasterSlaveConnection.php index 0594f9123e9..b94e46f1c68 100644 --- a/lib/Doctrine/DBAL/Connections/MasterSlaveConnection.php +++ b/lib/Doctrine/DBAL/Connections/MasterSlaveConnection.php @@ -116,7 +116,7 @@ public function __construct(array $params, Driver $driver, Configuration $config */ public function isConnectedToMaster() { - return $this->_conn !== null && $this->_conn === $this->connections['master']; + return $this->conn !== null && $this->conn === $this->connections['master']; } /** @@ -134,7 +134,7 @@ public function connect($connectionName = null) // If we have a connection open, and this is not an explicit connection // change request, then abort right here, because we are already done. // This prevents writes to the slave in case of "keepSlave" option enabled. - if (isset($this->_conn) && $this->_conn && !$requestedConnectionChange) { + if (isset($this->conn) && $this->conn && !$requestedConnectionChange) { return false; } @@ -146,29 +146,29 @@ public function connect($connectionName = null) } if (isset($this->connections[$connectionName]) && $this->connections[$connectionName]) { - $this->_conn = $this->connections[$connectionName]; + $this->conn = $this->connections[$connectionName]; if ($forceMasterAsSlave && ! $this->keepSlave) { - $this->connections['slave'] = $this->_conn; + $this->connections['slave'] = $this->conn; } return false; } if ($connectionName === 'master') { - $this->connections['master'] = $this->_conn = $this->connectTo($connectionName); + $this->connections['master'] = $this->conn = $this->connectTo($connectionName); // Set slave connection to master to avoid invalid reads if ( ! $this->keepSlave) { $this->connections['slave'] = $this->connections['master']; } } else { - $this->connections['slave'] = $this->_conn = $this->connectTo($connectionName); + $this->connections['slave'] = $this->conn = $this->connectTo($connectionName); } - if ($this->_eventManager->hasListeners(Events::postConnect)) { + if ($this->eventManager->hasListeners(Events::postConnect)) { $eventArgs = new ConnectionEventArgs($this); - $this->_eventManager->dispatchEvent(Events::postConnect, $eventArgs); + $this->eventManager->dispatchEvent(Events::postConnect, $eventArgs); } return true; @@ -192,7 +192,7 @@ protected function connectTo($connectionName) $user = $connectionParams['user'] ?? null; $password = $connectionParams['password'] ?? null; - return $this->_driver->connect($connectionParams, $user, $password, $driverOptions); + return $this->driver->connect($connectionParams, $user, $password, $driverOptions); } /** @@ -275,7 +275,7 @@ public function close() parent::close(); - $this->_conn = null; + $this->conn = null; $this->connections = ['master' => null, 'slave' => null]; } @@ -353,7 +353,7 @@ public function query() $logger->startQuery($args[0]); } - $statement = $this->_conn->query(...$args); + $statement = $this->conn->query(...$args); if ($logger) { $logger->stopQuery(); diff --git a/lib/Doctrine/DBAL/Driver/IBMDB2/DB2Connection.php b/lib/Doctrine/DBAL/Driver/IBMDB2/DB2Connection.php index 8feeb39fae0..28a0b62eb94 100644 --- a/lib/Doctrine/DBAL/Driver/IBMDB2/DB2Connection.php +++ b/lib/Doctrine/DBAL/Driver/IBMDB2/DB2Connection.php @@ -11,7 +11,7 @@ class DB2Connection implements Connection, ServerInfoAwareConnection /** * @var resource */ - private $_conn = null; + private $conn = null; /** * @param array $params @@ -26,11 +26,11 @@ public function __construct(array $params, $username, $password, $driverOptions $isPersistent = (isset($params['persistent']) && $params['persistent'] == true); if ($isPersistent) { - $this->_conn = db2_pconnect($params['dbname'], $username, $password, $driverOptions); + $this->conn = db2_pconnect($params['dbname'], $username, $password, $driverOptions); } else { - $this->_conn = db2_connect($params['dbname'], $username, $password, $driverOptions); + $this->conn = db2_connect($params['dbname'], $username, $password, $driverOptions); } - if ( ! $this->_conn) { + if ( ! $this->conn) { throw new DB2Exception(db2_conn_errormsg()); } } @@ -40,7 +40,7 @@ public function __construct(array $params, $username, $password, $driverOptions */ public function getServerVersion() { - $serverInfo = db2_server_info($this->_conn); + $serverInfo = db2_server_info($this->conn); return $serverInfo->DBMS_VER; } @@ -58,7 +58,7 @@ public function requiresQueryForServerVersion() */ public function prepare($sql) { - $stmt = @db2_prepare($this->_conn, $sql); + $stmt = @db2_prepare($this->conn, $sql); if ( ! $stmt) { throw new DB2Exception(db2_stmt_errormsg()); } @@ -98,7 +98,7 @@ public function quote($input, $type = ParameterType::STRING) */ public function exec($statement) { - $stmt = @db2_exec($this->_conn, $statement); + $stmt = @db2_exec($this->conn, $statement); if (false === $stmt) { throw new DB2Exception(db2_stmt_errormsg()); @@ -112,7 +112,7 @@ public function exec($statement) */ public function lastInsertId($name = null) { - return db2_last_insert_id($this->_conn); + return db2_last_insert_id($this->conn); } /** @@ -120,7 +120,7 @@ public function lastInsertId($name = null) */ public function beginTransaction() { - db2_autocommit($this->_conn, DB2_AUTOCOMMIT_OFF); + db2_autocommit($this->conn, DB2_AUTOCOMMIT_OFF); } /** @@ -128,10 +128,10 @@ public function beginTransaction() */ public function commit() { - if (!db2_commit($this->_conn)) { - throw new DB2Exception(db2_conn_errormsg($this->_conn)); + if (!db2_commit($this->conn)) { + throw new DB2Exception(db2_conn_errormsg($this->conn)); } - db2_autocommit($this->_conn, DB2_AUTOCOMMIT_ON); + db2_autocommit($this->conn, DB2_AUTOCOMMIT_ON); } /** @@ -139,10 +139,10 @@ public function commit() */ public function rollBack() { - if (!db2_rollback($this->_conn)) { - throw new DB2Exception(db2_conn_errormsg($this->_conn)); + if (!db2_rollback($this->conn)) { + throw new DB2Exception(db2_conn_errormsg($this->conn)); } - db2_autocommit($this->_conn, DB2_AUTOCOMMIT_ON); + db2_autocommit($this->conn, DB2_AUTOCOMMIT_ON); } /** @@ -150,7 +150,7 @@ public function rollBack() */ public function errorCode() { - return db2_conn_error($this->_conn); + return db2_conn_error($this->conn); } /** @@ -159,7 +159,7 @@ public function errorCode() public function errorInfo() { return [ - 0 => db2_conn_errormsg($this->_conn), + 0 => db2_conn_errormsg($this->conn), 1 => $this->errorCode(), ]; } diff --git a/lib/Doctrine/DBAL/Driver/IBMDB2/DB2Statement.php b/lib/Doctrine/DBAL/Driver/IBMDB2/DB2Statement.php index 2d8a8c6a432..0483c173c72 100644 --- a/lib/Doctrine/DBAL/Driver/IBMDB2/DB2Statement.php +++ b/lib/Doctrine/DBAL/Driver/IBMDB2/DB2Statement.php @@ -12,12 +12,12 @@ class DB2Statement implements \IteratorAggregate, Statement /** * @var resource */ - private $_stmt; + private $stmt; /** * @var array */ - private $_bindParam = []; + private $bindParam = []; /** * @var string Name of the default class to instantiate when fetching class instances. @@ -32,7 +32,7 @@ class DB2Statement implements \IteratorAggregate, Statement /** * @var integer */ - private $_defaultFetchMode = FetchMode::MIXED; + private $defaultFetchMode = FetchMode::MIXED; /** * Indicates whether the statement is in the state when fetching results is possible @@ -46,7 +46,7 @@ class DB2Statement implements \IteratorAggregate, Statement * * @var array */ - static private $_typeMap = [ + static private $typeMap = [ ParameterType::INTEGER => DB2_LONG, ParameterType::STRING => DB2_CHAR, ]; @@ -56,7 +56,7 @@ class DB2Statement implements \IteratorAggregate, Statement */ public function __construct($stmt) { - $this->_stmt = $stmt; + $this->stmt = $stmt; } /** @@ -72,15 +72,15 @@ public function bindValue($param, $value, $type = ParameterType::STRING) */ public function bindParam($column, &$variable, $type = ParameterType::STRING, $length = null) { - $this->_bindParam[$column] =& $variable; + $this->bindParam[$column] =& $variable; - if ($type && isset(self::$_typeMap[$type])) { - $type = self::$_typeMap[$type]; + if ($type && isset(self::$typeMap[$type])) { + $type = self::$typeMap[$type]; } else { $type = DB2_CHAR; } - if (!db2_bind_param($this->_stmt, $column, "variable", DB2_PARAM_IN, $type)) { + if (!db2_bind_param($this->stmt, $column, "variable", DB2_PARAM_IN, $type)) { throw new DB2Exception(db2_stmt_errormsg()); } @@ -92,13 +92,13 @@ public function bindParam($column, &$variable, $type = ParameterType::STRING, $l */ public function closeCursor() { - if ( ! $this->_stmt) { + if ( ! $this->stmt) { return false; } - $this->_bindParam = []; + $this->bindParam = []; - if (!db2_free_result($this->_stmt)) { + if (!db2_free_result($this->stmt)) { return false; } @@ -112,11 +112,11 @@ public function closeCursor() */ public function columnCount() { - if ( ! $this->_stmt) { + if ( ! $this->stmt) { return false; } - return db2_num_fields($this->_stmt); + return db2_num_fields($this->stmt); } /** @@ -143,21 +143,21 @@ public function errorInfo() */ public function execute($params = null) { - if ( ! $this->_stmt) { + if ( ! $this->stmt) { return false; } if ($params === null) { - ksort($this->_bindParam); + ksort($this->bindParam); $params = []; - foreach ($this->_bindParam as $column => $value) { + foreach ($this->bindParam as $column => $value) { $params[] = $value; } } - $retval = db2_execute($this->_stmt, $params); + $retval = db2_execute($this->stmt, $params); if ($retval === false) { throw new DB2Exception(db2_stmt_errormsg()); @@ -173,7 +173,7 @@ public function execute($params = null) */ public function setFetchMode($fetchMode, ...$args) { - $this->_defaultFetchMode = $fetchMode; + $this->defaultFetchMode = $fetchMode; if (isset($args[0])) { $this->defaultFetchClass = $args[0]; @@ -205,16 +205,16 @@ public function fetch($fetchMode = null, ...$args) return false; } - $fetchMode = $fetchMode ?: $this->_defaultFetchMode; + $fetchMode = $fetchMode ?: $this->defaultFetchMode; switch ($fetchMode) { case FetchMode::COLUMN: return $this->fetchColumn(); case FetchMode::MIXED: - return db2_fetch_both($this->_stmt); + return db2_fetch_both($this->stmt); case FetchMode::ASSOCIATIVE: - return db2_fetch_assoc($this->_stmt); + return db2_fetch_assoc($this->stmt); case FetchMode::CUSTOM_OBJECT: $className = $this->defaultFetchClass; @@ -225,7 +225,7 @@ public function fetch($fetchMode = null, ...$args) $ctorArgs = $args[1] ?? []; } - $result = db2_fetch_object($this->_stmt); + $result = db2_fetch_object($this->stmt); if ($result instanceof \stdClass) { $result = $this->castObject($result, $className, $ctorArgs); @@ -234,10 +234,10 @@ public function fetch($fetchMode = null, ...$args) return $result; case FetchMode::NUMERIC: - return db2_fetch_array($this->_stmt); + return db2_fetch_array($this->stmt); case FetchMode::STANDARD_OBJECT: - return db2_fetch_object($this->_stmt); + return db2_fetch_object($this->stmt); default: throw new DB2Exception('Given Fetch-Style ' . $fetchMode . ' is not supported.'); @@ -290,7 +290,7 @@ public function fetchColumn($columnIndex = 0) */ public function rowCount() { - return (@db2_num_rows($this->_stmt)) ? : 0; + return (@db2_num_rows($this->stmt)) ? : 0; } /** diff --git a/lib/Doctrine/DBAL/Driver/Mysqli/MysqliConnection.php b/lib/Doctrine/DBAL/Driver/Mysqli/MysqliConnection.php index fce1a44776b..edcf89b05d5 100644 --- a/lib/Doctrine/DBAL/Driver/Mysqli/MysqliConnection.php +++ b/lib/Doctrine/DBAL/Driver/Mysqli/MysqliConnection.php @@ -21,7 +21,7 @@ class MysqliConnection implements Connection, PingableConnection, ServerInfoAwar /** * @var \mysqli */ - private $_conn; + private $conn; /** * @param array $params @@ -45,22 +45,22 @@ public function __construct(array $params, $username, $password, array $driverOp $flags = $driverOptions[static::OPTION_FLAGS] ?? null; - $this->_conn = mysqli_init(); + $this->conn = mysqli_init(); $this->setSecureConnection($params); $this->setDriverOptions($driverOptions); set_error_handler(function () {}); try { - if ( ! $this->_conn->real_connect($params['host'], $username, $password, $dbname, $port, $socket, $flags)) { - throw new MysqliException($this->_conn->connect_error, $this->_conn->sqlstate ?? 'HY000', $this->_conn->connect_errno); + if ( ! $this->conn->real_connect($params['host'], $username, $password, $dbname, $port, $socket, $flags)) { + throw new MysqliException($this->conn->connect_error, $this->conn->sqlstate ?? 'HY000', $this->conn->connect_errno); } } finally { restore_error_handler(); } if (isset($params['charset'])) { - $this->_conn->set_charset($params['charset']); + $this->conn->set_charset($params['charset']); } } @@ -73,7 +73,7 @@ public function __construct(array $params, $username, $password, array $driverOp */ public function getWrappedResourceHandle() { - return $this->_conn; + return $this->conn; } /** @@ -85,14 +85,14 @@ public function getWrappedResourceHandle() */ public function getServerVersion() { - $serverInfos = $this->_conn->get_server_info(); + $serverInfos = $this->conn->get_server_info(); if (false !== stripos($serverInfos, 'mariadb')) { return $serverInfos; } - $majorVersion = floor($this->_conn->server_version / 10000); - $minorVersion = floor(($this->_conn->server_version - $majorVersion * 10000) / 100); - $patchVersion = floor($this->_conn->server_version - $majorVersion * 10000 - $minorVersion * 100); + $majorVersion = floor($this->conn->server_version / 10000); + $minorVersion = floor(($this->conn->server_version - $majorVersion * 10000) / 100); + $patchVersion = floor($this->conn->server_version - $majorVersion * 10000 - $minorVersion * 100); return $majorVersion . '.' . $minorVersion . '.' . $patchVersion; } @@ -110,7 +110,7 @@ public function requiresQueryForServerVersion() */ public function prepare($prepareString) { - return new MysqliStatement($this->_conn, $prepareString); + return new MysqliStatement($this->conn, $prepareString); } /** @@ -131,7 +131,7 @@ public function query() */ public function quote($input, $type = ParameterType::STRING) { - return "'". $this->_conn->escape_string($input) ."'"; + return "'". $this->conn->escape_string($input) ."'"; } /** @@ -139,11 +139,11 @@ public function quote($input, $type = ParameterType::STRING) */ public function exec($statement) { - if (false === $this->_conn->query($statement)) { - throw new MysqliException($this->_conn->error, $this->_conn->sqlstate, $this->_conn->errno); + if (false === $this->conn->query($statement)) { + throw new MysqliException($this->conn->error, $this->conn->sqlstate, $this->conn->errno); } - return $this->_conn->affected_rows; + return $this->conn->affected_rows; } /** @@ -151,7 +151,7 @@ public function exec($statement) */ public function lastInsertId($name = null) { - return $this->_conn->insert_id; + return $this->conn->insert_id; } /** @@ -159,7 +159,7 @@ public function lastInsertId($name = null) */ public function beginTransaction() { - $this->_conn->query('START TRANSACTION'); + $this->conn->query('START TRANSACTION'); return true; } @@ -169,7 +169,7 @@ public function beginTransaction() */ public function commit() { - return $this->_conn->commit(); + return $this->conn->commit(); } /** @@ -177,7 +177,7 @@ public function commit() */ public function rollBack() { - return $this->_conn->rollback(); + return $this->conn->rollback(); } /** @@ -185,7 +185,7 @@ public function rollBack() */ public function errorCode() { - return $this->_conn->errno; + return $this->conn->errno; } /** @@ -193,7 +193,7 @@ public function errorCode() */ public function errorInfo() { - return $this->_conn->error; + return $this->conn->error; } /** @@ -232,17 +232,17 @@ private function setDriverOptions(array $driverOptions = []) ); } - if (@mysqli_options($this->_conn, $option, $value)) { + if (@mysqli_options($this->conn, $option, $value)) { continue; } $msg = sprintf($exceptionMsg, 'Failed to set', $option, $value); - $msg .= sprintf(', error: %s (%d)', mysqli_error($this->_conn), mysqli_errno($this->_conn)); + $msg .= sprintf(', error: %s (%d)', mysqli_error($this->conn), mysqli_errno($this->conn)); throw new MysqliException( $msg, - $this->_conn->sqlstate, - $this->_conn->errno + $this->conn->sqlstate, + $this->conn->errno ); } } @@ -254,7 +254,7 @@ private function setDriverOptions(array $driverOptions = []) */ public function ping() { - return $this->_conn->ping(); + return $this->conn->ping(); } /** @@ -274,7 +274,7 @@ private function setSecureConnection(array $params) return; } - $this->_conn->ssl_set( + $this->conn->ssl_set( $params['ssl_key'] ?? null, $params['ssl_cert'] ?? null, $params['ssl_ca'] ?? null, diff --git a/lib/Doctrine/DBAL/Driver/Mysqli/MysqliStatement.php b/lib/Doctrine/DBAL/Driver/Mysqli/MysqliStatement.php index 72707655439..4b7fe2e9437 100644 --- a/lib/Doctrine/DBAL/Driver/Mysqli/MysqliStatement.php +++ b/lib/Doctrine/DBAL/Driver/Mysqli/MysqliStatement.php @@ -15,7 +15,7 @@ class MysqliStatement implements \IteratorAggregate, Statement /** * @var array */ - protected static $_paramTypeMap = [ + protected static $paramTypeMap = [ ParameterType::STRING => 's', ParameterType::BOOLEAN => 'i', ParameterType::NULL => 's', @@ -26,27 +26,27 @@ class MysqliStatement implements \IteratorAggregate, Statement /** * @var \mysqli */ - protected $_conn; + protected $conn; /** * @var \mysqli_stmt */ - protected $_stmt; + protected $stmt; /** * @var null|boolean|array */ - protected $_columnNames; + protected $columnNames; /** * @var null|array */ - protected $_rowBindedValues; + protected $rowBindedValues; /** * @var array */ - protected $_bindedValues; + protected $bindedValues; /** * @var string @@ -58,12 +58,12 @@ class MysqliStatement implements \IteratorAggregate, Statement * * @var array */ - protected $_values = []; + protected $values = []; /** * @var integer */ - protected $_defaultFetchMode = FetchMode::MIXED; + protected $defaultFetchMode = FetchMode::MIXED; /** * Indicates whether the statement is in the state when fetching results is possible @@ -80,16 +80,16 @@ class MysqliStatement implements \IteratorAggregate, Statement */ public function __construct(\mysqli $conn, $prepareString) { - $this->_conn = $conn; - $this->_stmt = $conn->prepare($prepareString); - if (false === $this->_stmt) { - throw new MysqliException($this->_conn->error, $this->_conn->sqlstate, $this->_conn->errno); + $this->conn = $conn; + $this->stmt = $conn->prepare($prepareString); + if (false === $this->stmt) { + throw new MysqliException($this->conn->error, $this->conn->sqlstate, $this->conn->errno); } - $paramCount = $this->_stmt->param_count; + $paramCount = $this->stmt->param_count; if (0 < $paramCount) { $this->types = str_repeat('s', $paramCount); - $this->_bindedValues = array_fill(1, $paramCount, null); + $this->bindedValues = array_fill(1, $paramCount, null); } } @@ -101,14 +101,14 @@ public function bindParam($column, &$variable, $type = ParameterType::STRING, $l if (null === $type) { $type = 's'; } else { - if (isset(self::$_paramTypeMap[$type])) { - $type = self::$_paramTypeMap[$type]; + if (isset(self::$paramTypeMap[$type])) { + $type = self::$paramTypeMap[$type]; } else { throw new MysqliException("Unknown type: '{$type}'"); } } - $this->_bindedValues[$column] =& $variable; + $this->bindedValues[$column] =& $variable; $this->types[$column - 1] = $type; return true; @@ -122,15 +122,15 @@ public function bindValue($param, $value, $type = ParameterType::STRING) if (null === $type) { $type = 's'; } else { - if (isset(self::$_paramTypeMap[$type])) { - $type = self::$_paramTypeMap[$type]; + if (isset(self::$paramTypeMap[$type])) { + $type = self::$paramTypeMap[$type]; } else { throw new MysqliException("Unknown type: '{$type}'"); } } - $this->_values[$param] = $value; - $this->_bindedValues[$param] =& $this->_values[$param]; + $this->values[$param] = $value; + $this->bindedValues[$param] =& $this->values[$param]; $this->types[$param - 1] = $type; return true; @@ -141,24 +141,24 @@ public function bindValue($param, $value, $type = ParameterType::STRING) */ public function execute($params = null) { - if (null !== $this->_bindedValues) { + if (null !== $this->bindedValues) { if (null !== $params) { - if ( ! $this->_bindValues($params)) { - throw new MysqliException($this->_stmt->error, $this->_stmt->errno); + if ( ! $this->bindValues($params)) { + throw new MysqliException($this->stmt->error, $this->stmt->errno); } } else { - if (!call_user_func_array([$this->_stmt, 'bind_param'], [$this->types] + $this->_bindedValues)) { - throw new MysqliException($this->_stmt->error, $this->_stmt->sqlstate, $this->_stmt->errno); + if (!call_user_func_array([$this->stmt, 'bind_param'], [$this->types] + $this->bindedValues)) { + throw new MysqliException($this->stmt->error, $this->stmt->sqlstate, $this->stmt->errno); } } } - if ( ! $this->_stmt->execute()) { - throw new MysqliException($this->_stmt->error, $this->_stmt->sqlstate, $this->_stmt->errno); + if ( ! $this->stmt->execute()) { + throw new MysqliException($this->stmt->error, $this->stmt->sqlstate, $this->stmt->errno); } - if (null === $this->_columnNames) { - $meta = $this->_stmt->result_metadata(); + if (null === $this->columnNames) { + $meta = $this->stmt->result_metadata(); if (false !== $meta) { $columnNames = []; foreach ($meta->fetch_fields() as $col) { @@ -166,17 +166,17 @@ public function execute($params = null) } $meta->free(); - $this->_columnNames = $columnNames; + $this->columnNames = $columnNames; } else { - $this->_columnNames = false; + $this->columnNames = false; } } - if (false !== $this->_columnNames) { + if (false !== $this->columnNames) { // Store result of every execution which has it. Otherwise it will be impossible // to execute a new statement in case if the previous one has non-fetched rows // @link http://dev.mysql.com/doc/refman/5.7/en/commands-out-of-sync.html - $this->_stmt->store_result(); + $this->stmt->store_result(); // Bind row values _after_ storing the result. Otherwise, if mysqli is compiled with libmysql, // it will have to allocate as much memory as it may be needed for the given column type @@ -189,15 +189,15 @@ public function execute($params = null) // It's also important that row values are bound after _each_ call to store_result(). Otherwise, // if mysqli is compiled with libmysql, subsequently fetched string values will get truncated // to the length of the ones fetched during the previous execution. - $this->_rowBindedValues = array_fill(0, count($this->_columnNames), null); + $this->rowBindedValues = array_fill(0, count($this->columnNames), null); $refs = []; - foreach ($this->_rowBindedValues as $key => &$value) { + foreach ($this->rowBindedValues as $key => &$value) { $refs[$key] =& $value; } - if (!call_user_func_array([$this->_stmt, 'bind_result'], $refs)) { - throw new MysqliException($this->_stmt->error, $this->_stmt->sqlstate, $this->_stmt->errno); + if (!call_user_func_array([$this->stmt, 'bind_result'], $refs)) { + throw new MysqliException($this->stmt->error, $this->stmt->sqlstate, $this->stmt->errno); } } @@ -213,7 +213,7 @@ public function execute($params = null) * * @return boolean */ - private function _bindValues($values) + private function bindValues($values) { $params = []; $types = str_repeat('s', count($values)); @@ -223,19 +223,19 @@ private function _bindValues($values) $params[] =& $v; } - return call_user_func_array([$this->_stmt, 'bind_param'], $params); + return call_user_func_array([$this->stmt, 'bind_param'], $params); } /** * @return boolean|array */ - private function _fetch() + private function fetchValues() { - $ret = $this->_stmt->fetch(); + $ret = $this->stmt->fetch(); if (true === $ret) { $values = []; - foreach ($this->_rowBindedValues as $v) { + foreach ($this->rowBindedValues as $v) { $values[] = $v; } @@ -256,19 +256,19 @@ public function fetch($fetchMode = null, ...$args) return false; } - $fetchMode = $fetchMode ?: $this->_defaultFetchMode; + $fetchMode = $fetchMode ?: $this->defaultFetchMode; if ($fetchMode === FetchMode::COLUMN) { return $this->fetchColumn(); } - $values = $this->_fetch(); + $values = $this->fetchValues(); if (null === $values) { return false; } if (false === $values) { - throw new MysqliException($this->_stmt->error, $this->_stmt->sqlstate, $this->_stmt->errno); + throw new MysqliException($this->stmt->error, $this->stmt->sqlstate, $this->stmt->errno); } switch ($fetchMode) { @@ -276,16 +276,16 @@ public function fetch($fetchMode = null, ...$args) return $values; case FetchMode::ASSOCIATIVE: - return array_combine($this->_columnNames, $values); + return array_combine($this->columnNames, $values); case FetchMode::MIXED: - $ret = array_combine($this->_columnNames, $values); + $ret = array_combine($this->columnNames, $values); $ret += $values; return $ret; case FetchMode::STANDARD_OBJECT: - $assoc = array_combine($this->_columnNames, $values); + $assoc = array_combine($this->columnNames, $values); $ret = new \stdClass(); foreach ($assoc as $column => $value) { @@ -304,7 +304,7 @@ public function fetch($fetchMode = null, ...$args) */ public function fetchAll($fetchMode = null, ...$args) { - $fetchMode = $fetchMode ?: $this->_defaultFetchMode; + $fetchMode = $fetchMode ?: $this->defaultFetchMode; $rows = []; @@ -340,7 +340,7 @@ public function fetchColumn($columnIndex = 0) */ public function errorCode() { - return $this->_stmt->errno; + return $this->stmt->errno; } /** @@ -348,7 +348,7 @@ public function errorCode() */ public function errorInfo() { - return $this->_stmt->error; + return $this->stmt->error; } /** @@ -356,7 +356,7 @@ public function errorInfo() */ public function closeCursor() { - $this->_stmt->free_result(); + $this->stmt->free_result(); $this->result = false; return true; @@ -367,11 +367,11 @@ public function closeCursor() */ public function rowCount() { - if (false === $this->_columnNames) { - return $this->_stmt->affected_rows; + if (false === $this->columnNames) { + return $this->stmt->affected_rows; } - return $this->_stmt->num_rows; + return $this->stmt->num_rows; } /** @@ -379,7 +379,7 @@ public function rowCount() */ public function columnCount() { - return $this->_stmt->field_count; + return $this->stmt->field_count; } /** @@ -387,7 +387,7 @@ public function columnCount() */ public function setFetchMode($fetchMode, ...$args) { - $this->_defaultFetchMode = $fetchMode; + $this->defaultFetchMode = $fetchMode; return true; } diff --git a/lib/Doctrine/DBAL/Driver/OCI8/Driver.php b/lib/Doctrine/DBAL/Driver/OCI8/Driver.php index bdcecde7e3a..96b01cad7d6 100644 --- a/lib/Doctrine/DBAL/Driver/OCI8/Driver.php +++ b/lib/Doctrine/DBAL/Driver/OCI8/Driver.php @@ -22,7 +22,7 @@ public function connect(array $params, $username = null, $password = null, array return new OCI8Connection( $username, $password, - $this->_constructDsn($params), + $this->constructDsn($params), $params['charset'] ?? null, $params['sessionMode'] ?? OCI_DEFAULT, $params['persistent'] ?? false @@ -39,7 +39,7 @@ public function connect(array $params, $username = null, $password = null, array * * @return string The DSN. */ - protected function _constructDsn(array $params) + protected function constructDsn(array $params) { return $this->getEasyConnectString($params); } diff --git a/lib/Doctrine/DBAL/Driver/OCI8/OCI8Statement.php b/lib/Doctrine/DBAL/Driver/OCI8/OCI8Statement.php index f235e48a072..8ce52823e23 100644 --- a/lib/Doctrine/DBAL/Driver/OCI8/OCI8Statement.php +++ b/lib/Doctrine/DBAL/Driver/OCI8/OCI8Statement.php @@ -19,22 +19,22 @@ class OCI8Statement implements IteratorAggregate, Statement /** * @var resource */ - protected $_dbh; + protected $dbh; /** * @var resource */ - protected $_sth; + protected $sth; /** * @var \Doctrine\DBAL\Driver\OCI8\OCI8Connection */ - protected $_conn; + protected $conn; /** * @var string */ - protected static $_PARAM = ':param'; + protected static $PARAM = ':param'; /** * @var array @@ -49,12 +49,12 @@ class OCI8Statement implements IteratorAggregate, Statement /** * @var integer */ - protected $_defaultFetchMode = FetchMode::MIXED; + protected $defaultFetchMode = FetchMode::MIXED; /** * @var array */ - protected $_paramMap = []; + protected $paramMap = []; /** * Holds references to bound parameter values. @@ -82,10 +82,10 @@ class OCI8Statement implements IteratorAggregate, Statement public function __construct($dbh, $statement, OCI8Connection $conn) { list($statement, $paramMap) = self::convertPositionalToNamedPlaceholders($statement); - $this->_sth = oci_parse($dbh, $statement); - $this->_dbh = $dbh; - $this->_paramMap = $paramMap; - $this->_conn = $conn; + $this->sth = oci_parse($dbh, $statement); + $this->dbh = $dbh; + $this->paramMap = $paramMap; + $this->conn = $conn; } /** @@ -248,24 +248,24 @@ public function bindValue($param, $value, $type = ParameterType::STRING) */ public function bindParam($column, &$variable, $type = ParameterType::STRING, $length = null) { - $column = $this->_paramMap[$column] ?? $column; + $column = $this->paramMap[$column] ?? $column; if ($type == ParameterType::LARGE_OBJECT) { - $lob = oci_new_descriptor($this->_dbh, OCI_D_LOB); + $lob = oci_new_descriptor($this->dbh, OCI_D_LOB); $lob->writeTemporary($variable, OCI_TEMP_BLOB); $this->boundValues[$column] =& $lob; - return oci_bind_by_name($this->_sth, $column, $lob, -1, OCI_B_BLOB); + return oci_bind_by_name($this->sth, $column, $lob, -1, OCI_B_BLOB); } elseif ($length !== null) { $this->boundValues[$column] =& $variable; - return oci_bind_by_name($this->_sth, $column, $variable, $length); + return oci_bind_by_name($this->sth, $column, $variable, $length); } $this->boundValues[$column] =& $variable; - return oci_bind_by_name($this->_sth, $column, $variable); + return oci_bind_by_name($this->sth, $column, $variable); } /** @@ -278,7 +278,7 @@ public function closeCursor() return true; } - oci_cancel($this->_sth); + oci_cancel($this->sth); $this->result = false; @@ -290,7 +290,7 @@ public function closeCursor() */ public function columnCount() { - return oci_num_fields($this->_sth); + return oci_num_fields($this->sth); } /** @@ -298,7 +298,7 @@ public function columnCount() */ public function errorCode() { - $error = oci_error($this->_sth); + $error = oci_error($this->sth); if ($error !== false) { $error = $error['code']; } @@ -311,7 +311,7 @@ public function errorCode() */ public function errorInfo() { - return oci_error($this->_sth); + return oci_error($this->sth); } /** @@ -330,7 +330,7 @@ public function execute($params = null) } } - $ret = @oci_execute($this->_sth, $this->_conn->getExecuteMode()); + $ret = @oci_execute($this->sth, $this->conn->getExecuteMode()); if ( ! $ret) { throw OCI8Exception::fromErrorInfo($this->errorInfo()); } @@ -345,7 +345,7 @@ public function execute($params = null) */ public function setFetchMode($fetchMode, ...$args) { - $this->_defaultFetchMode = $fetchMode; + $this->defaultFetchMode = $fetchMode; return true; } @@ -369,14 +369,14 @@ public function fetch($fetchMode = null, ...$args) return false; } - $fetchMode = $fetchMode ?: $this->_defaultFetchMode; + $fetchMode = $fetchMode ?: $this->defaultFetchMode; if ($fetchMode === FetchMode::COLUMN) { return $this->fetchColumn(); } if ($fetchMode === FetchMode::STANDARD_OBJECT) { - return oci_fetch_object($this->_sth); + return oci_fetch_object($this->sth); } if (! isset(self::$fetchModeMap[$fetchMode])) { @@ -384,7 +384,7 @@ public function fetch($fetchMode = null, ...$args) } return oci_fetch_array( - $this->_sth, + $this->sth, self::$fetchModeMap[$fetchMode] | OCI_RETURN_NULLS | OCI_RETURN_LOBS ); } @@ -394,7 +394,7 @@ public function fetch($fetchMode = null, ...$args) */ public function fetchAll($fetchMode = null, ...$args) { - $fetchMode = $fetchMode ?: $this->_defaultFetchMode; + $fetchMode = $fetchMode ?: $this->defaultFetchMode; $result = []; @@ -427,7 +427,7 @@ public function fetchAll($fetchMode = null, ...$args) return []; } - oci_fetch_all($this->_sth, $result, 0, -1, + oci_fetch_all($this->sth, $result, 0, -1, self::$fetchModeMap[$fetchMode] | OCI_RETURN_NULLS | $fetchStructure | OCI_RETURN_LOBS); if ($fetchMode == FetchMode::COLUMN) { @@ -449,7 +449,7 @@ public function fetchColumn($columnIndex = 0) return false; } - $row = oci_fetch_array($this->_sth, OCI_NUM | OCI_RETURN_NULLS | OCI_RETURN_LOBS); + $row = oci_fetch_array($this->sth, OCI_NUM | OCI_RETURN_NULLS | OCI_RETURN_LOBS); if (false === $row) { return false; @@ -463,6 +463,6 @@ public function fetchColumn($columnIndex = 0) */ public function rowCount() { - return oci_num_rows($this->_sth); + return oci_num_rows($this->sth); } } diff --git a/lib/Doctrine/DBAL/Driver/PDOIbm/Driver.php b/lib/Doctrine/DBAL/Driver/PDOIbm/Driver.php index f082cf99334..3258891b465 100644 --- a/lib/Doctrine/DBAL/Driver/PDOIbm/Driver.php +++ b/lib/Doctrine/DBAL/Driver/PDOIbm/Driver.php @@ -23,7 +23,7 @@ class Driver extends AbstractDB2Driver public function connect(array $params, $username = null, $password = null, array $driverOptions = []) { $conn = new PDOConnection( - $this->_constructPdoDsn($params), + $this->constructPdoDsn($params), $username, $password, $driverOptions @@ -39,7 +39,7 @@ public function connect(array $params, $username = null, $password = null, array * * @return string The DSN. */ - private function _constructPdoDsn(array $params) + private function constructPdoDsn(array $params) { $dsn = 'ibm:'; if (isset($params['host'])) { diff --git a/lib/Doctrine/DBAL/Driver/PDOPgSql/Driver.php b/lib/Doctrine/DBAL/Driver/PDOPgSql/Driver.php index ffadb68a4b4..5f2401036a8 100644 --- a/lib/Doctrine/DBAL/Driver/PDOPgSql/Driver.php +++ b/lib/Doctrine/DBAL/Driver/PDOPgSql/Driver.php @@ -22,7 +22,7 @@ public function connect(array $params, $username = null, $password = null, array { try { $pdo = new PDOConnection( - $this->_constructPdoDsn($params), + $this->constructPdoDsn($params), $username, $password, $driverOptions @@ -57,7 +57,7 @@ public function connect(array $params, $username = null, $password = null, array * * @return string The DSN. */ - private function _constructPdoDsn(array $params) + private function constructPdoDsn(array $params) { $dsn = 'pgsql:'; diff --git a/lib/Doctrine/DBAL/Driver/PDOSqlite/Driver.php b/lib/Doctrine/DBAL/Driver/PDOSqlite/Driver.php index 77f11629621..117c5e868da 100644 --- a/lib/Doctrine/DBAL/Driver/PDOSqlite/Driver.php +++ b/lib/Doctrine/DBAL/Driver/PDOSqlite/Driver.php @@ -17,7 +17,7 @@ class Driver extends AbstractSQLiteDriver /** * @var array */ - protected $_userDefinedFunctions = [ + protected $userDefinedFunctions = [ 'sqrt' => ['callback' => ['Doctrine\DBAL\Platforms\SqlitePlatform', 'udfSqrt'], 'numArgs' => 1], 'mod' => ['callback' => ['Doctrine\DBAL\Platforms\SqlitePlatform', 'udfMod'], 'numArgs' => 2], 'locate' => ['callback' => ['Doctrine\DBAL\Platforms\SqlitePlatform', 'udfLocate'], 'numArgs' => -1], @@ -29,14 +29,14 @@ class Driver extends AbstractSQLiteDriver public function connect(array $params, $username = null, $password = null, array $driverOptions = []) { if (isset($driverOptions['userDefinedFunctions'])) { - $this->_userDefinedFunctions = array_merge( - $this->_userDefinedFunctions, $driverOptions['userDefinedFunctions']); + $this->userDefinedFunctions = array_merge( + $this->userDefinedFunctions, $driverOptions['userDefinedFunctions']); unset($driverOptions['userDefinedFunctions']); } try { $pdo = new PDOConnection( - $this->_constructPdoDsn($params), + $this->constructPdoDsn($params), $username, $password, $driverOptions @@ -45,7 +45,7 @@ public function connect(array $params, $username = null, $password = null, array throw DBALException::driverException($this, $ex); } - foreach ($this->_userDefinedFunctions as $fn => $data) { + foreach ($this->userDefinedFunctions as $fn => $data) { $pdo->sqliteCreateFunction($fn, $data['callback'], $data['numArgs']); } @@ -59,7 +59,7 @@ public function connect(array $params, $username = null, $password = null, array * * @return string The DSN. */ - protected function _constructPdoDsn(array $params) + protected function constructPdoDsn(array $params) { $dsn = 'sqlite:'; if (isset($params['path'])) { diff --git a/lib/Doctrine/DBAL/Driver/PDOSqlsrv/Driver.php b/lib/Doctrine/DBAL/Driver/PDOSqlsrv/Driver.php index ea17a350702..889702c253b 100644 --- a/lib/Doctrine/DBAL/Driver/PDOSqlsrv/Driver.php +++ b/lib/Doctrine/DBAL/Driver/PDOSqlsrv/Driver.php @@ -17,7 +17,7 @@ class Driver extends AbstractSQLServerDriver public function connect(array $params, $username = null, $password = null, array $driverOptions = []) { return new Connection( - $this->_constructPdoDsn($params), + $this->constructPdoDsn($params), $username, $password, $driverOptions @@ -31,7 +31,7 @@ public function connect(array $params, $username = null, $password = null, array * * @return string The DSN. */ - private function _constructPdoDsn(array $params) + private function constructPdoDsn(array $params) { $dsn = 'sqlsrv:server='; diff --git a/lib/Doctrine/DBAL/DriverManager.php b/lib/Doctrine/DBAL/DriverManager.php index adb8d259934..a7eab2590e9 100644 --- a/lib/Doctrine/DBAL/DriverManager.php +++ b/lib/Doctrine/DBAL/DriverManager.php @@ -20,7 +20,7 @@ final class DriverManager * * @var array */ - private static $_driverMap = [ + private static $driverMap = [ 'pdo_mysql' => 'Doctrine\DBAL\Driver\PDOMySql\Driver', 'pdo_sqlite' => 'Doctrine\DBAL\Driver\PDOSqlite\Driver', 'pdo_pgsql' => 'Doctrine\DBAL\Driver\PDOPgSql\Driver', @@ -133,10 +133,10 @@ public static function getConnection( $params['pdo']->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION); $params['driver'] = 'pdo_' . $params['pdo']->getAttribute(\PDO::ATTR_DRIVER_NAME); } else { - self::_checkParams($params); + self::checkParams($params); } - $className = $params['driverClass'] ?? self::$_driverMap[$params['driver']]; + $className = $params['driverClass'] ?? self::$driverMap[$params['driver']]; $driver = new $className(); @@ -159,7 +159,7 @@ public static function getConnection( */ public static function getAvailableDrivers(): array { - return array_keys(self::$_driverMap); + return array_keys(self::$driverMap); } /** @@ -171,7 +171,7 @@ public static function getAvailableDrivers(): array * * @throws \Doctrine\DBAL\DBALException */ - private static function _checkParams(array $params): void + private static function checkParams(array $params): void { // check existence of mandatory parameters @@ -183,8 +183,8 @@ private static function _checkParams(array $params): void // check validity of parameters // driver - if (isset($params['driver']) && ! isset(self::$_driverMap[$params['driver']])) { - throw DBALException::unknownDriver($params['driver'], array_keys(self::$_driverMap)); + if (isset($params['driver']) && ! isset(self::$driverMap[$params['driver']])) { + throw DBALException::unknownDriver($params['driver'], array_keys(self::$driverMap)); } if (isset($params['driverClass']) && ! in_array('Doctrine\DBAL\Driver', class_implements($params['driverClass'], true))) { diff --git a/lib/Doctrine/DBAL/Event/ConnectionEventArgs.php b/lib/Doctrine/DBAL/Event/ConnectionEventArgs.php index 5f8abc1ee59..c655ef38869 100644 --- a/lib/Doctrine/DBAL/Event/ConnectionEventArgs.php +++ b/lib/Doctrine/DBAL/Event/ConnectionEventArgs.php @@ -17,14 +17,14 @@ class ConnectionEventArgs extends EventArgs /** * @var \Doctrine\DBAL\Connection */ - private $_connection; + private $connection; /** * @param \Doctrine\DBAL\Connection $connection */ public function __construct(Connection $connection) { - $this->_connection = $connection; + $this->connection = $connection; } /** @@ -32,7 +32,7 @@ public function __construct(Connection $connection) */ public function getConnection() { - return $this->_connection; + return $this->connection; } /** @@ -40,7 +40,7 @@ public function getConnection() */ public function getDriver() { - return $this->_connection->getDriver(); + return $this->connection->getDriver(); } /** @@ -48,7 +48,7 @@ public function getDriver() */ public function getDatabasePlatform() { - return $this->_connection->getDatabasePlatform(); + return $this->connection->getDatabasePlatform(); } /** @@ -56,6 +56,6 @@ public function getDatabasePlatform() */ public function getSchemaManager() { - return $this->_connection->getSchemaManager(); + return $this->connection->getSchemaManager(); } } diff --git a/lib/Doctrine/DBAL/Event/Listeners/MysqlSessionInit.php b/lib/Doctrine/DBAL/Event/Listeners/MysqlSessionInit.php index d65f3f799a1..dd856007fe4 100644 --- a/lib/Doctrine/DBAL/Event/Listeners/MysqlSessionInit.php +++ b/lib/Doctrine/DBAL/Event/Listeners/MysqlSessionInit.php @@ -21,14 +21,14 @@ class MysqlSessionInit implements EventSubscriber * * @var string */ - private $_charset; + private $charset; /** * The collation, or FALSE if no collation. * * @var string|boolean */ - private $_collation; + private $collation; /** * Configure Charset and Collation options of MySQL Client for each Connection. @@ -38,8 +38,8 @@ class MysqlSessionInit implements EventSubscriber */ public function __construct($charset = 'utf8', $collation = false) { - $this->_charset = $charset; - $this->_collation = $collation; + $this->charset = $charset; + $this->collation = $collation; } /** @@ -49,8 +49,8 @@ public function __construct($charset = 'utf8', $collation = false) */ public function postConnect(ConnectionEventArgs $args) { - $collation = ($this->_collation) ? " COLLATE ".$this->_collation : ""; - $args->getConnection()->executeUpdate("SET NAMES ".$this->_charset . $collation); + $collation = ($this->collation) ? " COLLATE ".$this->collation : ""; + $args->getConnection()->executeUpdate("SET NAMES ".$this->charset . $collation); } /** diff --git a/lib/Doctrine/DBAL/Event/Listeners/OracleSessionInit.php b/lib/Doctrine/DBAL/Event/Listeners/OracleSessionInit.php index 2988f5c6e14..ffc478c85be 100644 --- a/lib/Doctrine/DBAL/Event/Listeners/OracleSessionInit.php +++ b/lib/Doctrine/DBAL/Event/Listeners/OracleSessionInit.php @@ -25,7 +25,7 @@ class OracleSessionInit implements EventSubscriber /** * @var array */ - protected $_defaultSessionVars = [ + protected $defaultSessionVars = [ 'NLS_TIME_FORMAT' => "HH24:MI:SS", 'NLS_DATE_FORMAT' => "YYYY-MM-DD HH24:MI:SS", 'NLS_TIMESTAMP_FORMAT' => "YYYY-MM-DD HH24:MI:SS", @@ -38,7 +38,7 @@ class OracleSessionInit implements EventSubscriber */ public function __construct(array $oracleSessionVars = []) { - $this->_defaultSessionVars = array_merge($this->_defaultSessionVars, $oracleSessionVars); + $this->defaultSessionVars = array_merge($this->defaultSessionVars, $oracleSessionVars); } /** @@ -48,10 +48,10 @@ public function __construct(array $oracleSessionVars = []) */ public function postConnect(ConnectionEventArgs $args) { - if (count($this->_defaultSessionVars)) { - array_change_key_case($this->_defaultSessionVars, \CASE_UPPER); + if (count($this->defaultSessionVars)) { + array_change_key_case($this->defaultSessionVars, \CASE_UPPER); $vars = []; - foreach ($this->_defaultSessionVars as $option => $value) { + foreach ($this->defaultSessionVars as $option => $value) { if ($option === 'CURRENT_SCHEMA') { $vars[] = $option . " = " . $value; } else { diff --git a/lib/Doctrine/DBAL/Event/SchemaAlterTableAddColumnEventArgs.php b/lib/Doctrine/DBAL/Event/SchemaAlterTableAddColumnEventArgs.php index bf7d017b320..ec22102989d 100644 --- a/lib/Doctrine/DBAL/Event/SchemaAlterTableAddColumnEventArgs.php +++ b/lib/Doctrine/DBAL/Event/SchemaAlterTableAddColumnEventArgs.php @@ -18,22 +18,22 @@ class SchemaAlterTableAddColumnEventArgs extends SchemaEventArgs /** * @var \Doctrine\DBAL\Schema\Column */ - private $_column; + private $column; /** * @var \Doctrine\DBAL\Schema\TableDiff */ - private $_tableDiff; + private $tableDiff; /** * @var \Doctrine\DBAL\Platforms\AbstractPlatform */ - private $_platform; + private $platform; /** * @var array */ - private $_sql = []; + private $sql = []; /** * @param \Doctrine\DBAL\Schema\Column $column @@ -42,9 +42,9 @@ class SchemaAlterTableAddColumnEventArgs extends SchemaEventArgs */ public function __construct(Column $column, TableDiff $tableDiff, AbstractPlatform $platform) { - $this->_column = $column; - $this->_tableDiff = $tableDiff; - $this->_platform = $platform; + $this->column = $column; + $this->tableDiff = $tableDiff; + $this->platform = $platform; } /** @@ -52,7 +52,7 @@ public function __construct(Column $column, TableDiff $tableDiff, AbstractPlatfo */ public function getColumn() { - return $this->_column; + return $this->column; } /** @@ -60,7 +60,7 @@ public function getColumn() */ public function getTableDiff() { - return $this->_tableDiff; + return $this->tableDiff; } /** @@ -68,7 +68,7 @@ public function getTableDiff() */ public function getPlatform() { - return $this->_platform; + return $this->platform; } /** @@ -79,9 +79,9 @@ public function getPlatform() public function addSql($sql) { if (is_array($sql)) { - $this->_sql = array_merge($this->_sql, $sql); + $this->sql = array_merge($this->sql, $sql); } else { - $this->_sql[] = $sql; + $this->sql[] = $sql; } return $this; @@ -92,6 +92,6 @@ public function addSql($sql) */ public function getSql() { - return $this->_sql; + return $this->sql; } } diff --git a/lib/Doctrine/DBAL/Event/SchemaAlterTableChangeColumnEventArgs.php b/lib/Doctrine/DBAL/Event/SchemaAlterTableChangeColumnEventArgs.php index ece9dbd525c..fd05b80a829 100644 --- a/lib/Doctrine/DBAL/Event/SchemaAlterTableChangeColumnEventArgs.php +++ b/lib/Doctrine/DBAL/Event/SchemaAlterTableChangeColumnEventArgs.php @@ -18,22 +18,22 @@ class SchemaAlterTableChangeColumnEventArgs extends SchemaEventArgs /** * @var \Doctrine\DBAL\Schema\ColumnDiff */ - private $_columnDiff; + private $columnDiff; /** * @var \Doctrine\DBAL\Schema\TableDiff */ - private $_tableDiff; + private $tableDiff; /** * @var \Doctrine\DBAL\Platforms\AbstractPlatform */ - private $_platform; + private $platform; /** * @var array */ - private $_sql = []; + private $sql = []; /** * @param \Doctrine\DBAL\Schema\ColumnDiff $columnDiff @@ -42,9 +42,9 @@ class SchemaAlterTableChangeColumnEventArgs extends SchemaEventArgs */ public function __construct(ColumnDiff $columnDiff, TableDiff $tableDiff, AbstractPlatform $platform) { - $this->_columnDiff = $columnDiff; - $this->_tableDiff = $tableDiff; - $this->_platform = $platform; + $this->columnDiff = $columnDiff; + $this->tableDiff = $tableDiff; + $this->platform = $platform; } /** @@ -52,7 +52,7 @@ public function __construct(ColumnDiff $columnDiff, TableDiff $tableDiff, Abstra */ public function getColumnDiff() { - return $this->_columnDiff; + return $this->columnDiff; } /** @@ -60,7 +60,7 @@ public function getColumnDiff() */ public function getTableDiff() { - return $this->_tableDiff; + return $this->tableDiff; } /** @@ -68,7 +68,7 @@ public function getTableDiff() */ public function getPlatform() { - return $this->_platform; + return $this->platform; } /** @@ -79,9 +79,9 @@ public function getPlatform() public function addSql($sql) { if (is_array($sql)) { - $this->_sql = array_merge($this->_sql, $sql); + $this->sql = array_merge($this->sql, $sql); } else { - $this->_sql[] = $sql; + $this->sql[] = $sql; } return $this; @@ -92,6 +92,6 @@ public function addSql($sql) */ public function getSql() { - return $this->_sql; + return $this->sql; } } diff --git a/lib/Doctrine/DBAL/Event/SchemaAlterTableEventArgs.php b/lib/Doctrine/DBAL/Event/SchemaAlterTableEventArgs.php index 7275e292af8..293a5d293d4 100644 --- a/lib/Doctrine/DBAL/Event/SchemaAlterTableEventArgs.php +++ b/lib/Doctrine/DBAL/Event/SchemaAlterTableEventArgs.php @@ -17,17 +17,17 @@ class SchemaAlterTableEventArgs extends SchemaEventArgs /** * @var \Doctrine\DBAL\Schema\TableDiff */ - private $_tableDiff; + private $tableDiff; /** * @var \Doctrine\DBAL\Platforms\AbstractPlatform */ - private $_platform; + private $platform; /** * @var array */ - private $_sql = []; + private $sql = []; /** * @param \Doctrine\DBAL\Schema\TableDiff $tableDiff @@ -35,8 +35,8 @@ class SchemaAlterTableEventArgs extends SchemaEventArgs */ public function __construct(TableDiff $tableDiff, AbstractPlatform $platform) { - $this->_tableDiff = $tableDiff; - $this->_platform = $platform; + $this->tableDiff = $tableDiff; + $this->platform = $platform; } /** @@ -44,7 +44,7 @@ public function __construct(TableDiff $tableDiff, AbstractPlatform $platform) */ public function getTableDiff() { - return $this->_tableDiff; + return $this->tableDiff; } /** @@ -52,7 +52,7 @@ public function getTableDiff() */ public function getPlatform() { - return $this->_platform; + return $this->platform; } /** @@ -63,9 +63,9 @@ public function getPlatform() public function addSql($sql) { if (is_array($sql)) { - $this->_sql = array_merge($this->_sql, $sql); + $this->sql = array_merge($this->sql, $sql); } else { - $this->_sql[] = $sql; + $this->sql[] = $sql; } return $this; @@ -76,6 +76,6 @@ public function addSql($sql) */ public function getSql() { - return $this->_sql; + return $this->sql; } } diff --git a/lib/Doctrine/DBAL/Event/SchemaAlterTableRemoveColumnEventArgs.php b/lib/Doctrine/DBAL/Event/SchemaAlterTableRemoveColumnEventArgs.php index 0c0f542a164..9de5518f5fc 100644 --- a/lib/Doctrine/DBAL/Event/SchemaAlterTableRemoveColumnEventArgs.php +++ b/lib/Doctrine/DBAL/Event/SchemaAlterTableRemoveColumnEventArgs.php @@ -18,22 +18,22 @@ class SchemaAlterTableRemoveColumnEventArgs extends SchemaEventArgs /** * @var \Doctrine\DBAL\Schema\Column */ - private $_column; + private $column; /** * @var \Doctrine\DBAL\Schema\TableDiff */ - private $_tableDiff; + private $tableDiff; /** * @var \Doctrine\DBAL\Platforms\AbstractPlatform */ - private $_platform; + private $platform; /** * @var array */ - private $_sql = []; + private $sql = []; /** * @param \Doctrine\DBAL\Schema\Column $column @@ -42,9 +42,9 @@ class SchemaAlterTableRemoveColumnEventArgs extends SchemaEventArgs */ public function __construct(Column $column, TableDiff $tableDiff, AbstractPlatform $platform) { - $this->_column = $column; - $this->_tableDiff = $tableDiff; - $this->_platform = $platform; + $this->column = $column; + $this->tableDiff = $tableDiff; + $this->platform = $platform; } /** @@ -52,7 +52,7 @@ public function __construct(Column $column, TableDiff $tableDiff, AbstractPlatfo */ public function getColumn() { - return $this->_column; + return $this->column; } /** @@ -60,7 +60,7 @@ public function getColumn() */ public function getTableDiff() { - return $this->_tableDiff; + return $this->tableDiff; } /** @@ -68,7 +68,7 @@ public function getTableDiff() */ public function getPlatform() { - return $this->_platform; + return $this->platform; } /** @@ -79,9 +79,9 @@ public function getPlatform() public function addSql($sql) { if (is_array($sql)) { - $this->_sql = array_merge($this->_sql, $sql); + $this->sql = array_merge($this->sql, $sql); } else { - $this->_sql[] = $sql; + $this->sql[] = $sql; } return $this; @@ -92,6 +92,6 @@ public function addSql($sql) */ public function getSql() { - return $this->_sql; + return $this->sql; } } diff --git a/lib/Doctrine/DBAL/Event/SchemaAlterTableRenameColumnEventArgs.php b/lib/Doctrine/DBAL/Event/SchemaAlterTableRenameColumnEventArgs.php index 42f0f27459c..e54d5f6f5a5 100644 --- a/lib/Doctrine/DBAL/Event/SchemaAlterTableRenameColumnEventArgs.php +++ b/lib/Doctrine/DBAL/Event/SchemaAlterTableRenameColumnEventArgs.php @@ -18,27 +18,27 @@ class SchemaAlterTableRenameColumnEventArgs extends SchemaEventArgs /** * @var string */ - private $_oldColumnName; + private $oldColumnName; /** * @var \Doctrine\DBAL\Schema\Column */ - private $_column; + private $column; /** * @var \Doctrine\DBAL\Schema\TableDiff */ - private $_tableDiff; + private $tableDiff; /** * @var \Doctrine\DBAL\Platforms\AbstractPlatform */ - private $_platform; + private $platform; /** * @var array */ - private $_sql = []; + private $sql = []; /** * @param string $oldColumnName @@ -48,10 +48,10 @@ class SchemaAlterTableRenameColumnEventArgs extends SchemaEventArgs */ public function __construct($oldColumnName, Column $column, TableDiff $tableDiff, AbstractPlatform $platform) { - $this->_oldColumnName = $oldColumnName; - $this->_column = $column; - $this->_tableDiff = $tableDiff; - $this->_platform = $platform; + $this->oldColumnName = $oldColumnName; + $this->column = $column; + $this->tableDiff = $tableDiff; + $this->platform = $platform; } /** @@ -59,7 +59,7 @@ public function __construct($oldColumnName, Column $column, TableDiff $tableDiff */ public function getOldColumnName() { - return $this->_oldColumnName; + return $this->oldColumnName; } /** @@ -67,7 +67,7 @@ public function getOldColumnName() */ public function getColumn() { - return $this->_column; + return $this->column; } /** @@ -75,7 +75,7 @@ public function getColumn() */ public function getTableDiff() { - return $this->_tableDiff; + return $this->tableDiff; } /** @@ -83,7 +83,7 @@ public function getTableDiff() */ public function getPlatform() { - return $this->_platform; + return $this->platform; } /** @@ -94,9 +94,9 @@ public function getPlatform() public function addSql($sql) { if (is_array($sql)) { - $this->_sql = array_merge($this->_sql, $sql); + $this->sql = array_merge($this->sql, $sql); } else { - $this->_sql[] = $sql; + $this->sql[] = $sql; } return $this; @@ -107,6 +107,6 @@ public function addSql($sql) */ public function getSql() { - return $this->_sql; + return $this->sql; } } diff --git a/lib/Doctrine/DBAL/Event/SchemaColumnDefinitionEventArgs.php b/lib/Doctrine/DBAL/Event/SchemaColumnDefinitionEventArgs.php index 192a7400aef..173a2ec3d08 100644 --- a/lib/Doctrine/DBAL/Event/SchemaColumnDefinitionEventArgs.php +++ b/lib/Doctrine/DBAL/Event/SchemaColumnDefinitionEventArgs.php @@ -17,29 +17,29 @@ class SchemaColumnDefinitionEventArgs extends SchemaEventArgs /** * @var \Doctrine\DBAL\Schema\Column|null */ - private $_column = null; + private $column = null; /** * Raw column data as fetched from the database. * * @var array */ - private $_tableColumn; + private $tableColumn; /** * @var string */ - private $_table; + private $table; /** * @var string */ - private $_database; + private $database; /** * @var \Doctrine\DBAL\Connection */ - private $_connection; + private $connection; /** * @param array $tableColumn @@ -49,10 +49,10 @@ class SchemaColumnDefinitionEventArgs extends SchemaEventArgs */ public function __construct(array $tableColumn, $table, $database, Connection $connection) { - $this->_tableColumn = $tableColumn; - $this->_table = $table; - $this->_database = $database; - $this->_connection = $connection; + $this->tableColumn = $tableColumn; + $this->table = $table; + $this->database = $database; + $this->connection = $connection; } /** @@ -65,7 +65,7 @@ public function __construct(array $tableColumn, $table, $database, Connection $c */ public function setColumn(Column $column = null) { - $this->_column = $column; + $this->column = $column; return $this; } @@ -75,7 +75,7 @@ public function setColumn(Column $column = null) */ public function getColumn() { - return $this->_column; + return $this->column; } /** @@ -83,7 +83,7 @@ public function getColumn() */ public function getTableColumn() { - return $this->_tableColumn; + return $this->tableColumn; } /** @@ -91,7 +91,7 @@ public function getTableColumn() */ public function getTable() { - return $this->_table; + return $this->table; } /** @@ -99,7 +99,7 @@ public function getTable() */ public function getDatabase() { - return $this->_database; + return $this->database; } /** @@ -107,7 +107,7 @@ public function getDatabase() */ public function getConnection() { - return $this->_connection; + return $this->connection; } /** @@ -115,6 +115,6 @@ public function getConnection() */ public function getDatabasePlatform() { - return $this->_connection->getDatabasePlatform(); + return $this->connection->getDatabasePlatform(); } } diff --git a/lib/Doctrine/DBAL/Event/SchemaCreateTableColumnEventArgs.php b/lib/Doctrine/DBAL/Event/SchemaCreateTableColumnEventArgs.php index 6a2462eae83..daca907b572 100644 --- a/lib/Doctrine/DBAL/Event/SchemaCreateTableColumnEventArgs.php +++ b/lib/Doctrine/DBAL/Event/SchemaCreateTableColumnEventArgs.php @@ -18,22 +18,22 @@ class SchemaCreateTableColumnEventArgs extends SchemaEventArgs /** * @var \Doctrine\DBAL\Schema\Column */ - private $_column; + private $column; /** * @var \Doctrine\DBAL\Schema\Table */ - private $_table; + private $table; /** * @var \Doctrine\DBAL\Platforms\AbstractPlatform */ - private $_platform; + private $platform; /** * @var array */ - private $_sql = []; + private $sql = []; /** * @param \Doctrine\DBAL\Schema\Column $column @@ -42,9 +42,9 @@ class SchemaCreateTableColumnEventArgs extends SchemaEventArgs */ public function __construct(Column $column, Table $table, AbstractPlatform $platform) { - $this->_column = $column; - $this->_table = $table; - $this->_platform = $platform; + $this->column = $column; + $this->table = $table; + $this->platform = $platform; } /** @@ -52,7 +52,7 @@ public function __construct(Column $column, Table $table, AbstractPlatform $plat */ public function getColumn() { - return $this->_column; + return $this->column; } /** @@ -60,7 +60,7 @@ public function getColumn() */ public function getTable() { - return $this->_table; + return $this->table; } /** @@ -68,7 +68,7 @@ public function getTable() */ public function getPlatform() { - return $this->_platform; + return $this->platform; } /** @@ -79,9 +79,9 @@ public function getPlatform() public function addSql($sql) { if (is_array($sql)) { - $this->_sql = array_merge($this->_sql, $sql); + $this->sql = array_merge($this->sql, $sql); } else { - $this->_sql[] = $sql; + $this->sql[] = $sql; } return $this; @@ -92,6 +92,6 @@ public function addSql($sql) */ public function getSql() { - return $this->_sql; + return $this->sql; } } diff --git a/lib/Doctrine/DBAL/Event/SchemaCreateTableEventArgs.php b/lib/Doctrine/DBAL/Event/SchemaCreateTableEventArgs.php index 4b19a34277c..bcbf13c0a39 100644 --- a/lib/Doctrine/DBAL/Event/SchemaCreateTableEventArgs.php +++ b/lib/Doctrine/DBAL/Event/SchemaCreateTableEventArgs.php @@ -17,27 +17,27 @@ class SchemaCreateTableEventArgs extends SchemaEventArgs /** * @var \Doctrine\DBAL\Schema\Table */ - private $_table; + private $table; /** * @var array */ - private $_columns; + private $columns; /** * @var array */ - private $_options; + private $options; /** * @var \Doctrine\DBAL\Platforms\AbstractPlatform */ - private $_platform; + private $platform; /** * @var array */ - private $_sql = []; + private $sql = []; /** * @param \Doctrine\DBAL\Schema\Table $table @@ -47,10 +47,10 @@ class SchemaCreateTableEventArgs extends SchemaEventArgs */ public function __construct(Table $table, array $columns, array $options, AbstractPlatform $platform) { - $this->_table = $table; - $this->_columns = $columns; - $this->_options = $options; - $this->_platform = $platform; + $this->table = $table; + $this->columns = $columns; + $this->options = $options; + $this->platform = $platform; } /** @@ -58,7 +58,7 @@ public function __construct(Table $table, array $columns, array $options, Abstra */ public function getTable() { - return $this->_table; + return $this->table; } /** @@ -66,7 +66,7 @@ public function getTable() */ public function getColumns() { - return $this->_columns; + return $this->columns; } /** @@ -74,7 +74,7 @@ public function getColumns() */ public function getOptions() { - return $this->_options; + return $this->options; } /** @@ -82,7 +82,7 @@ public function getOptions() */ public function getPlatform() { - return $this->_platform; + return $this->platform; } /** @@ -93,9 +93,9 @@ public function getPlatform() public function addSql($sql) { if (is_array($sql)) { - $this->_sql = array_merge($this->_sql, $sql); + $this->sql = array_merge($this->sql, $sql); } else { - $this->_sql[] = $sql; + $this->sql[] = $sql; } return $this; @@ -106,6 +106,6 @@ public function addSql($sql) */ public function getSql() { - return $this->_sql; + return $this->sql; } } diff --git a/lib/Doctrine/DBAL/Event/SchemaDropTableEventArgs.php b/lib/Doctrine/DBAL/Event/SchemaDropTableEventArgs.php index 2beaa2924a2..620f83acd08 100644 --- a/lib/Doctrine/DBAL/Event/SchemaDropTableEventArgs.php +++ b/lib/Doctrine/DBAL/Event/SchemaDropTableEventArgs.php @@ -17,17 +17,17 @@ class SchemaDropTableEventArgs extends SchemaEventArgs /** * @var string|\Doctrine\DBAL\Schema\Table */ - private $_table; + private $table; /** * @var \Doctrine\DBAL\Platforms\AbstractPlatform */ - private $_platform; + private $platform; /** * @var string|null */ - private $_sql = null; + private $sql = null; /** * @param string|\Doctrine\DBAL\Schema\Table $table @@ -41,8 +41,8 @@ public function __construct($table, AbstractPlatform $platform) throw new \InvalidArgumentException('SchemaDropTableEventArgs expects $table parameter to be string or \Doctrine\DBAL\Schema\Table.'); } - $this->_table = $table; - $this->_platform = $platform; + $this->table = $table; + $this->platform = $platform; } /** @@ -50,7 +50,7 @@ public function __construct($table, AbstractPlatform $platform) */ public function getTable() { - return $this->_table; + return $this->table; } /** @@ -58,7 +58,7 @@ public function getTable() */ public function getPlatform() { - return $this->_platform; + return $this->platform; } /** @@ -68,7 +68,7 @@ public function getPlatform() */ public function setSql($sql) { - $this->_sql = $sql; + $this->sql = $sql; return $this; } @@ -78,6 +78,6 @@ public function setSql($sql) */ public function getSql() { - return $this->_sql; + return $this->sql; } } diff --git a/lib/Doctrine/DBAL/Event/SchemaEventArgs.php b/lib/Doctrine/DBAL/Event/SchemaEventArgs.php index 3aa358985c7..d67529bd662 100644 --- a/lib/Doctrine/DBAL/Event/SchemaEventArgs.php +++ b/lib/Doctrine/DBAL/Event/SchemaEventArgs.php @@ -16,14 +16,14 @@ class SchemaEventArgs extends EventArgs /** * @var boolean */ - private $_preventDefault = false; + private $preventDefault = false; /** * @return \Doctrine\DBAL\Event\SchemaEventArgs */ public function preventDefault() { - $this->_preventDefault = true; + $this->preventDefault = true; return $this; } @@ -33,6 +33,6 @@ public function preventDefault() */ public function isDefaultPrevented() { - return $this->_preventDefault; + return $this->preventDefault; } } diff --git a/lib/Doctrine/DBAL/Event/SchemaIndexDefinitionEventArgs.php b/lib/Doctrine/DBAL/Event/SchemaIndexDefinitionEventArgs.php index 2095a6a6c27..6d94e42007e 100644 --- a/lib/Doctrine/DBAL/Event/SchemaIndexDefinitionEventArgs.php +++ b/lib/Doctrine/DBAL/Event/SchemaIndexDefinitionEventArgs.php @@ -17,24 +17,24 @@ class SchemaIndexDefinitionEventArgs extends SchemaEventArgs /** * @var \Doctrine\DBAL\Schema\Index|null */ - private $_index = null; + private $index = null; /** * Raw index data as fetched from the database. * * @var array */ - private $_tableIndex; + private $tableIndex; /** * @var string */ - private $_table; + private $table; /** * @var \Doctrine\DBAL\Connection */ - private $_connection; + private $connection; /** * @param array $tableIndex @@ -43,9 +43,9 @@ class SchemaIndexDefinitionEventArgs extends SchemaEventArgs */ public function __construct(array $tableIndex, $table, Connection $connection) { - $this->_tableIndex = $tableIndex; - $this->_table = $table; - $this->_connection = $connection; + $this->tableIndex = $tableIndex; + $this->table = $table; + $this->connection = $connection; } /** @@ -57,7 +57,7 @@ public function __construct(array $tableIndex, $table, Connection $connection) */ public function setIndex(Index $index = null) { - $this->_index = $index; + $this->index = $index; return $this; } @@ -67,7 +67,7 @@ public function setIndex(Index $index = null) */ public function getIndex() { - return $this->_index; + return $this->index; } /** @@ -75,7 +75,7 @@ public function getIndex() */ public function getTableIndex() { - return $this->_tableIndex; + return $this->tableIndex; } /** @@ -83,7 +83,7 @@ public function getTableIndex() */ public function getTable() { - return $this->_table; + return $this->table; } /** @@ -91,7 +91,7 @@ public function getTable() */ public function getConnection() { - return $this->_connection; + return $this->connection; } /** @@ -99,6 +99,6 @@ public function getConnection() */ public function getDatabasePlatform() { - return $this->_connection->getDatabasePlatform(); + return $this->connection->getDatabasePlatform(); } } diff --git a/lib/Doctrine/DBAL/Platforms/AbstractPlatform.php b/lib/Doctrine/DBAL/Platforms/AbstractPlatform.php index 6cbb88aece2..7a9a99c1882 100644 --- a/lib/Doctrine/DBAL/Platforms/AbstractPlatform.php +++ b/lib/Doctrine/DBAL/Platforms/AbstractPlatform.php @@ -129,14 +129,14 @@ abstract class AbstractPlatform /** * @var \Doctrine\Common\EventManager */ - protected $_eventManager; + protected $eventManager; /** * Holds the KeywordList instance for the current platform. * * @var \Doctrine\DBAL\Platforms\Keywords\KeywordList */ - protected $_keywords; + protected $keywords; /** * Constructor. @@ -152,7 +152,7 @@ public function __construct() */ public function setEventManager(EventManager $eventManager) { - $this->_eventManager = $eventManager; + $this->eventManager = $eventManager; } /** @@ -162,7 +162,7 @@ public function setEventManager(EventManager $eventManager) */ public function getEventManager() { - return $this->_eventManager; + return $this->eventManager; } /** @@ -208,7 +208,7 @@ abstract public function getSmallIntTypeDeclarationSQL(array $columnDef); * * @return string */ - abstract protected function _getCommonIntegerTypeDeclarationSQL(array $columnDef); + abstract protected function getCommonIntegerTypeDeclarationSQL(array $columnDef); /** * Lazy load Doctrine Type Mappings. @@ -1385,9 +1385,9 @@ public function getDropTableSQL($table) throw new \InvalidArgumentException('getDropTableSQL() expects $table parameter to be string or \Doctrine\DBAL\Schema\Table.'); } - if (null !== $this->_eventManager && $this->_eventManager->hasListeners(Events::onSchemaDropTable)) { + if (null !== $this->eventManager && $this->eventManager->hasListeners(Events::onSchemaDropTable)) { $eventArgs = new SchemaDropTableEventArgs($tableArg, $this); - $this->_eventManager->dispatchEvent(Events::onSchemaDropTable, $eventArgs); + $this->eventManager->dispatchEvent(Events::onSchemaDropTable, $eventArgs); if ($eventArgs->isDefaultPrevented()) { return $eventArgs->getSql(); @@ -1538,9 +1538,9 @@ public function getCreateTableSQL(Table $table, $createFlags = self::CREATE_INDE foreach ($table->getColumns() as $column) { /* @var \Doctrine\DBAL\Schema\Column $column */ - if (null !== $this->_eventManager && $this->_eventManager->hasListeners(Events::onSchemaCreateTableColumn)) { + if (null !== $this->eventManager && $this->eventManager->hasListeners(Events::onSchemaCreateTableColumn)) { $eventArgs = new SchemaCreateTableColumnEventArgs($column, $table, $this); - $this->_eventManager->dispatchEvent(Events::onSchemaCreateTableColumn, $eventArgs); + $this->eventManager->dispatchEvent(Events::onSchemaCreateTableColumn, $eventArgs); $columnSql = array_merge($columnSql, $eventArgs->getSql()); @@ -1565,16 +1565,16 @@ public function getCreateTableSQL(Table $table, $createFlags = self::CREATE_INDE $columns[$columnData['name']] = $columnData; } - if (null !== $this->_eventManager && $this->_eventManager->hasListeners(Events::onSchemaCreateTable)) { + if (null !== $this->eventManager && $this->eventManager->hasListeners(Events::onSchemaCreateTable)) { $eventArgs = new SchemaCreateTableEventArgs($table, $columns, $options, $this); - $this->_eventManager->dispatchEvent(Events::onSchemaCreateTable, $eventArgs); + $this->eventManager->dispatchEvent(Events::onSchemaCreateTable, $eventArgs); if ($eventArgs->isDefaultPrevented()) { return array_merge($eventArgs->getSql(), $columnSql); } } - $sql = $this->_getCreateTableSQL($tableName, $columns, $options); + $sql = $this->buildCreateTableSQL($tableName, $columns, $options); if ($this->supportsCommentOnStatement()) { foreach ($table->getColumns() as $column) { $comment = $this->getColumnComment($column); @@ -1632,7 +1632,7 @@ public function getInlineColumnCommentSQL($comment) * * @return array */ - protected function _getCreateTableSQL($tableName, array $columns, array $options = []) + protected function buildCreateTableSQL($tableName, array $columns, array $options = []) { $columnListSql = $this->getColumnDeclarationListSQL($columns); @@ -1917,16 +1917,16 @@ public function getAlterTableSQL(TableDiff $diff) */ protected function onSchemaAlterTableAddColumn(Column $column, TableDiff $diff, &$columnSql) { - if (null === $this->_eventManager) { + if (null === $this->eventManager) { return false; } - if ( ! $this->_eventManager->hasListeners(Events::onSchemaAlterTableAddColumn)) { + if ( ! $this->eventManager->hasListeners(Events::onSchemaAlterTableAddColumn)) { return false; } $eventArgs = new SchemaAlterTableAddColumnEventArgs($column, $diff, $this); - $this->_eventManager->dispatchEvent(Events::onSchemaAlterTableAddColumn, $eventArgs); + $this->eventManager->dispatchEvent(Events::onSchemaAlterTableAddColumn, $eventArgs); $columnSql = array_merge($columnSql, $eventArgs->getSql()); @@ -1942,16 +1942,16 @@ protected function onSchemaAlterTableAddColumn(Column $column, TableDiff $diff, */ protected function onSchemaAlterTableRemoveColumn(Column $column, TableDiff $diff, &$columnSql) { - if (null === $this->_eventManager) { + if (null === $this->eventManager) { return false; } - if ( ! $this->_eventManager->hasListeners(Events::onSchemaAlterTableRemoveColumn)) { + if ( ! $this->eventManager->hasListeners(Events::onSchemaAlterTableRemoveColumn)) { return false; } $eventArgs = new SchemaAlterTableRemoveColumnEventArgs($column, $diff, $this); - $this->_eventManager->dispatchEvent(Events::onSchemaAlterTableRemoveColumn, $eventArgs); + $this->eventManager->dispatchEvent(Events::onSchemaAlterTableRemoveColumn, $eventArgs); $columnSql = array_merge($columnSql, $eventArgs->getSql()); @@ -1967,16 +1967,16 @@ protected function onSchemaAlterTableRemoveColumn(Column $column, TableDiff $dif */ protected function onSchemaAlterTableChangeColumn(ColumnDiff $columnDiff, TableDiff $diff, &$columnSql) { - if (null === $this->_eventManager) { + if (null === $this->eventManager) { return false; } - if ( ! $this->_eventManager->hasListeners(Events::onSchemaAlterTableChangeColumn)) { + if ( ! $this->eventManager->hasListeners(Events::onSchemaAlterTableChangeColumn)) { return false; } $eventArgs = new SchemaAlterTableChangeColumnEventArgs($columnDiff, $diff, $this); - $this->_eventManager->dispatchEvent(Events::onSchemaAlterTableChangeColumn, $eventArgs); + $this->eventManager->dispatchEvent(Events::onSchemaAlterTableChangeColumn, $eventArgs); $columnSql = array_merge($columnSql, $eventArgs->getSql()); @@ -1993,16 +1993,16 @@ protected function onSchemaAlterTableChangeColumn(ColumnDiff $columnDiff, TableD */ protected function onSchemaAlterTableRenameColumn($oldColumnName, Column $column, TableDiff $diff, &$columnSql) { - if (null === $this->_eventManager) { + if (null === $this->eventManager) { return false; } - if ( ! $this->_eventManager->hasListeners(Events::onSchemaAlterTableRenameColumn)) { + if ( ! $this->eventManager->hasListeners(Events::onSchemaAlterTableRenameColumn)) { return false; } $eventArgs = new SchemaAlterTableRenameColumnEventArgs($oldColumnName, $column, $diff, $this); - $this->_eventManager->dispatchEvent(Events::onSchemaAlterTableRenameColumn, $eventArgs); + $this->eventManager->dispatchEvent(Events::onSchemaAlterTableRenameColumn, $eventArgs); $columnSql = array_merge($columnSql, $eventArgs->getSql()); @@ -2017,16 +2017,16 @@ protected function onSchemaAlterTableRenameColumn($oldColumnName, Column $column */ protected function onSchemaAlterTable(TableDiff $diff, &$sql) { - if (null === $this->_eventManager) { + if (null === $this->eventManager) { return false; } - if ( ! $this->_eventManager->hasListeners(Events::onSchemaAlterTable)) { + if ( ! $this->eventManager->hasListeners(Events::onSchemaAlterTable)) { return false; } $eventArgs = new SchemaAlterTableEventArgs($diff, $this); - $this->_eventManager->dispatchEvent(Events::onSchemaAlterTable, $eventArgs); + $this->eventManager->dispatchEvent(Events::onSchemaAlterTable, $eventArgs); $sql = array_merge($sql, $eventArgs->getSql()); @@ -2128,7 +2128,7 @@ protected function getRenameIndexSQL($oldIndexName, Index $index, $tableName) * * @return array */ - protected function _getAlterTableIndexForeignKeySQL(TableDiff $diff) + protected function getAlterTableIndexForeignKeySQL(TableDiff $diff) { return array_merge($this->getPreAlterTableIndexForeignKeySQL($diff), $this->getPostAlterTableIndexForeignKeySQL($diff)); } @@ -2711,7 +2711,7 @@ public function getCurrentTimestampSQL() * * @throws \InvalidArgumentException */ - protected function _getTransactionIsolationLevelSQL($level) + protected function getTransactionIsolationLevelSQL($level) { switch ($level) { case Connection::TRANSACTION_READ_UNCOMMITTED: @@ -3536,8 +3536,8 @@ public function rollbackSavePoint($savepoint) final public function getReservedKeywordsList() { // Check for an existing instantiation of the keywords class. - if ($this->_keywords) { - return $this->_keywords; + if ($this->keywords) { + return $this->keywords; } $class = $this->getReservedKeywordsClass(); @@ -3547,7 +3547,7 @@ final public function getReservedKeywordsList() } // Store the instance so it doesn't need to be generated on every request. - $this->_keywords = $keywords; + $this->keywords = $keywords; return $keywords; } diff --git a/lib/Doctrine/DBAL/Platforms/DB2Platform.php b/lib/Doctrine/DBAL/Platforms/DB2Platform.php index f1b88faf7a1..97d57c059e1 100644 --- a/lib/Doctrine/DBAL/Platforms/DB2Platform.php +++ b/lib/Doctrine/DBAL/Platforms/DB2Platform.php @@ -122,7 +122,7 @@ public function getBooleanTypeDeclarationSQL(array $columnDef) */ public function getIntegerTypeDeclarationSQL(array $columnDef) { - return 'INTEGER' . $this->_getCommonIntegerTypeDeclarationSQL($columnDef); + return 'INTEGER' . $this->getCommonIntegerTypeDeclarationSQL($columnDef); } /** @@ -130,7 +130,7 @@ public function getIntegerTypeDeclarationSQL(array $columnDef) */ public function getBigIntTypeDeclarationSQL(array $columnDef) { - return 'BIGINT' . $this->_getCommonIntegerTypeDeclarationSQL($columnDef); + return 'BIGINT' . $this->getCommonIntegerTypeDeclarationSQL($columnDef); } /** @@ -138,13 +138,13 @@ public function getBigIntTypeDeclarationSQL(array $columnDef) */ public function getSmallIntTypeDeclarationSQL(array $columnDef) { - return 'SMALLINT' . $this->_getCommonIntegerTypeDeclarationSQL($columnDef); + return 'SMALLINT' . $this->getCommonIntegerTypeDeclarationSQL($columnDef); } /** * {@inheritDoc} */ - protected function _getCommonIntegerTypeDeclarationSQL(array $columnDef) + protected function getCommonIntegerTypeDeclarationSQL(array $columnDef) { $autoinc = ''; if ( ! empty($columnDef['autoincrement'])) { @@ -460,7 +460,7 @@ public function getIndexDeclarationSQL($name, Index $index) /** * {@inheritDoc} */ - protected function _getCreateTableSQL($tableName, array $columns, array $options = []) + protected function buildCreateTableSQL($tableName, array $columns, array $options = []) { $indexes = []; if (isset($options['indexes'])) { @@ -468,7 +468,7 @@ protected function _getCreateTableSQL($tableName, array $columns, array $options } $options['indexes'] = []; - $sqls = parent::_getCreateTableSQL($tableName, $columns, $options); + $sqls = parent::buildCreateTableSQL($tableName, $columns, $options); foreach ($indexes as $definition) { $sqls[] = $this->getCreateIndexSQL($definition, $tableName); diff --git a/lib/Doctrine/DBAL/Platforms/DrizzlePlatform.php b/lib/Doctrine/DBAL/Platforms/DrizzlePlatform.php index c0be1a8a455..ee235d7d3df 100644 --- a/lib/Doctrine/DBAL/Platforms/DrizzlePlatform.php +++ b/lib/Doctrine/DBAL/Platforms/DrizzlePlatform.php @@ -72,13 +72,13 @@ public function getBooleanTypeDeclarationSQL(array $field) */ public function getIntegerTypeDeclarationSQL(array $field) { - return 'INT' . $this->_getCommonIntegerTypeDeclarationSQL($field); + return 'INT' . $this->getCommonIntegerTypeDeclarationSQL($field); } /** * {@inheritDoc} */ - protected function _getCommonIntegerTypeDeclarationSQL(array $columnDef) + protected function getCommonIntegerTypeDeclarationSQL(array $columnDef) { $autoinc = ''; if ( ! empty($columnDef['autoincrement'])) { @@ -93,7 +93,7 @@ protected function _getCommonIntegerTypeDeclarationSQL(array $columnDef) */ public function getBigIntTypeDeclarationSQL(array $field) { - return 'BIGINT' . $this->_getCommonIntegerTypeDeclarationSQL($field); + return 'BIGINT' . $this->getCommonIntegerTypeDeclarationSQL($field); } /** @@ -101,7 +101,7 @@ public function getBigIntTypeDeclarationSQL(array $field) */ public function getSmallIntTypeDeclarationSQL(array $field) { - return 'INT' . $this->_getCommonIntegerTypeDeclarationSQL($field); + return 'INT' . $this->getCommonIntegerTypeDeclarationSQL($field); } /** @@ -177,7 +177,7 @@ public function getDropDatabaseSQL($name) /** * {@inheritDoc} */ - protected function _getCreateTableSQL($tableName, array $columns, array $options = []) + protected function buildCreateTableSQL($tableName, array $columns, array $options = []) { $queryFields = $this->getColumnDeclarationListSQL($columns); diff --git a/lib/Doctrine/DBAL/Platforms/MySqlPlatform.php b/lib/Doctrine/DBAL/Platforms/MySqlPlatform.php index e6127f39705..8c03c9586a0 100644 --- a/lib/Doctrine/DBAL/Platforms/MySqlPlatform.php +++ b/lib/Doctrine/DBAL/Platforms/MySqlPlatform.php @@ -392,7 +392,7 @@ public function getDropDatabaseSQL($name) /** * {@inheritDoc} */ - protected function _getCreateTableSQL($tableName, array $columns, array $options = []) + protected function buildCreateTableSQL($tableName, array $columns, array $options = []) { $queryFields = $this->getColumnDeclarationListSQL($columns); @@ -856,7 +856,7 @@ protected function getCreateIndexSQLFlags(Index $index) */ public function getIntegerTypeDeclarationSQL(array $field) { - return 'INT' . $this->_getCommonIntegerTypeDeclarationSQL($field); + return 'INT' . $this->getCommonIntegerTypeDeclarationSQL($field); } /** @@ -864,7 +864,7 @@ public function getIntegerTypeDeclarationSQL(array $field) */ public function getBigIntTypeDeclarationSQL(array $field) { - return 'BIGINT' . $this->_getCommonIntegerTypeDeclarationSQL($field); + return 'BIGINT' . $this->getCommonIntegerTypeDeclarationSQL($field); } /** @@ -872,7 +872,7 @@ public function getBigIntTypeDeclarationSQL(array $field) */ public function getSmallIntTypeDeclarationSQL(array $field) { - return 'SMALLINT' . $this->_getCommonIntegerTypeDeclarationSQL($field); + return 'SMALLINT' . $this->getCommonIntegerTypeDeclarationSQL($field); } /** @@ -906,7 +906,7 @@ private function getUnsignedDeclaration(array $columnDef) /** * {@inheritDoc} */ - protected function _getCommonIntegerTypeDeclarationSQL(array $columnDef) + protected function getCommonIntegerTypeDeclarationSQL(array $columnDef) { $autoinc = ''; if ( ! empty($columnDef['autoincrement'])) { @@ -973,7 +973,7 @@ protected function getDropPrimaryKeySQL($table) */ public function getSetTransactionIsolationSQL($level) { - return 'SET SESSION TRANSACTION ISOLATION LEVEL ' . $this->_getTransactionIsolationLevelSQL($level); + return 'SET SESSION TRANSACTION ISOLATION LEVEL ' . $this->getTransactionIsolationLevelSQL($level); } /** diff --git a/lib/Doctrine/DBAL/Platforms/OraclePlatform.php b/lib/Doctrine/DBAL/Platforms/OraclePlatform.php index a225a9c53b0..1b512de6816 100644 --- a/lib/Doctrine/DBAL/Platforms/OraclePlatform.php +++ b/lib/Doctrine/DBAL/Platforms/OraclePlatform.php @@ -218,13 +218,13 @@ public function getSequenceNextValSQL($sequenceName) */ public function getSetTransactionIsolationSQL($level) { - return 'SET TRANSACTION ISOLATION LEVEL ' . $this->_getTransactionIsolationLevelSQL($level); + return 'SET TRANSACTION ISOLATION LEVEL ' . $this->getTransactionIsolationLevelSQL($level); } /** * {@inheritDoc} */ - protected function _getTransactionIsolationLevelSQL($level) + protected function getTransactionIsolationLevelSQL($level) { switch ($level) { case \Doctrine\DBAL\Connection::TRANSACTION_READ_UNCOMMITTED: @@ -235,7 +235,7 @@ protected function _getTransactionIsolationLevelSQL($level) case \Doctrine\DBAL\Connection::TRANSACTION_SERIALIZABLE: return 'SERIALIZABLE'; default: - return parent::_getTransactionIsolationLevelSQL($level); + return parent::getTransactionIsolationLevelSQL($level); } } @@ -306,7 +306,7 @@ public function getTimeTypeDeclarationSQL(array $fieldDeclaration) /** * {@inheritDoc} */ - protected function _getCommonIntegerTypeDeclarationSQL(array $columnDef) + protected function getCommonIntegerTypeDeclarationSQL(array $columnDef) { return ''; } @@ -367,11 +367,11 @@ public function getListSequencesSQL($database) /** * {@inheritDoc} */ - protected function _getCreateTableSQL($tableName, array $columns, array $options = []) + protected function buildCreateTableSQL($tableName, array $columns, array $options = []) { $indexes = $options['indexes'] ?? []; $options['indexes'] = []; - $sql = parent::_getCreateTableSQL($tableName, $columns, $options); + $sql = parent::buildCreateTableSQL($tableName, $columns, $options); foreach ($columns as $name => $column) { if (isset($column['sequence'])) { diff --git a/lib/Doctrine/DBAL/Platforms/PostgreSqlPlatform.php b/lib/Doctrine/DBAL/Platforms/PostgreSqlPlatform.php index d272a93ea04..8d82b13bb24 100644 --- a/lib/Doctrine/DBAL/Platforms/PostgreSqlPlatform.php +++ b/lib/Doctrine/DBAL/Platforms/PostgreSqlPlatform.php @@ -738,7 +738,7 @@ public function getDropForeignKeySQL($foreignKey, $table) /** * {@inheritDoc} */ - protected function _getCreateTableSQL($tableName, array $columns, array $options = []) + protected function buildCreateTableSQL($tableName, array $columns, array $options = []) { $queryFields = $this->getColumnDeclarationListSQL($columns); @@ -898,7 +898,7 @@ public function getSequenceNextValSQL($sequenceName) public function getSetTransactionIsolationSQL($level) { return 'SET SESSION CHARACTERISTICS AS TRANSACTION ISOLATION LEVEL ' - . $this->_getTransactionIsolationLevelSQL($level); + . $this->getTransactionIsolationLevelSQL($level); } /** @@ -992,7 +992,7 @@ public function getGuidExpression() /** * {@inheritDoc} */ - protected function _getCommonIntegerTypeDeclarationSQL(array $columnDef) + protected function getCommonIntegerTypeDeclarationSQL(array $columnDef) { return ''; } diff --git a/lib/Doctrine/DBAL/Platforms/SQLAnywherePlatform.php b/lib/Doctrine/DBAL/Platforms/SQLAnywherePlatform.php index 9735efcc42c..3b3aa97da4f 100644 --- a/lib/Doctrine/DBAL/Platforms/SQLAnywherePlatform.php +++ b/lib/Doctrine/DBAL/Platforms/SQLAnywherePlatform.php @@ -297,7 +297,7 @@ public function getBigIntTypeDeclarationSQL(array $columnDef) { $columnDef['integer_type'] = 'BIGINT'; - return $this->_getCommonIntegerTypeDeclarationSQL($columnDef); + return $this->getCommonIntegerTypeDeclarationSQL($columnDef); } /** @@ -689,7 +689,7 @@ public function getIntegerTypeDeclarationSQL(array $columnDef) { $columnDef['integer_type'] = 'INT'; - return $this->_getCommonIntegerTypeDeclarationSQL($columnDef); + return $this->getCommonIntegerTypeDeclarationSQL($columnDef); } /** @@ -995,7 +995,7 @@ public function getPrimaryKeyDeclarationSQL(Index $index, $name = null) */ public function getSetTransactionIsolationSQL($level) { - return 'SET TEMPORARY OPTION isolation_level = ' . $this->_getTransactionIsolationLevelSQL($level); + return 'SET TEMPORARY OPTION isolation_level = ' . $this->getTransactionIsolationLevelSQL($level); } /** @@ -1005,7 +1005,7 @@ public function getSmallIntTypeDeclarationSQL(array $columnDef) { $columnDef['integer_type'] = 'SMALLINT'; - return $this->_getCommonIntegerTypeDeclarationSQL($columnDef); + return $this->getCommonIntegerTypeDeclarationSQL($columnDef); } /** @@ -1174,7 +1174,7 @@ public function supportsIdentityColumns() /** * {@inheritdoc} */ - protected function _getCommonIntegerTypeDeclarationSQL(array $columnDef) + protected function getCommonIntegerTypeDeclarationSQL(array $columnDef) { $unsigned = ! empty($columnDef['unsigned']) ? 'UNSIGNED ' : ''; $autoincrement = ! empty($columnDef['autoincrement']) ? ' IDENTITY' : ''; @@ -1185,7 +1185,7 @@ protected function _getCommonIntegerTypeDeclarationSQL(array $columnDef) /** * {@inheritdoc} */ - protected function _getCreateTableSQL($tableName, array $columns, array $options = []) + protected function buildCreateTableSQL($tableName, array $columns, array $options = []) { $columnListSql = $this->getColumnDeclarationListSQL($columns); $indexSql = []; @@ -1234,7 +1234,7 @@ protected function _getCreateTableSQL($tableName, array $columns, array $options /** * {@inheritdoc} */ - protected function _getTransactionIsolationLevelSQL($level) + protected function getTransactionIsolationLevelSQL($level) { switch ($level) { case Connection::TRANSACTION_READ_UNCOMMITTED: diff --git a/lib/Doctrine/DBAL/Platforms/SQLServerPlatform.php b/lib/Doctrine/DBAL/Platforms/SQLServerPlatform.php index 045bdf82ab5..053b3d11ad6 100644 --- a/lib/Doctrine/DBAL/Platforms/SQLServerPlatform.php +++ b/lib/Doctrine/DBAL/Platforms/SQLServerPlatform.php @@ -215,7 +215,7 @@ public function getDropIndexSQL($index, $table = null) /** * {@inheritDoc} */ - protected function _getCreateTableSQL($tableName, array $columns, array $options = []) + protected function buildCreateTableSQL($tableName, array $columns, array $options = []) { $defaultConstraintsSql = []; $commentsSql = []; @@ -356,7 +356,7 @@ public function getCreateIndexSQL(Index $index, $table) $constraint = parent::getCreateIndexSQL($index, $table); if ($index->isUnique() && !$index->isPrimary()) { - $constraint = $this->_appendUniqueConstraintDefinition($constraint, $index); + $constraint = $this->appendUniqueConstraintDefinition($constraint, $index); } return $constraint; @@ -389,7 +389,7 @@ protected function getCreateIndexSQLFlags(Index $index) * * @return string */ - private function _appendUniqueConstraintDefinition($sql, Index $index) + private function appendUniqueConstraintDefinition($sql, Index $index) { $fields = []; @@ -1070,7 +1070,7 @@ public function getLengthExpression($column) */ public function getSetTransactionIsolationSQL($level) { - return 'SET TRANSACTION ISOLATION LEVEL ' . $this->_getTransactionIsolationLevelSQL($level); + return 'SET TRANSACTION ISOLATION LEVEL ' . $this->getTransactionIsolationLevelSQL($level); } /** @@ -1078,7 +1078,7 @@ public function getSetTransactionIsolationSQL($level) */ public function getIntegerTypeDeclarationSQL(array $field) { - return 'INT' . $this->_getCommonIntegerTypeDeclarationSQL($field); + return 'INT' . $this->getCommonIntegerTypeDeclarationSQL($field); } /** @@ -1086,7 +1086,7 @@ public function getIntegerTypeDeclarationSQL(array $field) */ public function getBigIntTypeDeclarationSQL(array $field) { - return 'BIGINT' . $this->_getCommonIntegerTypeDeclarationSQL($field); + return 'BIGINT' . $this->getCommonIntegerTypeDeclarationSQL($field); } /** @@ -1094,7 +1094,7 @@ public function getBigIntTypeDeclarationSQL(array $field) */ public function getSmallIntTypeDeclarationSQL(array $field) { - return 'SMALLINT' . $this->_getCommonIntegerTypeDeclarationSQL($field); + return 'SMALLINT' . $this->getCommonIntegerTypeDeclarationSQL($field); } /** @@ -1140,7 +1140,7 @@ public function getClobTypeDeclarationSQL(array $field) /** * {@inheritDoc} */ - protected function _getCommonIntegerTypeDeclarationSQL(array $columnDef) + protected function getCommonIntegerTypeDeclarationSQL(array $columnDef) { return (!empty($columnDef['autoincrement'])) ? ' IDENTITY' : ''; } diff --git a/lib/Doctrine/DBAL/Platforms/SqlitePlatform.php b/lib/Doctrine/DBAL/Platforms/SqlitePlatform.php index 07e933ace06..b50335684da 100644 --- a/lib/Doctrine/DBAL/Platforms/SqlitePlatform.php +++ b/lib/Doctrine/DBAL/Platforms/SqlitePlatform.php @@ -147,7 +147,7 @@ public function getDateDiffExpression($date1, $date2) /** * {@inheritDoc} */ - protected function _getTransactionIsolationLevelSQL($level) + protected function getTransactionIsolationLevelSQL($level) { switch ($level) { case \Doctrine\DBAL\Connection::TRANSACTION_READ_UNCOMMITTED: @@ -157,7 +157,7 @@ protected function _getTransactionIsolationLevelSQL($level) case \Doctrine\DBAL\Connection::TRANSACTION_SERIALIZABLE: return 1; default: - return parent::_getTransactionIsolationLevelSQL($level); + return parent::getTransactionIsolationLevelSQL($level); } } @@ -166,7 +166,7 @@ protected function _getTransactionIsolationLevelSQL($level) */ public function getSetTransactionIsolationSQL($level) { - return 'PRAGMA read_uncommitted = ' . $this->_getTransactionIsolationLevelSQL($level); + return 'PRAGMA read_uncommitted = ' . $this->getTransactionIsolationLevelSQL($level); } /** @@ -190,7 +190,7 @@ public function getBooleanTypeDeclarationSQL(array $field) */ public function getIntegerTypeDeclarationSQL(array $field) { - return 'INTEGER' . $this->_getCommonIntegerTypeDeclarationSQL($field); + return 'INTEGER' . $this->getCommonIntegerTypeDeclarationSQL($field); } /** @@ -203,7 +203,7 @@ public function getBigIntTypeDeclarationSQL(array $field) return $this->getIntegerTypeDeclarationSQL($field); } - return 'BIGINT' . $this->_getCommonIntegerTypeDeclarationSQL($field); + return 'BIGINT' . $this->getCommonIntegerTypeDeclarationSQL($field); } /** @@ -216,7 +216,7 @@ public function getTinyIntTypeDeclarationSql(array $field) return $this->getIntegerTypeDeclarationSQL($field); } - return 'TINYINT' . $this->_getCommonIntegerTypeDeclarationSQL($field); + return 'TINYINT' . $this->getCommonIntegerTypeDeclarationSQL($field); } /** @@ -229,7 +229,7 @@ public function getSmallIntTypeDeclarationSQL(array $field) return $this->getIntegerTypeDeclarationSQL($field); } - return 'SMALLINT' . $this->_getCommonIntegerTypeDeclarationSQL($field); + return 'SMALLINT' . $this->getCommonIntegerTypeDeclarationSQL($field); } /** @@ -242,7 +242,7 @@ public function getMediumIntTypeDeclarationSql(array $field) return $this->getIntegerTypeDeclarationSQL($field); } - return 'MEDIUMINT' . $this->_getCommonIntegerTypeDeclarationSQL($field); + return 'MEDIUMINT' . $this->getCommonIntegerTypeDeclarationSQL($field); } /** @@ -272,7 +272,7 @@ public function getTimeTypeDeclarationSQL(array $fieldDeclaration) /** * {@inheritDoc} */ - protected function _getCommonIntegerTypeDeclarationSQL(array $columnDef) + protected function getCommonIntegerTypeDeclarationSQL(array $columnDef) { // sqlite autoincrement is implicit for integer PKs, but not when the field is unsigned if ( ! empty($columnDef['autoincrement'])) { @@ -299,7 +299,7 @@ public function getForeignKeyDeclarationSQL(ForeignKeyConstraint $foreignKey) /** * {@inheritDoc} */ - protected function _getCreateTableSQL($tableName, array $columns, array $options = []) + protected function buildCreateTableSQL($tableName, array $columns, array $options = []) { $tableName = str_replace('.', '__', $tableName); $queryFields = $this->getColumnDeclarationListSQL($columns); diff --git a/lib/Doctrine/DBAL/Portability/Connection.php b/lib/Doctrine/DBAL/Portability/Connection.php index 5002fbaf2e3..80d4a35431f 100644 --- a/lib/Doctrine/DBAL/Portability/Connection.php +++ b/lib/Doctrine/DBAL/Portability/Connection.php @@ -69,9 +69,9 @@ public function connect() } if (isset($params['fetch_case']) && $this->portability & self::PORTABILITY_FIX_CASE) { - if ($this->_conn instanceof \Doctrine\DBAL\Driver\PDOConnection) { + if ($this->conn instanceof \Doctrine\DBAL\Driver\PDOConnection) { // make use of c-level support for case handling - $this->_conn->setAttribute(\PDO::ATTR_CASE, $params['fetch_case']); + $this->conn->setAttribute(\PDO::ATTR_CASE, $params['fetch_case']); } else { $this->case = ($params['fetch_case'] == ColumnCase::LOWER) ? CASE_LOWER : CASE_UPPER; } @@ -126,7 +126,7 @@ public function query() { $this->connect(); - $stmt = $this->_conn->query(...func_get_args()); + $stmt = $this->conn->query(...func_get_args()); $stmt = new Statement($stmt, $this); $stmt->setFetchMode($this->defaultFetchMode); diff --git a/lib/Doctrine/DBAL/Schema/AbstractAsset.php b/lib/Doctrine/DBAL/Schema/AbstractAsset.php index 2748a187621..9e1f922ad36 100644 --- a/lib/Doctrine/DBAL/Schema/AbstractAsset.php +++ b/lib/Doctrine/DBAL/Schema/AbstractAsset.php @@ -19,19 +19,19 @@ abstract class AbstractAsset /** * @var string */ - protected $_name; + protected $name; /** * Namespace of the asset. If none isset the default namespace is assumed. * * @var string|null */ - protected $_namespace = null; + protected $namespace = null; /** * @var boolean */ - protected $_quoted = false; + protected $quoted = false; /** * Sets the name of this asset. @@ -40,18 +40,18 @@ abstract class AbstractAsset * * @return void */ - protected function _setName($name) + protected function setName($name) { if ($this->isIdentifierQuoted($name)) { - $this->_quoted = true; + $this->quoted = true; $name = $this->trimQuotes($name); } if (strpos($name, ".") !== false) { $parts = explode(".", $name); - $this->_namespace = $parts[0]; + $this->namespace = $parts[0]; $name = $parts[1]; } - $this->_name = $name; + $this->name = $name; } /** @@ -63,7 +63,7 @@ protected function _setName($name) */ public function isInDefaultNamespace($defaultNamespaceName) { - return $this->_namespace == $defaultNamespaceName || $this->_namespace === null; + return $this->namespace == $defaultNamespaceName || $this->namespace === null; } /** @@ -75,7 +75,7 @@ public function isInDefaultNamespace($defaultNamespaceName) */ public function getNamespaceName() { - return $this->_namespace; + return $this->namespace; } /** @@ -89,8 +89,8 @@ public function getNamespaceName() public function getShortestName($defaultNamespaceName) { $shortestName = $this->getName(); - if ($this->_namespace == $defaultNamespaceName) { - $shortestName = $this->_name; + if ($this->namespace == $defaultNamespaceName) { + $shortestName = $this->name; } return strtolower($shortestName); @@ -112,7 +112,7 @@ public function getShortestName($defaultNamespaceName) public function getFullQualifiedName($defaultNamespaceName) { $name = $this->getName(); - if ( ! $this->_namespace) { + if ( ! $this->namespace) { $name = $defaultNamespaceName . "." . $name; } @@ -126,7 +126,7 @@ public function getFullQualifiedName($defaultNamespaceName) */ public function isQuoted() { - return $this->_quoted; + return $this->quoted; } /** @@ -160,11 +160,11 @@ protected function trimQuotes($identifier) */ public function getName() { - if ($this->_namespace) { - return $this->_namespace . "." . $this->_name; + if ($this->namespace) { + return $this->namespace . "." . $this->name; } - return $this->_name; + return $this->name; } /** @@ -180,7 +180,7 @@ public function getQuotedName(AbstractPlatform $platform) $keywords = $platform->getReservedKeywordsList(); $parts = explode(".", $this->getName()); foreach ($parts as $k => $v) { - $parts[$k] = ($this->_quoted || $keywords->isKeyword($v)) ? $platform->quoteIdentifier($v) : $v; + $parts[$k] = ($this->quoted || $keywords->isKeyword($v)) ? $platform->quoteIdentifier($v) : $v; } return implode(".", $parts); @@ -199,7 +199,7 @@ public function getQuotedName(AbstractPlatform $platform) * * @return string */ - protected function _generateIdentifierName($columnNames, $prefix='', $maxSize=30) + protected function generateIdentifierName($columnNames, $prefix='', $maxSize=30) { $hash = implode("", array_map(function ($column) { return dechex(crc32($column)); diff --git a/lib/Doctrine/DBAL/Schema/AbstractSchemaManager.php b/lib/Doctrine/DBAL/Schema/AbstractSchemaManager.php index 72a2633e2e5..d7e4e30d18f 100644 --- a/lib/Doctrine/DBAL/Schema/AbstractSchemaManager.php +++ b/lib/Doctrine/DBAL/Schema/AbstractSchemaManager.php @@ -26,14 +26,14 @@ abstract class AbstractSchemaManager * * @var \Doctrine\DBAL\Connection */ - protected $_conn; + protected $conn; /** * Holds instance of the database platform used for this schema manager. * * @var \Doctrine\DBAL\Platforms\AbstractPlatform */ - protected $_platform; + protected $platform; /** * Constructor. Accepts the Connection instance to manage the schema for. @@ -43,8 +43,8 @@ abstract class AbstractSchemaManager */ public function __construct(\Doctrine\DBAL\Connection $conn, AbstractPlatform $platform = null) { - $this->_conn = $conn; - $this->_platform = $platform ?: $this->_conn->getDatabasePlatform(); + $this->conn = $conn; + $this->platform = $platform ?: $this->conn->getDatabasePlatform(); } /** @@ -54,7 +54,7 @@ public function __construct(\Doctrine\DBAL\Connection $conn, AbstractPlatform $p */ public function getDatabasePlatform() { - return $this->_platform; + return $this->platform; } /** @@ -90,11 +90,11 @@ public function tryMethod() */ public function listDatabases() { - $sql = $this->_platform->getListDatabasesSQL(); + $sql = $this->platform->getListDatabasesSQL(); - $databases = $this->_conn->fetchAll($sql); + $databases = $this->conn->fetchAll($sql); - return $this->_getPortableDatabasesList($databases); + return $this->getPortableDatabasesList($databases); } /** @@ -104,9 +104,9 @@ public function listDatabases() */ public function listNamespaceNames() { - $sql = $this->_platform->getListNamespacesSQL(); + $sql = $this->platform->getListNamespacesSQL(); - $namespaces = $this->_conn->fetchAll($sql); + $namespaces = $this->conn->fetchAll($sql); return $this->getPortableNamespacesList($namespaces); } @@ -121,13 +121,13 @@ public function listNamespaceNames() public function listSequences($database = null) { if (is_null($database)) { - $database = $this->_conn->getDatabase(); + $database = $this->conn->getDatabase(); } - $sql = $this->_platform->getListSequencesSQL($database); + $sql = $this->platform->getListSequencesSQL($database); - $sequences = $this->_conn->fetchAll($sql); + $sequences = $this->conn->fetchAll($sql); - return $this->filterAssetNames($this->_getPortableSequencesList($sequences)); + return $this->filterAssetNames($this->getPortableSequencesList($sequences)); } /** @@ -148,14 +148,14 @@ public function listSequences($database = null) public function listTableColumns($table, $database = null) { if ( ! $database) { - $database = $this->_conn->getDatabase(); + $database = $this->conn->getDatabase(); } - $sql = $this->_platform->getListTableColumnsSQL($table, $database); + $sql = $this->platform->getListTableColumnsSQL($table, $database); - $tableColumns = $this->_conn->fetchAll($sql); + $tableColumns = $this->conn->fetchAll($sql); - return $this->_getPortableTableColumnList($table, $database, $tableColumns); + return $this->getPortableTableColumnList($table, $database, $tableColumns); } /** @@ -169,11 +169,11 @@ public function listTableColumns($table, $database = null) */ public function listTableIndexes($table) { - $sql = $this->_platform->getListTableIndexesSQL($table, $this->_conn->getDatabase()); + $sql = $this->platform->getListTableIndexesSQL($table, $this->conn->getDatabase()); - $tableIndexes = $this->_conn->fetchAll($sql); + $tableIndexes = $this->conn->fetchAll($sql); - return $this->_getPortableTableIndexesList($tableIndexes, $table); + return $this->getPortableTableIndexesList($tableIndexes, $table); } /** @@ -197,10 +197,10 @@ public function tablesExist($tableNames) */ public function listTableNames() { - $sql = $this->_platform->getListTablesSQL(); + $sql = $this->platform->getListTablesSQL(); - $tables = $this->_conn->fetchAll($sql); - $tableNames = $this->_getPortableTablesList($tables); + $tables = $this->conn->fetchAll($sql); + $tableNames = $this->getPortableTablesList($tables); return $this->filterAssetNames($tableNames); } @@ -234,7 +234,7 @@ protected function filterAssetNames($assetNames) */ protected function getFilterSchemaAssetsExpression() { - return $this->_conn->getConfiguration()->getFilterSchemaAssetsExpression(); + return $this->conn->getConfiguration()->getFilterSchemaAssetsExpression(); } /** @@ -264,7 +264,7 @@ public function listTableDetails($tableName) $columns = $this->listTableColumns($tableName); $foreignKeys = []; - if ($this->_platform->supportsForeignKeyConstraints()) { + if ($this->platform->supportsForeignKeyConstraints()) { $foreignKeys = $this->listTableForeignKeys($tableName); } @@ -280,11 +280,11 @@ public function listTableDetails($tableName) */ public function listViews() { - $database = $this->_conn->getDatabase(); - $sql = $this->_platform->getListViewsSQL($database); - $views = $this->_conn->fetchAll($sql); + $database = $this->conn->getDatabase(); + $sql = $this->platform->getListViewsSQL($database); + $views = $this->conn->fetchAll($sql); - return $this->_getPortableViewsList($views); + return $this->getPortableViewsList($views); } /** @@ -298,12 +298,12 @@ public function listViews() public function listTableForeignKeys($table, $database = null) { if (is_null($database)) { - $database = $this->_conn->getDatabase(); + $database = $this->conn->getDatabase(); } - $sql = $this->_platform->getListTableForeignKeysSQL($table, $database); - $tableForeignKeys = $this->_conn->fetchAll($sql); + $sql = $this->platform->getListTableForeignKeysSQL($table, $database); + $tableForeignKeys = $this->conn->fetchAll($sql); - return $this->_getPortableTableForeignKeysList($tableForeignKeys); + return $this->getPortableTableForeignKeysList($tableForeignKeys); } /* drop*() Methods */ @@ -319,7 +319,7 @@ public function listTableForeignKeys($table, $database = null) */ public function dropDatabase($database) { - $this->_execSql($this->_platform->getDropDatabaseSQL($database)); + $this->execSql($this->platform->getDropDatabaseSQL($database)); } /** @@ -331,7 +331,7 @@ public function dropDatabase($database) */ public function dropTable($tableName) { - $this->_execSql($this->_platform->getDropTableSQL($tableName)); + $this->execSql($this->platform->getDropTableSQL($tableName)); } /** @@ -345,10 +345,10 @@ public function dropTable($tableName) public function dropIndex($index, $table) { if ($index instanceof Index) { - $index = $index->getQuotedName($this->_platform); + $index = $index->getQuotedName($this->platform); } - $this->_execSql($this->_platform->getDropIndexSQL($index, $table)); + $this->execSql($this->platform->getDropIndexSQL($index, $table)); } /** @@ -361,7 +361,7 @@ public function dropIndex($index, $table) */ public function dropConstraint(Constraint $constraint, $table) { - $this->_execSql($this->_platform->getDropConstraintSQL($constraint, $table)); + $this->execSql($this->platform->getDropConstraintSQL($constraint, $table)); } /** @@ -374,7 +374,7 @@ public function dropConstraint(Constraint $constraint, $table) */ public function dropForeignKey($foreignKey, $table) { - $this->_execSql($this->_platform->getDropForeignKeySQL($foreignKey, $table)); + $this->execSql($this->platform->getDropForeignKeySQL($foreignKey, $table)); } /** @@ -386,7 +386,7 @@ public function dropForeignKey($foreignKey, $table) */ public function dropSequence($name) { - $this->_execSql($this->_platform->getDropSequenceSQL($name)); + $this->execSql($this->platform->getDropSequenceSQL($name)); } /** @@ -398,7 +398,7 @@ public function dropSequence($name) */ public function dropView($name) { - $this->_execSql($this->_platform->getDropViewSQL($name)); + $this->execSql($this->platform->getDropViewSQL($name)); } /* create*() Methods */ @@ -412,7 +412,7 @@ public function dropView($name) */ public function createDatabase($database) { - $this->_execSql($this->_platform->getCreateDatabaseSQL($database)); + $this->execSql($this->platform->getCreateDatabaseSQL($database)); } /** @@ -425,7 +425,7 @@ public function createDatabase($database) public function createTable(Table $table) { $createFlags = AbstractPlatform::CREATE_INDEXES|AbstractPlatform::CREATE_FOREIGNKEYS; - $this->_execSql($this->_platform->getCreateTableSQL($table, $createFlags)); + $this->execSql($this->platform->getCreateTableSQL($table, $createFlags)); } /** @@ -439,7 +439,7 @@ public function createTable(Table $table) */ public function createSequence($sequence) { - $this->_execSql($this->_platform->getCreateSequenceSQL($sequence)); + $this->execSql($this->platform->getCreateSequenceSQL($sequence)); } /** @@ -452,7 +452,7 @@ public function createSequence($sequence) */ public function createConstraint(Constraint $constraint, $table) { - $this->_execSql($this->_platform->getCreateConstraintSQL($constraint, $table)); + $this->execSql($this->platform->getCreateConstraintSQL($constraint, $table)); } /** @@ -465,7 +465,7 @@ public function createConstraint(Constraint $constraint, $table) */ public function createIndex(Index $index, $table) { - $this->_execSql($this->_platform->getCreateIndexSQL($index, $table)); + $this->execSql($this->platform->getCreateIndexSQL($index, $table)); } /** @@ -478,7 +478,7 @@ public function createIndex(Index $index, $table) */ public function createForeignKey(ForeignKeyConstraint $foreignKey, $table) { - $this->_execSql($this->_platform->getCreateForeignKeySQL($foreignKey, $table)); + $this->execSql($this->platform->getCreateForeignKeySQL($foreignKey, $table)); } /** @@ -490,7 +490,7 @@ public function createForeignKey(ForeignKeyConstraint $foreignKey, $table) */ public function createView(View $view) { - $this->_execSql($this->_platform->getCreateViewSQL($view->getQuotedName($this->_platform), $view->getSql())); + $this->execSql($this->platform->getCreateViewSQL($view->getQuotedName($this->platform), $view->getSql())); } /* dropAndCreate*() Methods */ @@ -522,7 +522,7 @@ public function dropAndCreateConstraint(Constraint $constraint, $table) */ public function dropAndCreateIndex(Index $index, $table) { - $this->tryMethod('dropIndex', $index->getQuotedName($this->_platform), $table); + $this->tryMethod('dropIndex', $index->getQuotedName($this->platform), $table); $this->createIndex($index, $table); } @@ -551,7 +551,7 @@ public function dropAndCreateForeignKey(ForeignKeyConstraint $foreignKey, $table */ public function dropAndCreateSequence(Sequence $sequence) { - $this->tryMethod('dropSequence', $sequence->getQuotedName($this->_platform)); + $this->tryMethod('dropSequence', $sequence->getQuotedName($this->platform)); $this->createSequence($sequence); } @@ -564,7 +564,7 @@ public function dropAndCreateSequence(Sequence $sequence) */ public function dropAndCreateTable(Table $table) { - $this->tryMethod('dropTable', $table->getQuotedName($this->_platform)); + $this->tryMethod('dropTable', $table->getQuotedName($this->platform)); $this->createTable($table); } @@ -590,7 +590,7 @@ public function dropAndCreateDatabase($database) */ public function dropAndCreateView(View $view) { - $this->tryMethod('dropView', $view->getQuotedName($this->_platform)); + $this->tryMethod('dropView', $view->getQuotedName($this->platform)); $this->createView($view); } @@ -605,11 +605,11 @@ public function dropAndCreateView(View $view) */ public function alterTable(TableDiff $tableDiff) { - $queries = $this->_platform->getAlterTableSQL($tableDiff); + $queries = $this->platform->getAlterTableSQL($tableDiff); if (is_array($queries) && count($queries)) { foreach ($queries as $ddlQuery) { - $this->_execSql($ddlQuery); + $this->execSql($ddlQuery); } } } @@ -639,11 +639,11 @@ public function renameTable($name, $newName) * * @return array */ - protected function _getPortableDatabasesList($databases) + protected function getPortableDatabasesList($databases) { $list = []; foreach ($databases as $value) { - if ($value = $this->_getPortableDatabaseDefinition($value)) { + if ($value = $this->getPortableDatabaseDefinition($value)) { $list[] = $value; } } @@ -674,7 +674,7 @@ protected function getPortableNamespacesList(array $namespaces) * * @return mixed */ - protected function _getPortableDatabaseDefinition($database) + protected function getPortableDatabaseDefinition($database) { return $database; } @@ -696,11 +696,11 @@ protected function getPortableNamespaceDefinition(array $namespace) * * @return array */ - protected function _getPortableFunctionsList($functions) + protected function getPortableFunctionsList($functions) { $list = []; foreach ($functions as $value) { - if ($value = $this->_getPortableFunctionDefinition($value)) { + if ($value = $this->getPortableFunctionDefinition($value)) { $list[] = $value; } } @@ -713,7 +713,7 @@ protected function _getPortableFunctionsList($functions) * * @return mixed */ - protected function _getPortableFunctionDefinition($function) + protected function getPortableFunctionDefinition($function) { return $function; } @@ -723,11 +723,11 @@ protected function _getPortableFunctionDefinition($function) * * @return array */ - protected function _getPortableTriggersList($triggers) + protected function getPortableTriggersList($triggers) { $list = []; foreach ($triggers as $value) { - if ($value = $this->_getPortableTriggerDefinition($value)) { + if ($value = $this->getPortableTriggerDefinition($value)) { $list[] = $value; } } @@ -740,7 +740,7 @@ protected function _getPortableTriggersList($triggers) * * @return mixed */ - protected function _getPortableTriggerDefinition($trigger) + protected function getPortableTriggerDefinition($trigger) { return $trigger; } @@ -750,11 +750,11 @@ protected function _getPortableTriggerDefinition($trigger) * * @return array */ - protected function _getPortableSequencesList($sequences) + protected function getPortableSequencesList($sequences) { $list = []; foreach ($sequences as $value) { - if ($value = $this->_getPortableSequenceDefinition($value)) { + if ($value = $this->getPortableSequenceDefinition($value)) { $list[] = $value; } } @@ -769,7 +769,7 @@ protected function _getPortableSequencesList($sequences) * * @throws \Doctrine\DBAL\DBALException */ - protected function _getPortableSequenceDefinition($sequence) + protected function getPortableSequenceDefinition($sequence) { throw DBALException::notSupported('Sequences'); } @@ -785,9 +785,9 @@ protected function _getPortableSequenceDefinition($sequence) * * @return array */ - protected function _getPortableTableColumnList($table, $database, $tableColumns) + protected function getPortableTableColumnList($table, $database, $tableColumns) { - $eventManager = $this->_platform->getEventManager(); + $eventManager = $this->platform->getEventManager(); $list = []; foreach ($tableColumns as $tableColumn) { @@ -795,7 +795,7 @@ protected function _getPortableTableColumnList($table, $database, $tableColumns) $defaultPrevented = false; if (null !== $eventManager && $eventManager->hasListeners(Events::onSchemaColumnDefinition)) { - $eventArgs = new SchemaColumnDefinitionEventArgs($tableColumn, $table, $database, $this->_conn); + $eventArgs = new SchemaColumnDefinitionEventArgs($tableColumn, $table, $database, $this->conn); $eventManager->dispatchEvent(Events::onSchemaColumnDefinition, $eventArgs); $defaultPrevented = $eventArgs->isDefaultPrevented(); @@ -803,11 +803,11 @@ protected function _getPortableTableColumnList($table, $database, $tableColumns) } if ( ! $defaultPrevented) { - $column = $this->_getPortableTableColumnDefinition($tableColumn); + $column = $this->getPortableTableColumnDefinition($tableColumn); } if ($column) { - $name = strtolower($column->getQuotedName($this->_platform)); + $name = strtolower($column->getQuotedName($this->platform)); $list[$name] = $column; } } @@ -822,7 +822,7 @@ protected function _getPortableTableColumnList($table, $database, $tableColumns) * * @return \Doctrine\DBAL\Schema\Column */ - abstract protected function _getPortableTableColumnDefinition($tableColumn); + abstract protected function getPortableTableColumnDefinition($tableColumn); /** * Aggregates and groups the index results according to the required data result. @@ -832,7 +832,7 @@ abstract protected function _getPortableTableColumnDefinition($tableColumn); * * @return array */ - protected function _getPortableTableIndexesList($tableIndexRows, $tableName=null) + protected function getPortableTableIndexesList($tableIndexRows, $tableName=null) { $result = []; foreach ($tableIndexRows as $tableIndex) { @@ -856,7 +856,7 @@ protected function _getPortableTableIndexesList($tableIndexRows, $tableName=null } } - $eventManager = $this->_platform->getEventManager(); + $eventManager = $this->platform->getEventManager(); $indexes = []; foreach ($result as $indexKey => $data) { @@ -864,7 +864,7 @@ protected function _getPortableTableIndexesList($tableIndexRows, $tableName=null $defaultPrevented = false; if (null !== $eventManager && $eventManager->hasListeners(Events::onSchemaIndexDefinition)) { - $eventArgs = new SchemaIndexDefinitionEventArgs($data, $tableName, $this->_conn); + $eventArgs = new SchemaIndexDefinitionEventArgs($data, $tableName, $this->conn); $eventManager->dispatchEvent(Events::onSchemaIndexDefinition, $eventArgs); $defaultPrevented = $eventArgs->isDefaultPrevented(); @@ -888,11 +888,11 @@ protected function _getPortableTableIndexesList($tableIndexRows, $tableName=null * * @return array */ - protected function _getPortableTablesList($tables) + protected function getPortableTablesList($tables) { $list = []; foreach ($tables as $value) { - if ($value = $this->_getPortableTableDefinition($value)) { + if ($value = $this->getPortableTableDefinition($value)) { $list[] = $value; } } @@ -905,7 +905,7 @@ protected function _getPortableTablesList($tables) * * @return array */ - protected function _getPortableTableDefinition($table) + protected function getPortableTableDefinition($table) { return $table; } @@ -915,11 +915,11 @@ protected function _getPortableTableDefinition($table) * * @return array */ - protected function _getPortableUsersList($users) + protected function getPortableUsersList($users) { $list = []; foreach ($users as $value) { - if ($value = $this->_getPortableUserDefinition($value)) { + if ($value = $this->getPortableUserDefinition($value)) { $list[] = $value; } } @@ -932,7 +932,7 @@ protected function _getPortableUsersList($users) * * @return mixed */ - protected function _getPortableUserDefinition($user) + protected function getPortableUserDefinition($user) { return $user; } @@ -942,12 +942,12 @@ protected function _getPortableUserDefinition($user) * * @return array */ - protected function _getPortableViewsList($views) + protected function getPortableViewsList($views) { $list = []; foreach ($views as $value) { - if ($view = $this->_getPortableViewDefinition($value)) { - $viewName = strtolower($view->getQuotedName($this->_platform)); + if ($view = $this->getPortableViewDefinition($value)) { + $viewName = strtolower($view->getQuotedName($this->platform)); $list[$viewName] = $view; } } @@ -960,7 +960,7 @@ protected function _getPortableViewsList($views) * * @return mixed */ - protected function _getPortableViewDefinition($view) + protected function getPortableViewDefinition($view) { return false; } @@ -970,11 +970,11 @@ protected function _getPortableViewDefinition($view) * * @return array */ - protected function _getPortableTableForeignKeysList($tableForeignKeys) + protected function getPortableTableForeignKeysList($tableForeignKeys) { $list = []; foreach ($tableForeignKeys as $value) { - if ($value = $this->_getPortableTableForeignKeyDefinition($value)) { + if ($value = $this->getPortableTableForeignKeyDefinition($value)) { $list[] = $value; } } @@ -987,7 +987,7 @@ protected function _getPortableTableForeignKeysList($tableForeignKeys) * * @return mixed */ - protected function _getPortableTableForeignKeyDefinition($tableForeignKey) + protected function getPortableTableForeignKeyDefinition($tableForeignKey) { return $tableForeignKey; } @@ -997,10 +997,10 @@ protected function _getPortableTableForeignKeyDefinition($tableForeignKey) * * @return void */ - protected function _execSql($sql) + protected function execSql($sql) { foreach ((array) $sql as $query) { - $this->_conn->executeUpdate($query); + $this->conn->executeUpdate($query); } } @@ -1013,13 +1013,13 @@ public function createSchema() { $namespaces = []; - if ($this->_platform->supportsSchemas()) { + if ($this->platform->supportsSchemas()) { $namespaces = $this->listNamespaceNames(); } $sequences = []; - if ($this->_platform->supportsSequences()) { + if ($this->platform->supportsSequences()) { $sequences = $this->listSequences(); } @@ -1036,14 +1036,14 @@ public function createSchema() public function createSchemaConfig() { $schemaConfig = new SchemaConfig(); - $schemaConfig->setMaxIdentifierLength($this->_platform->getMaxIdentifierLength()); + $schemaConfig->setMaxIdentifierLength($this->platform->getMaxIdentifierLength()); $searchPaths = $this->getSchemaSearchPaths(); if (isset($searchPaths[0])) { $schemaConfig->setName($searchPaths[0]); } - $params = $this->_conn->getParams(); + $params = $this->conn->getParams(); if (isset($params['defaultTableOptions'])) { $schemaConfig->setDefaultTableOptions($params['defaultTableOptions']); } @@ -1065,7 +1065,7 @@ public function createSchemaConfig() */ public function getSchemaSearchPaths() { - return [$this->_conn->getDatabase()]; + return [$this->conn->getDatabase()]; } /** diff --git a/lib/Doctrine/DBAL/Schema/Column.php b/lib/Doctrine/DBAL/Schema/Column.php index 122885bf19f..0331884885f 100644 --- a/lib/Doctrine/DBAL/Schema/Column.php +++ b/lib/Doctrine/DBAL/Schema/Column.php @@ -16,67 +16,67 @@ class Column extends AbstractAsset /** * @var Type */ - protected $_type; + protected $type; /** * @var integer|null */ - protected $_length = null; + protected $length = null; /** * @var integer */ - protected $_precision = 10; + protected $precision = 10; /** * @var integer */ - protected $_scale = 0; + protected $scale = 0; /** * @var boolean */ - protected $_unsigned = false; + protected $unsigned = false; /** * @var boolean */ - protected $_fixed = false; + protected $fixed = false; /** * @var boolean */ - protected $_notnull = true; + protected $notnull = true; /** * @var string|null */ - protected $_default = null; + protected $default = null; /** * @var boolean */ - protected $_autoincrement = false; + protected $autoincrement = false; /** * @var array */ - protected $_platformOptions = []; + protected $platformOptions = []; /** * @var string|null */ - protected $_columnDefinition = null; + protected $columnDefinition = null; /** * @var string|null */ - protected $_comment = null; + protected $comment = null; /** * @var array */ - protected $_customSchemaOptions = []; + protected $customSchemaOptions = []; /** * Creates a new Column. @@ -87,7 +87,7 @@ class Column extends AbstractAsset */ public function __construct($columnName, Type $type, array $options=[]) { - $this->_setName($columnName); + $this->setName($columnName); $this->setType($type); $this->setOptions($options); } @@ -124,7 +124,7 @@ public function setOptions(array $options) */ public function setType(Type $type) { - $this->_type = $type; + $this->type = $type; return $this; } @@ -137,9 +137,9 @@ public function setType(Type $type) public function setLength($length) { if ($length !== null) { - $this->_length = (int) $length; + $this->length = (int) $length; } else { - $this->_length = null; + $this->length = null; } return $this; @@ -156,7 +156,7 @@ public function setPrecision($precision) $precision = 10; // defaults to 10 when no valid precision is given. } - $this->_precision = (int) $precision; + $this->precision = (int) $precision; return $this; } @@ -172,7 +172,7 @@ public function setScale($scale) $scale = 0; } - $this->_scale = (int) $scale; + $this->scale = (int) $scale; return $this; } @@ -184,7 +184,7 @@ public function setScale($scale) */ public function setUnsigned($unsigned) { - $this->_unsigned = (bool) $unsigned; + $this->unsigned = (bool) $unsigned; return $this; } @@ -196,7 +196,7 @@ public function setUnsigned($unsigned) */ public function setFixed($fixed) { - $this->_fixed = (bool) $fixed; + $this->fixed = (bool) $fixed; return $this; } @@ -208,7 +208,7 @@ public function setFixed($fixed) */ public function setNotnull($notnull) { - $this->_notnull = (bool) $notnull; + $this->notnull = (bool) $notnull; return $this; } @@ -220,7 +220,7 @@ public function setNotnull($notnull) */ public function setDefault($default) { - $this->_default = $default; + $this->default = $default; return $this; } @@ -232,7 +232,7 @@ public function setDefault($default) */ public function setPlatformOptions(array $platformOptions) { - $this->_platformOptions = $platformOptions; + $this->platformOptions = $platformOptions; return $this; } @@ -245,7 +245,7 @@ public function setPlatformOptions(array $platformOptions) */ public function setPlatformOption($name, $value) { - $this->_platformOptions[$name] = $value; + $this->platformOptions[$name] = $value; return $this; } @@ -257,7 +257,7 @@ public function setPlatformOption($name, $value) */ public function setColumnDefinition($value) { - $this->_columnDefinition = $value; + $this->columnDefinition = $value; return $this; } @@ -267,7 +267,7 @@ public function setColumnDefinition($value) */ public function getType() { - return $this->_type; + return $this->type; } /** @@ -275,7 +275,7 @@ public function getType() */ public function getLength() { - return $this->_length; + return $this->length; } /** @@ -283,7 +283,7 @@ public function getLength() */ public function getPrecision() { - return $this->_precision; + return $this->precision; } /** @@ -291,7 +291,7 @@ public function getPrecision() */ public function getScale() { - return $this->_scale; + return $this->scale; } /** @@ -299,7 +299,7 @@ public function getScale() */ public function getUnsigned() { - return $this->_unsigned; + return $this->unsigned; } /** @@ -307,7 +307,7 @@ public function getUnsigned() */ public function getFixed() { - return $this->_fixed; + return $this->fixed; } /** @@ -315,7 +315,7 @@ public function getFixed() */ public function getNotnull() { - return $this->_notnull; + return $this->notnull; } /** @@ -323,7 +323,7 @@ public function getNotnull() */ public function getDefault() { - return $this->_default; + return $this->default; } /** @@ -331,7 +331,7 @@ public function getDefault() */ public function getPlatformOptions() { - return $this->_platformOptions; + return $this->platformOptions; } /** @@ -341,7 +341,7 @@ public function getPlatformOptions() */ public function hasPlatformOption($name) { - return isset($this->_platformOptions[$name]); + return isset($this->platformOptions[$name]); } /** @@ -351,7 +351,7 @@ public function hasPlatformOption($name) */ public function getPlatformOption($name) { - return $this->_platformOptions[$name]; + return $this->platformOptions[$name]; } /** @@ -359,7 +359,7 @@ public function getPlatformOption($name) */ public function getColumnDefinition() { - return $this->_columnDefinition; + return $this->columnDefinition; } /** @@ -367,7 +367,7 @@ public function getColumnDefinition() */ public function getAutoincrement() { - return $this->_autoincrement; + return $this->autoincrement; } /** @@ -377,7 +377,7 @@ public function getAutoincrement() */ public function setAutoincrement($flag) { - $this->_autoincrement = $flag; + $this->autoincrement = $flag; return $this; } @@ -389,7 +389,7 @@ public function setAutoincrement($flag) */ public function setComment($comment) { - $this->_comment = $comment; + $this->comment = $comment; return $this; } @@ -399,7 +399,7 @@ public function setComment($comment) */ public function getComment() { - return $this->_comment; + return $this->comment; } /** @@ -410,7 +410,7 @@ public function getComment() */ public function setCustomSchemaOption($name, $value) { - $this->_customSchemaOptions[$name] = $value; + $this->customSchemaOptions[$name] = $value; return $this; } @@ -422,7 +422,7 @@ public function setCustomSchemaOption($name, $value) */ public function hasCustomSchemaOption($name) { - return isset($this->_customSchemaOptions[$name]); + return isset($this->customSchemaOptions[$name]); } /** @@ -432,7 +432,7 @@ public function hasCustomSchemaOption($name) */ public function getCustomSchemaOption($name) { - return $this->_customSchemaOptions[$name]; + return $this->customSchemaOptions[$name]; } /** @@ -442,7 +442,7 @@ public function getCustomSchemaOption($name) */ public function setCustomSchemaOptions(array $customSchemaOptions) { - $this->_customSchemaOptions = $customSchemaOptions; + $this->customSchemaOptions = $customSchemaOptions; return $this; } @@ -452,7 +452,7 @@ public function setCustomSchemaOptions(array $customSchemaOptions) */ public function getCustomSchemaOptions() { - return $this->_customSchemaOptions; + return $this->customSchemaOptions; } /** @@ -461,18 +461,18 @@ public function getCustomSchemaOptions() public function toArray() { return array_merge([ - 'name' => $this->_name, - 'type' => $this->_type, - 'default' => $this->_default, - 'notnull' => $this->_notnull, - 'length' => $this->_length, - 'precision' => $this->_precision, - 'scale' => $this->_scale, - 'fixed' => $this->_fixed, - 'unsigned' => $this->_unsigned, - 'autoincrement' => $this->_autoincrement, - 'columnDefinition' => $this->_columnDefinition, - 'comment' => $this->_comment, - ], $this->_platformOptions, $this->_customSchemaOptions); + 'name' => $this->name, + 'type' => $this->type, + 'default' => $this->default, + 'notnull' => $this->notnull, + 'length' => $this->length, + 'precision' => $this->precision, + 'scale' => $this->scale, + 'fixed' => $this->fixed, + 'unsigned' => $this->unsigned, + 'autoincrement' => $this->autoincrement, + 'columnDefinition' => $this->columnDefinition, + 'comment' => $this->comment, + ], $this->platformOptions, $this->customSchemaOptions); } } diff --git a/lib/Doctrine/DBAL/Schema/DB2SchemaManager.php b/lib/Doctrine/DBAL/Schema/DB2SchemaManager.php index 7d412f10916..f85f1a6cd8b 100644 --- a/lib/Doctrine/DBAL/Schema/DB2SchemaManager.php +++ b/lib/Doctrine/DBAL/Schema/DB2SchemaManager.php @@ -19,18 +19,18 @@ class DB2SchemaManager extends AbstractSchemaManager */ public function listTableNames() { - $sql = $this->_platform->getListTablesSQL(); - $sql .= " AND CREATOR = UPPER('".$this->_conn->getUsername()."')"; + $sql = $this->platform->getListTablesSQL(); + $sql .= " AND CREATOR = UPPER('".$this->conn->getUsername()."')"; - $tables = $this->_conn->fetchAll($sql); + $tables = $this->conn->fetchAll($sql); - return $this->filterAssetNames($this->_getPortableTablesList($tables)); + return $this->filterAssetNames($this->getPortableTablesList($tables)); } /** * {@inheritdoc} */ - protected function _getPortableTableColumnDefinition($tableColumn) + protected function getPortableTableColumnDefinition($tableColumn) { $tableColumn = array_change_key_case($tableColumn, \CASE_LOWER); @@ -46,7 +46,7 @@ protected function _getPortableTableColumnDefinition($tableColumn) $default = trim($tableColumn['default'], "'"); } - $type = $this->_platform->getDoctrineTypeMapping($tableColumn['typename']); + $type = $this->platform->getDoctrineTypeMapping($tableColumn['typename']); if (isset($tableColumn['comment'])) { $type = $this->extractDoctrineTypeFromComment($tableColumn['comment'], $type); @@ -99,7 +99,7 @@ protected function _getPortableTableColumnDefinition($tableColumn) /** * {@inheritdoc} */ - protected function _getPortableTablesList($tables) + protected function getPortableTablesList($tables) { $tableNames = []; foreach ($tables as $tableRow) { @@ -113,20 +113,20 @@ protected function _getPortableTablesList($tables) /** * {@inheritdoc} */ - protected function _getPortableTableIndexesList($tableIndexRows, $tableName = null) + protected function getPortableTableIndexesList($tableIndexRows, $tableName = null) { foreach ($tableIndexRows as &$tableIndexRow) { $tableIndexRow = array_change_key_case($tableIndexRow, \CASE_LOWER); $tableIndexRow['primary'] = (boolean) $tableIndexRow['primary']; } - return parent::_getPortableTableIndexesList($tableIndexRows, $tableName); + return parent::getPortableTableIndexesList($tableIndexRows, $tableName); } /** * {@inheritdoc} */ - protected function _getPortableTableForeignKeyDefinition($tableForeignKey) + protected function getPortableTableForeignKeyDefinition($tableForeignKey) { return new ForeignKeyConstraint( $tableForeignKey['local_columns'], @@ -140,7 +140,7 @@ protected function _getPortableTableForeignKeyDefinition($tableForeignKey) /** * {@inheritdoc} */ - protected function _getPortableTableForeignKeysList($tableForeignKeys) + protected function getPortableTableForeignKeysList($tableForeignKeys) { $foreignKeys = []; @@ -164,13 +164,13 @@ protected function _getPortableTableForeignKeysList($tableForeignKeys) } } - return parent::_getPortableTableForeignKeysList($foreignKeys); + return parent::getPortableTableForeignKeysList($foreignKeys); } /** * {@inheritdoc} */ - protected function _getPortableForeignKeyRuleDef($def) + protected function getPortableForeignKeyRuleDef($def) { if ($def == "C") { return "CASCADE"; @@ -184,7 +184,7 @@ protected function _getPortableForeignKeyRuleDef($def) /** * {@inheritdoc} */ - protected function _getPortableViewDefinition($view) + protected function getPortableViewDefinition($view) { $view = array_change_key_case($view, \CASE_LOWER); // sadly this still segfaults on PDO_IBM, see http://pecl.php.net/bugs/bug.php?id=17199 diff --git a/lib/Doctrine/DBAL/Schema/DrizzleSchemaManager.php b/lib/Doctrine/DBAL/Schema/DrizzleSchemaManager.php index 9196b043380..5e210b2dd3e 100644 --- a/lib/Doctrine/DBAL/Schema/DrizzleSchemaManager.php +++ b/lib/Doctrine/DBAL/Schema/DrizzleSchemaManager.php @@ -14,11 +14,11 @@ class DrizzleSchemaManager extends AbstractSchemaManager /** * {@inheritdoc} */ - protected function _getPortableTableColumnDefinition($tableColumn) + protected function getPortableTableColumnDefinition($tableColumn) { $dbType = strtolower($tableColumn['DATA_TYPE']); - $type = $this->_platform->getDoctrineTypeMapping($dbType); + $type = $this->platform->getDoctrineTypeMapping($dbType); $type = $this->extractDoctrineTypeFromComment($tableColumn['COLUMN_COMMENT'], $type); $tableColumn['COLUMN_COMMENT'] = $this->removeDoctrineTypeFromComment($tableColumn['COLUMN_COMMENT'], $type); @@ -46,7 +46,7 @@ protected function _getPortableTableColumnDefinition($tableColumn) /** * {@inheritdoc} */ - protected function _getPortableDatabaseDefinition($database) + protected function getPortableDatabaseDefinition($database) { return $database['SCHEMA_NAME']; } @@ -54,7 +54,7 @@ protected function _getPortableDatabaseDefinition($database) /** * {@inheritdoc} */ - protected function _getPortableTableDefinition($table) + protected function getPortableTableDefinition($table) { return $table['TABLE_NAME']; } @@ -62,7 +62,7 @@ protected function _getPortableTableDefinition($table) /** * {@inheritdoc} */ - public function _getPortableTableForeignKeyDefinition($tableForeignKey) + public function getPortableTableForeignKeyDefinition($tableForeignKey) { $columns = []; foreach (explode(',', $tableForeignKey['CONSTRAINT_COLUMNS']) as $value) { @@ -89,7 +89,7 @@ public function _getPortableTableForeignKeyDefinition($tableForeignKey) /** * {@inheritdoc} */ - protected function _getPortableTableIndexesList($tableIndexes, $tableName = null) + protected function getPortableTableIndexesList($tableIndexes, $tableName = null) { $indexes = []; foreach ($tableIndexes as $k) { @@ -97,6 +97,6 @@ protected function _getPortableTableIndexesList($tableIndexes, $tableName = null $indexes[] = $k; } - return parent::_getPortableTableIndexesList($indexes, $tableName); + return parent::getPortableTableIndexesList($indexes, $tableName); } } diff --git a/lib/Doctrine/DBAL/Schema/ForeignKeyConstraint.php b/lib/Doctrine/DBAL/Schema/ForeignKeyConstraint.php index ca8adedc19f..65c54bc7361 100644 --- a/lib/Doctrine/DBAL/Schema/ForeignKeyConstraint.php +++ b/lib/Doctrine/DBAL/Schema/ForeignKeyConstraint.php @@ -19,7 +19,7 @@ class ForeignKeyConstraint extends AbstractAsset implements Constraint * * @var \Doctrine\DBAL\Schema\Table */ - protected $_localTable; + protected $localTable; /** * Asset identifier instances of the referencing table column names the foreign key constraint is associated with. @@ -27,14 +27,14 @@ class ForeignKeyConstraint extends AbstractAsset implements Constraint * * @var Identifier[] */ - protected $_localColumnNames; + protected $localColumnNames; /** * Table or asset identifier instance of the referenced table name the foreign key constraint is associated with. * * @var Table|Identifier */ - protected $_foreignTableName; + protected $foreignTableName; /** * Asset identifier instances of the referenced table column names the foreign key constraint is associated with. @@ -42,12 +42,12 @@ class ForeignKeyConstraint extends AbstractAsset implements Constraint * * @var Identifier[] */ - protected $_foreignColumnNames; + protected $foreignColumnNames; /** * @var array Options associated with the foreign key constraint. */ - protected $_options; + protected $options; /** * Initializes the foreign key constraint. @@ -60,24 +60,24 @@ class ForeignKeyConstraint extends AbstractAsset implements Constraint */ public function __construct(array $localColumnNames, $foreignTableName, array $foreignColumnNames, $name = null, array $options = []) { - $this->_setName($name); + $this->setName($name); $identifierConstructorCallback = function ($column) { return new Identifier($column); }; - $this->_localColumnNames = $localColumnNames + $this->localColumnNames = $localColumnNames ? array_combine($localColumnNames, array_map($identifierConstructorCallback, $localColumnNames)) : []; if ($foreignTableName instanceof Table) { - $this->_foreignTableName = $foreignTableName; + $this->foreignTableName = $foreignTableName; } else { - $this->_foreignTableName = new Identifier($foreignTableName); + $this->foreignTableName = new Identifier($foreignTableName); } - $this->_foreignColumnNames = $foreignColumnNames + $this->foreignColumnNames = $foreignColumnNames ? array_combine($foreignColumnNames, array_map($identifierConstructorCallback, $foreignColumnNames)) : []; - $this->_options = $options; + $this->options = $options; } /** @@ -88,7 +88,7 @@ public function __construct(array $localColumnNames, $foreignTableName, array $f */ public function getLocalTableName() { - return $this->_localTable->getName(); + return $this->localTable->getName(); } /** @@ -101,7 +101,7 @@ public function getLocalTableName() */ public function setLocalTable(Table $table) { - $this->_localTable = $table; + $this->localTable = $table; } /** @@ -109,7 +109,7 @@ public function setLocalTable(Table $table) */ public function getLocalTable() { - return $this->_localTable; + return $this->localTable; } /** @@ -120,7 +120,7 @@ public function getLocalTable() */ public function getLocalColumns() { - return array_keys($this->_localColumnNames); + return array_keys($this->localColumnNames); } /** @@ -139,7 +139,7 @@ public function getQuotedLocalColumns(AbstractPlatform $platform) { $columns = []; - foreach ($this->_localColumnNames as $column) { + foreach ($this->localColumnNames as $column) { $columns[] = $column->getQuotedName($platform); } @@ -203,7 +203,7 @@ public function getQuotedColumns(AbstractPlatform $platform) */ public function getForeignTableName() { - return $this->_foreignTableName->getName(); + return $this->foreignTableName->getName(); } /** @@ -213,7 +213,7 @@ public function getForeignTableName() */ public function getUnqualifiedForeignTableName() { - $parts = explode(".", $this->_foreignTableName->getName()); + $parts = explode(".", $this->foreignTableName->getName()); return strtolower(end($parts)); } @@ -232,7 +232,7 @@ public function getUnqualifiedForeignTableName() */ public function getQuotedForeignTableName(AbstractPlatform $platform) { - return $this->_foreignTableName->getQuotedName($platform); + return $this->foreignTableName->getQuotedName($platform); } /** @@ -243,7 +243,7 @@ public function getQuotedForeignTableName(AbstractPlatform $platform) */ public function getForeignColumns() { - return array_keys($this->_foreignColumnNames); + return array_keys($this->foreignColumnNames); } /** @@ -262,7 +262,7 @@ public function getQuotedForeignColumns(AbstractPlatform $platform) { $columns = []; - foreach ($this->_foreignColumnNames as $column) { + foreach ($this->foreignColumnNames as $column) { $columns[] = $column->getQuotedName($platform); } @@ -279,7 +279,7 @@ public function getQuotedForeignColumns(AbstractPlatform $platform) */ public function hasOption($name) { - return isset($this->_options[$name]); + return isset($this->options[$name]); } /** @@ -291,7 +291,7 @@ public function hasOption($name) */ public function getOption($name) { - return $this->_options[$name]; + return $this->options[$name]; } /** @@ -301,7 +301,7 @@ public function getOption($name) */ public function getOptions() { - return $this->_options; + return $this->options; } /** @@ -336,8 +336,8 @@ public function onDelete() */ private function onEvent($event) { - if (isset($this->_options[$event])) { - $onEvent = strtoupper($this->_options[$event]); + if (isset($this->options[$event])) { + $onEvent = strtoupper($this->options[$event]); if ( ! in_array($onEvent, ['NO ACTION', 'RESTRICT'])) { return $onEvent; @@ -360,7 +360,7 @@ private function onEvent($event) public function intersectsIndexColumns(Index $index) { foreach ($index->getColumns() as $indexColumn) { - foreach ($this->_localColumnNames as $localColumn) { + foreach ($this->localColumnNames as $localColumn) { if (strtolower($indexColumn) === strtolower($localColumn->getName())) { return true; } diff --git a/lib/Doctrine/DBAL/Schema/Identifier.php b/lib/Doctrine/DBAL/Schema/Identifier.php index 79686448c0b..f601c7b404b 100644 --- a/lib/Doctrine/DBAL/Schema/Identifier.php +++ b/lib/Doctrine/DBAL/Schema/Identifier.php @@ -22,10 +22,10 @@ class Identifier extends AbstractAsset */ public function __construct($identifier, $quote = false) { - $this->_setName($identifier); + $this->setName($identifier); - if ($quote && ! $this->_quoted) { - $this->_setName('"' . $this->getName() . '"'); + if ($quote && ! $this->quoted) { + $this->setName('"' . $this->getName() . '"'); } } } diff --git a/lib/Doctrine/DBAL/Schema/Index.php b/lib/Doctrine/DBAL/Schema/Index.php index 4164e637bd5..cefbef5a584 100644 --- a/lib/Doctrine/DBAL/Schema/Index.php +++ b/lib/Doctrine/DBAL/Schema/Index.php @@ -12,17 +12,17 @@ class Index extends AbstractAsset implements Constraint * * @var Identifier[] */ - protected $_columns = []; + protected $columns = []; /** * @var boolean */ - protected $_isUnique = false; + protected $isUnique = false; /** * @var boolean */ - protected $_isPrimary = false; + protected $isPrimary = false; /** * Platform specific flags for indexes. @@ -30,12 +30,12 @@ class Index extends AbstractAsset implements Constraint * * @var array */ - protected $_flags = []; + protected $flags = []; /** * Platform specific options * - * @todo $_flags should eventually be refactored into options + * @todo $flags should eventually be refactored into options * * @var array */ @@ -53,14 +53,14 @@ public function __construct($indexName, array $columns, $isUnique = false, $isPr { $isUnique = $isUnique || $isPrimary; - $this->_setName($indexName); + $this->setName($indexName); - $this->_isUnique = $isUnique; - $this->_isPrimary = $isPrimary; + $this->isUnique = $isUnique; + $this->isPrimary = $isPrimary; $this->options = $options; foreach ($columns as $column) { - $this->_addColumn($column); + $this->addColumn($column); } foreach ($flags as $flag) { @@ -75,10 +75,10 @@ public function __construct($indexName, array $columns, $isUnique = false, $isPr * * @throws \InvalidArgumentException */ - protected function _addColumn($column) + protected function addColumn($column) { if (is_string($column)) { - $this->_columns[$column] = new Identifier($column); + $this->columns[$column] = new Identifier($column); } else { throw new \InvalidArgumentException("Expecting a string as Index Column"); } @@ -89,7 +89,7 @@ protected function _addColumn($column) */ public function getColumns() { - return array_keys($this->_columns); + return array_keys($this->columns); } /** @@ -99,7 +99,7 @@ public function getQuotedColumns(AbstractPlatform $platform) { $columns = []; - foreach ($this->_columns as $column) { + foreach ($this->columns as $column) { $columns[] = $column->getQuotedName($platform); } @@ -121,7 +121,7 @@ public function getUnquotedColumns() */ public function isSimpleIndex() { - return !$this->_isPrimary && !$this->_isUnique; + return !$this->isPrimary && !$this->isUnique; } /** @@ -129,7 +129,7 @@ public function isSimpleIndex() */ public function isUnique() { - return $this->_isUnique; + return $this->isUnique; } /** @@ -137,7 +137,7 @@ public function isUnique() */ public function isPrimary() { - return $this->_isPrimary; + return $this->isPrimary; } /** @@ -250,7 +250,7 @@ public function overrules(Index $other) */ public function getFlags() { - return array_keys($this->_flags); + return array_keys($this->flags); } /** @@ -264,7 +264,7 @@ public function getFlags() */ public function addFlag($flag) { - $this->_flags[strtolower($flag)] = true; + $this->flags[strtolower($flag)] = true; return $this; } @@ -278,7 +278,7 @@ public function addFlag($flag) */ public function hasFlag($flag) { - return isset($this->_flags[strtolower($flag)]); + return isset($this->flags[strtolower($flag)]); } /** @@ -290,7 +290,7 @@ public function hasFlag($flag) */ public function removeFlag($flag) { - unset($this->_flags[strtolower($flag)]); + unset($this->flags[strtolower($flag)]); } /** diff --git a/lib/Doctrine/DBAL/Schema/MySqlSchemaManager.php b/lib/Doctrine/DBAL/Schema/MySqlSchemaManager.php index 225d5ef4e33..8d4e3341d66 100644 --- a/lib/Doctrine/DBAL/Schema/MySqlSchemaManager.php +++ b/lib/Doctrine/DBAL/Schema/MySqlSchemaManager.php @@ -20,7 +20,7 @@ class MySqlSchemaManager extends AbstractSchemaManager /** * {@inheritdoc} */ - protected function _getPortableViewDefinition($view) + protected function getPortableViewDefinition($view) { return new View($view['TABLE_NAME'], $view['VIEW_DEFINITION']); } @@ -28,7 +28,7 @@ protected function _getPortableViewDefinition($view) /** * {@inheritdoc} */ - protected function _getPortableTableDefinition($table) + protected function getPortableTableDefinition($table) { return array_shift($table); } @@ -36,7 +36,7 @@ protected function _getPortableTableDefinition($table) /** * {@inheritdoc} */ - protected function _getPortableUserDefinition($user) + protected function getPortableUserDefinition($user) { return [ 'user' => $user['User'], @@ -47,7 +47,7 @@ protected function _getPortableUserDefinition($user) /** * {@inheritdoc} */ - protected function _getPortableTableIndexesList($tableIndexes, $tableName = null) + protected function getPortableTableIndexesList($tableIndexes, $tableName = null) { foreach ($tableIndexes as $k => $v) { $v = array_change_key_case($v, CASE_LOWER); @@ -64,13 +64,13 @@ protected function _getPortableTableIndexesList($tableIndexes, $tableName = null $tableIndexes[$k] = $v; } - return parent::_getPortableTableIndexesList($tableIndexes, $tableName); + return parent::getPortableTableIndexesList($tableIndexes, $tableName); } /** * {@inheritdoc} */ - protected function _getPortableSequenceDefinition($sequence) + protected function getPortableSequenceDefinition($sequence) { return end($sequence); } @@ -78,7 +78,7 @@ protected function _getPortableSequenceDefinition($sequence) /** * {@inheritdoc} */ - protected function _getPortableDatabaseDefinition($database) + protected function getPortableDatabaseDefinition($database) { return $database['Database']; } @@ -86,7 +86,7 @@ protected function _getPortableDatabaseDefinition($database) /** * {@inheritdoc} */ - protected function _getPortableTableColumnDefinition($tableColumn) + protected function getPortableTableColumnDefinition($tableColumn) { $tableColumn = array_change_key_case($tableColumn, CASE_LOWER); @@ -103,7 +103,7 @@ protected function _getPortableTableColumnDefinition($tableColumn) $scale = null; $precision = null; - $type = $this->_platform->getDoctrineTypeMapping($dbType); + $type = $this->platform->getDoctrineTypeMapping($dbType); // In cases where not connected to a database DESCRIBE $table does not return 'Comment' if (isset($tableColumn['comment'])) { @@ -156,8 +156,8 @@ protected function _getPortableTableColumnDefinition($tableColumn) break; } - if ($this->_platform instanceof MariaDb1027Platform) { - $columnDefault = $this->getMariaDb1027ColumnDefault($this->_platform, $tableColumn['default']); + if ($this->platform instanceof MariaDb1027Platform) { + $columnDefault = $this->getMariaDb1027ColumnDefault($this->platform, $tableColumn['default']); } else { $columnDefault = $tableColumn['default']; } @@ -232,7 +232,7 @@ private function getMariaDb1027ColumnDefault(MariaDb1027Platform $platform, ?str /** * {@inheritdoc} */ - protected function _getPortableTableForeignKeysList($tableForeignKeys) + protected function getPortableTableForeignKeysList($tableForeignKeys) { $list = []; foreach ($tableForeignKeys as $value) { diff --git a/lib/Doctrine/DBAL/Schema/OracleSchemaManager.php b/lib/Doctrine/DBAL/Schema/OracleSchemaManager.php index 6d74baecb9f..f3ae05deccd 100644 --- a/lib/Doctrine/DBAL/Schema/OracleSchemaManager.php +++ b/lib/Doctrine/DBAL/Schema/OracleSchemaManager.php @@ -47,7 +47,7 @@ public function dropDatabase($database) /** * {@inheritdoc} */ - protected function _getPortableViewDefinition($view) + protected function getPortableViewDefinition($view) { $view = \array_change_key_case($view, CASE_LOWER); @@ -57,7 +57,7 @@ protected function _getPortableViewDefinition($view) /** * {@inheritdoc} */ - protected function _getPortableUserDefinition($user) + protected function getPortableUserDefinition($user) { $user = \array_change_key_case($user, CASE_LOWER); @@ -69,7 +69,7 @@ protected function _getPortableUserDefinition($user) /** * {@inheritdoc} */ - protected function _getPortableTableDefinition($table) + protected function getPortableTableDefinition($table) { $table = \array_change_key_case($table, CASE_LOWER); @@ -82,7 +82,7 @@ protected function _getPortableTableDefinition($table) * @license New BSD License * @link http://ezcomponents.org/docs/api/trunk/DatabaseSchema/ezcDbSchemaPgsqlReader.html */ - protected function _getPortableTableIndexesList($tableIndexes, $tableName=null) + protected function getPortableTableIndexesList($tableIndexes, $tableName=null) { $indexBuffer = []; foreach ($tableIndexes as $tableIndex) { @@ -103,13 +103,13 @@ protected function _getPortableTableIndexesList($tableIndexes, $tableName=null) $indexBuffer[] = $buffer; } - return parent::_getPortableTableIndexesList($indexBuffer, $tableName); + return parent::getPortableTableIndexesList($indexBuffer, $tableName); } /** * {@inheritdoc} */ - protected function _getPortableTableColumnDefinition($tableColumn) + protected function getPortableTableColumnDefinition($tableColumn) { $tableColumn = \array_change_key_case($tableColumn, CASE_LOWER); @@ -143,7 +143,7 @@ protected function _getPortableTableColumnDefinition($tableColumn) $precision = null; $scale = null; - $type = $this->_platform->getDoctrineTypeMapping($dbType); + $type = $this->platform->getDoctrineTypeMapping($dbType); $type = $this->extractDoctrineTypeFromComment($tableColumn['comments'], $type); $tableColumn['comments'] = $this->removeDoctrineTypeFromComment($tableColumn['comments'], $type); @@ -229,7 +229,7 @@ protected function _getPortableTableColumnDefinition($tableColumn) /** * {@inheritdoc} */ - protected function _getPortableTableForeignKeysList($tableForeignKeys) + protected function getPortableTableForeignKeysList($tableForeignKeys) { $list = []; foreach ($tableForeignKeys as $value) { @@ -270,7 +270,7 @@ protected function _getPortableTableForeignKeysList($tableForeignKeys) /** * {@inheritdoc} */ - protected function _getPortableSequenceDefinition($sequence) + protected function getPortableSequenceDefinition($sequence) { $sequence = \array_change_key_case($sequence, CASE_LOWER); @@ -284,7 +284,7 @@ protected function _getPortableSequenceDefinition($sequence) /** * {@inheritdoc} */ - protected function _getPortableFunctionDefinition($function) + protected function getPortableFunctionDefinition($function) { $function = \array_change_key_case($function, CASE_LOWER); @@ -294,7 +294,7 @@ protected function _getPortableFunctionDefinition($function) /** * {@inheritdoc} */ - protected function _getPortableDatabaseDefinition($database) + protected function getPortableDatabaseDefinition($database) { $database = \array_change_key_case($database, CASE_LOWER); @@ -307,18 +307,18 @@ protected function _getPortableDatabaseDefinition($database) public function createDatabase($database = null) { if (is_null($database)) { - $database = $this->_conn->getDatabase(); + $database = $this->conn->getDatabase(); } - $params = $this->_conn->getParams(); + $params = $this->conn->getParams(); $username = $database; $password = $params['password']; $query = 'CREATE USER ' . $username . ' IDENTIFIED BY ' . $password; - $this->_conn->executeUpdate($query); + $this->conn->executeUpdate($query); $query = 'GRANT DBA TO ' . $username; - $this->_conn->executeUpdate($query); + $this->conn->executeUpdate($query); return true; } @@ -330,9 +330,9 @@ public function createDatabase($database = null) */ public function dropAutoincrement($table) { - $sql = $this->_platform->getDropAutoincrementSql($table); + $sql = $this->platform->getDropAutoincrementSql($table); foreach ($sql as $query) { - $this->_conn->executeUpdate($query); + $this->conn->executeUpdate($query); } return true; @@ -361,7 +361,7 @@ public function dropTable($name) private function getQuotedIdentifierName($identifier) { if (preg_match('/[a-z]/', $identifier)) { - return $this->_platform->quoteIdentifier($identifier); + return $this->platform->quoteIdentifier($identifier); } return $identifier; @@ -390,12 +390,12 @@ private function killUserSessions($user) AND p.addr(+) = s.paddr SQL; - $activeUserSessions = $this->_conn->fetchAll($sql, [strtoupper($user)]); + $activeUserSessions = $this->conn->fetchAll($sql, [strtoupper($user)]); foreach ($activeUserSessions as $activeUserSession) { $activeUserSession = array_change_key_case($activeUserSession, \CASE_LOWER); - $this->_execSql( + $this->execSql( sprintf( "ALTER SYSTEM KILL SESSION '%s, %s' IMMEDIATE", $activeUserSession['sid'], diff --git a/lib/Doctrine/DBAL/Schema/PostgreSqlSchemaManager.php b/lib/Doctrine/DBAL/Schema/PostgreSqlSchemaManager.php index 3696d806263..30d1f18d84f 100644 --- a/lib/Doctrine/DBAL/Schema/PostgreSqlSchemaManager.php +++ b/lib/Doctrine/DBAL/Schema/PostgreSqlSchemaManager.php @@ -27,7 +27,7 @@ class PostgreSqlSchemaManager extends AbstractSchemaManager */ public function getSchemaNames() { - $rows = $this->_conn->fetchAll("SELECT nspname as schema_name FROM pg_namespace WHERE nspname !~ '^pg_.*' and nspname != 'information_schema'"); + $rows = $this->conn->fetchAll("SELECT nspname as schema_name FROM pg_namespace WHERE nspname !~ '^pg_.*' and nspname != 'information_schema'"); return array_map(function ($v) { return $v['schema_name']; }, $rows); } @@ -41,8 +41,8 @@ public function getSchemaNames() */ public function getSchemaSearchPaths() { - $params = $this->_conn->getParams(); - $schema = explode(",", $this->_conn->fetchColumn('SHOW search_path')); + $params = $this->conn->getParams(); + $schema = explode(",", $this->conn->fetchColumn('SHOW search_path')); if (isset($params['user'])) { $schema = str_replace('"$user"', $params['user'], $schema); @@ -100,10 +100,10 @@ public function dropDatabase($database) throw $exception; } - $this->_execSql( + $this->execSql( [ - $this->_platform->getDisallowDatabaseConnectionsSQL($database), - $this->_platform->getCloseActiveDatabaseConnectionsSQL($database), + $this->platform->getDisallowDatabaseConnectionsSQL($database), + $this->platform->getCloseActiveDatabaseConnectionsSQL($database), ] ); @@ -114,7 +114,7 @@ public function dropDatabase($database) /** * {@inheritdoc} */ - protected function _getPortableTableForeignKeyDefinition($tableForeignKey) + protected function getPortableTableForeignKeyDefinition($tableForeignKey) { $onUpdate = null; $onDelete = null; @@ -143,7 +143,7 @@ protected function _getPortableTableForeignKeyDefinition($tableForeignKey) /** * {@inheritdoc} */ - protected function _getPortableTriggerDefinition($trigger) + protected function getPortableTriggerDefinition($trigger) { return $trigger['trigger_name']; } @@ -151,7 +151,7 @@ protected function _getPortableTriggerDefinition($trigger) /** * {@inheritdoc} */ - protected function _getPortableViewDefinition($view) + protected function getPortableViewDefinition($view) { return new View($view['schemaname'].'.'.$view['viewname'], $view['definition']); } @@ -159,7 +159,7 @@ protected function _getPortableViewDefinition($view) /** * {@inheritdoc} */ - protected function _getPortableUserDefinition($user) + protected function getPortableUserDefinition($user) { return [ 'user' => $user['usename'], @@ -170,7 +170,7 @@ protected function _getPortableUserDefinition($user) /** * {@inheritdoc} */ - protected function _getPortableTableDefinition($table) + protected function getPortableTableDefinition($table) { $schemas = $this->getExistingSchemaSearchPaths(); $firstSchema = array_shift($schemas); @@ -188,7 +188,7 @@ protected function _getPortableTableDefinition($table) * @license New BSD License * @link http://ezcomponents.org/docs/api/trunk/DatabaseSchema/ezcDbSchemaPgsqlReader.html */ - protected function _getPortableTableIndexesList($tableIndexes, $tableName=null) + protected function getPortableTableIndexesList($tableIndexes, $tableName=null) { $buffer = []; foreach ($tableIndexes as $row) { @@ -197,7 +197,7 @@ protected function _getPortableTableIndexesList($tableIndexes, $tableName=null) $columnNameSql = "SELECT attnum, attname FROM pg_attribute WHERE attrelid={$row['indrelid']} AND attnum $colNumbersSql ORDER BY attnum ASC;"; - $stmt = $this->_conn->executeQuery($columnNameSql); + $stmt = $this->conn->executeQuery($columnNameSql); $indexColumns = $stmt->fetchAll(); // required for getting the order of the columns right. @@ -216,13 +216,13 @@ protected function _getPortableTableIndexesList($tableIndexes, $tableName=null) } } - return parent::_getPortableTableIndexesList($buffer, $tableName); + return parent::getPortableTableIndexesList($buffer, $tableName); } /** * {@inheritdoc} */ - protected function _getPortableDatabaseDefinition($database) + protected function getPortableDatabaseDefinition($database) { return $database['datname']; } @@ -230,7 +230,7 @@ protected function _getPortableDatabaseDefinition($database) /** * {@inheritdoc} */ - protected function _getPortableSequencesList($sequences) + protected function getPortableSequencesList($sequences) { $sequenceDefinitions = []; @@ -247,7 +247,7 @@ protected function _getPortableSequencesList($sequences) $list = []; foreach ($this->filterAssetNames(array_keys($sequenceDefinitions)) as $sequenceName) { - $list[] = $this->_getPortableSequenceDefinition($sequenceDefinitions[$sequenceName]); + $list[] = $this->getPortableSequenceDefinition($sequenceDefinitions[$sequenceName]); } return $list; @@ -264,7 +264,7 @@ protected function getPortableNamespaceDefinition(array $namespace) /** * {@inheritdoc} */ - protected function _getPortableSequenceDefinition($sequence) + protected function getPortableSequenceDefinition($sequence) { if ($sequence['schemaname'] !== 'public') { $sequenceName = $sequence['schemaname'] . "." . $sequence['relname']; @@ -273,7 +273,7 @@ protected function _getPortableSequenceDefinition($sequence) } if ( ! isset($sequence['increment_by'], $sequence['min_value'])) { - $data = $this->_conn->fetchAssoc('SELECT min_value, increment_by FROM ' . $this->_platform->quoteIdentifier($sequenceName)); + $data = $this->conn->fetchAssoc('SELECT min_value, increment_by FROM ' . $this->platform->quoteIdentifier($sequenceName)); $sequence += $data; } @@ -283,7 +283,7 @@ protected function _getPortableSequenceDefinition($sequence) /** * {@inheritdoc} */ - protected function _getPortableTableColumnDefinition($tableColumn) + protected function getPortableTableColumnDefinition($tableColumn) { $tableColumn = array_change_key_case($tableColumn, CASE_LOWER); @@ -328,12 +328,12 @@ protected function _getPortableTableColumnDefinition($tableColumn) $jsonb = null; $dbType = strtolower($tableColumn['type']); - if (strlen($tableColumn['domain_type']) && !$this->_platform->hasDoctrineTypeMappingFor($tableColumn['type'])) { + if (strlen($tableColumn['domain_type']) && !$this->platform->hasDoctrineTypeMappingFor($tableColumn['type'])) { $dbType = strtolower($tableColumn['domain_type']); $tableColumn['complete_type'] = $tableColumn['domain_complete_type']; } - $type = $this->_platform->getDoctrineTypeMapping($dbType); + $type = $this->platform->getDoctrineTypeMapping($dbType); $type = $this->extractDoctrineTypeFromComment($tableColumn['comment'], $type); $tableColumn['comment'] = $this->removeDoctrineTypeFromComment($tableColumn['comment'], $type); diff --git a/lib/Doctrine/DBAL/Schema/SQLAnywhereSchemaManager.php b/lib/Doctrine/DBAL/Schema/SQLAnywhereSchemaManager.php index 5a9b2bf3a5a..6d3052d9199 100644 --- a/lib/Doctrine/DBAL/Schema/SQLAnywhereSchemaManager.php +++ b/lib/Doctrine/DBAL/Schema/SQLAnywhereSchemaManager.php @@ -50,7 +50,7 @@ public function dropDatabase($database) */ public function startDatabase($database) { - $this->_execSql($this->_platform->getStartDatabaseSQL($database)); + $this->execSql($this->platform->getStartDatabaseSQL($database)); } /** @@ -60,13 +60,13 @@ public function startDatabase($database) */ public function stopDatabase($database) { - $this->_execSql($this->_platform->getStopDatabaseSQL($database)); + $this->execSql($this->platform->getStopDatabaseSQL($database)); } /** * {@inheritdoc} */ - protected function _getPortableDatabaseDefinition($database) + protected function getPortableDatabaseDefinition($database) { return $database['name']; } @@ -74,7 +74,7 @@ protected function _getPortableDatabaseDefinition($database) /** * {@inheritdoc} */ - protected function _getPortableSequenceDefinition($sequence) + protected function getPortableSequenceDefinition($sequence) { return new Sequence($sequence['sequence_name'], $sequence['increment_by'], $sequence['start_with']); } @@ -82,9 +82,9 @@ protected function _getPortableSequenceDefinition($sequence) /** * {@inheritdoc} */ - protected function _getPortableTableColumnDefinition($tableColumn) + protected function getPortableTableColumnDefinition($tableColumn) { - $type = $this->_platform->getDoctrineTypeMapping($tableColumn['type']); + $type = $this->platform->getDoctrineTypeMapping($tableColumn['type']); $type = $this->extractDoctrineTypeFromComment($tableColumn['comment'], $type); $tableColumn['comment'] = $this->removeDoctrineTypeFromComment($tableColumn['comment'], $type); $precision = null; @@ -137,7 +137,7 @@ protected function _getPortableTableColumnDefinition($tableColumn) /** * {@inheritdoc} */ - protected function _getPortableTableDefinition($table) + protected function getPortableTableDefinition($table) { return $table['table_name']; } @@ -145,7 +145,7 @@ protected function _getPortableTableDefinition($table) /** * {@inheritdoc} */ - protected function _getPortableTableForeignKeyDefinition($tableForeignKey) + protected function getPortableTableForeignKeyDefinition($tableForeignKey) { return new ForeignKeyConstraint( $tableForeignKey['local_columns'], @@ -159,7 +159,7 @@ protected function _getPortableTableForeignKeyDefinition($tableForeignKey) /** * {@inheritdoc} */ - protected function _getPortableTableForeignKeysList($tableForeignKeys) + protected function getPortableTableForeignKeysList($tableForeignKeys) { $foreignKeys = []; @@ -186,13 +186,13 @@ protected function _getPortableTableForeignKeysList($tableForeignKeys) } } - return parent::_getPortableTableForeignKeysList($foreignKeys); + return parent::getPortableTableForeignKeysList($foreignKeys); } /** * {@inheritdoc} */ - protected function _getPortableTableIndexesList($tableIndexRows, $tableName = null) + protected function getPortableTableIndexesList($tableIndexRows, $tableName = null) { foreach ($tableIndexRows as &$tableIndex) { $tableIndex['primary'] = (boolean) $tableIndex['primary']; @@ -211,13 +211,13 @@ protected function _getPortableTableIndexesList($tableIndexRows, $tableName = nu } } - return parent::_getPortableTableIndexesList($tableIndexRows, $tableName); + return parent::getPortableTableIndexesList($tableIndexRows, $tableName); } /** * {@inheritdoc} */ - protected function _getPortableViewDefinition($view) + protected function getPortableViewDefinition($view) { return new View( $view['table_name'], diff --git a/lib/Doctrine/DBAL/Schema/SQLServerSchemaManager.php b/lib/Doctrine/DBAL/Schema/SQLServerSchemaManager.php index 0ce119c7cc1..dc2396430b9 100644 --- a/lib/Doctrine/DBAL/Schema/SQLServerSchemaManager.php +++ b/lib/Doctrine/DBAL/Schema/SQLServerSchemaManager.php @@ -49,7 +49,7 @@ public function dropDatabase($database) /** * {@inheritdoc} */ - protected function _getPortableSequenceDefinition($sequence) + protected function getPortableSequenceDefinition($sequence) { return new Sequence($sequence['name'], $sequence['increment'], $sequence['start_value']); } @@ -57,7 +57,7 @@ protected function _getPortableSequenceDefinition($sequence) /** * {@inheritdoc} */ - protected function _getPortableTableColumnDefinition($tableColumn) + protected function getPortableTableColumnDefinition($tableColumn) { $dbType = strtok($tableColumn['type'], '(), '); $fixed = null; @@ -72,7 +72,7 @@ protected function _getPortableTableColumnDefinition($tableColumn) $default = trim($default2, "'"); if ($default == 'getdate()') { - $default = $this->_platform->getCurrentTimestampSQL(); + $default = $this->platform->getCurrentTimestampSQL(); } } @@ -95,7 +95,7 @@ protected function _getPortableTableColumnDefinition($tableColumn) $fixed = true; } - $type = $this->_platform->getDoctrineTypeMapping($dbType); + $type = $this->platform->getDoctrineTypeMapping($dbType); $type = $this->extractDoctrineTypeFromComment($tableColumn['comment'], $type); $tableColumn['comment'] = $this->removeDoctrineTypeFromComment($tableColumn['comment'], $type); @@ -123,7 +123,7 @@ protected function _getPortableTableColumnDefinition($tableColumn) /** * {@inheritdoc} */ - protected function _getPortableTableForeignKeysList($tableForeignKeys) + protected function getPortableTableForeignKeysList($tableForeignKeys) { $foreignKeys = []; @@ -145,13 +145,13 @@ protected function _getPortableTableForeignKeysList($tableForeignKeys) } } - return parent::_getPortableTableForeignKeysList($foreignKeys); + return parent::getPortableTableForeignKeysList($foreignKeys); } /** * {@inheritdoc} */ - protected function _getPortableTableIndexesList($tableIndexRows, $tableName=null) + protected function getPortableTableIndexesList($tableIndexRows, $tableName=null) { foreach ($tableIndexRows as &$tableIndex) { $tableIndex['non_unique'] = (boolean) $tableIndex['non_unique']; @@ -159,13 +159,13 @@ protected function _getPortableTableIndexesList($tableIndexRows, $tableName=null $tableIndex['flags'] = $tableIndex['flags'] ? [$tableIndex['flags']] : null; } - return parent::_getPortableTableIndexesList($tableIndexRows, $tableName); + return parent::getPortableTableIndexesList($tableIndexRows, $tableName); } /** * {@inheritdoc} */ - protected function _getPortableTableForeignKeyDefinition($tableForeignKey) + protected function getPortableTableForeignKeyDefinition($tableForeignKey) { return new ForeignKeyConstraint( $tableForeignKey['local_columns'], @@ -179,7 +179,7 @@ protected function _getPortableTableForeignKeyDefinition($tableForeignKey) /** * {@inheritdoc} */ - protected function _getPortableTableDefinition($table) + protected function getPortableTableDefinition($table) { return $table['name']; } @@ -187,7 +187,7 @@ protected function _getPortableTableDefinition($table) /** * {@inheritdoc} */ - protected function _getPortableDatabaseDefinition($database) + protected function getPortableDatabaseDefinition($database) { return $database['name']; } @@ -203,7 +203,7 @@ protected function getPortableNamespaceDefinition(array $namespace) /** * {@inheritdoc} */ - protected function _getPortableViewDefinition($view) + protected function getPortableViewDefinition($view) { // @todo return new View($view['name'], null); @@ -214,10 +214,10 @@ protected function _getPortableViewDefinition($view) */ public function listTableIndexes($table) { - $sql = $this->_platform->getListTableIndexesSQL($table, $this->_conn->getDatabase()); + $sql = $this->platform->getListTableIndexesSQL($table, $this->conn->getDatabase()); try { - $tableIndexes = $this->_conn->fetchAll($sql); + $tableIndexes = $this->conn->fetchAll($sql); } catch (\PDOException $e) { if ($e->getCode() == "IMSSP") { return []; @@ -232,7 +232,7 @@ public function listTableIndexes($table) } } - return $this->_getPortableTableIndexesList($tableIndexes, $table); + return $this->getPortableTableIndexesList($tableIndexes, $table); } /** @@ -243,8 +243,8 @@ public function alterTable(TableDiff $tableDiff) if (count($tableDiff->removedColumns) > 0) { foreach ($tableDiff->removedColumns as $col) { $columnConstraintSql = $this->getColumnConstraintSQL($tableDiff->name, $col->getName()); - foreach ($this->_conn->fetchAll($columnConstraintSql) as $constraint) { - $this->_conn->exec("ALTER TABLE $tableDiff->name DROP CONSTRAINT " . $constraint['Name']); + foreach ($this->conn->fetchAll($columnConstraintSql) as $constraint) { + $this->conn->exec("ALTER TABLE $tableDiff->name DROP CONSTRAINT " . $constraint['Name']); } } } @@ -267,7 +267,7 @@ private function getColumnConstraintSQL($table, $column) ON Tab.[ID] = Sysobjects.[Parent_Obj] INNER JOIN sys.default_constraints DefCons ON DefCons.[object_id] = Sysobjects.[ID] INNER JOIN SysColumns Col ON Col.[ColID] = DefCons.[parent_column_id] AND Col.[ID] = Tab.[ID] - WHERE Col.[Name] = " . $this->_conn->quote($column) ." AND Tab.[Name] = " . $this->_conn->quote($table) . " + WHERE Col.[Name] = " . $this->conn->quote($column) ." AND Tab.[Name] = " . $this->conn->quote($table) . " ORDER BY Col.[Name]"; } @@ -284,10 +284,10 @@ private function closeActiveDatabaseConnections($database) { $database = new Identifier($database); - $this->_execSql( + $this->execSql( sprintf( 'ALTER DATABASE %s SET SINGLE_USER WITH ROLLBACK IMMEDIATE', - $database->getQuotedName($this->_platform) + $database->getQuotedName($this->platform) ) ); } diff --git a/lib/Doctrine/DBAL/Schema/Schema.php b/lib/Doctrine/DBAL/Schema/Schema.php index 4f31388c207..c360a4dc4c4 100644 --- a/lib/Doctrine/DBAL/Schema/Schema.php +++ b/lib/Doctrine/DBAL/Schema/Schema.php @@ -48,17 +48,17 @@ class Schema extends AbstractAsset /** * @var \Doctrine\DBAL\Schema\Table[] */ - protected $_tables = []; + protected $tables = []; /** * @var \Doctrine\DBAL\Schema\Sequence[] */ - protected $_sequences = []; + protected $sequences = []; /** * @var \Doctrine\DBAL\Schema\SchemaConfig */ - protected $_schemaConfig = false; + protected $schemaConfig = false; /** * @param \Doctrine\DBAL\Schema\Table[] $tables @@ -75,19 +75,19 @@ public function __construct( if ($schemaConfig == null) { $schemaConfig = new SchemaConfig(); } - $this->_schemaConfig = $schemaConfig; - $this->_setName($schemaConfig->getName() ?: 'public'); + $this->schemaConfig = $schemaConfig; + $this->setName($schemaConfig->getName() ?: 'public'); foreach ($namespaces as $namespace) { $this->createNamespace($namespace); } foreach ($tables as $table) { - $this->_addTable($table); + $this->addTable($table); } foreach ($sequences as $sequence) { - $this->_addSequence($sequence); + $this->addSequence($sequence); } } @@ -96,7 +96,7 @@ public function __construct( */ public function hasExplicitForeignKeyIndexes() { - return $this->_schemaConfig->hasExplicitForeignKeyIndexes(); + return $this->schemaConfig->hasExplicitForeignKeyIndexes(); } /** @@ -106,12 +106,12 @@ public function hasExplicitForeignKeyIndexes() * * @throws \Doctrine\DBAL\Schema\SchemaException */ - protected function _addTable(Table $table) + protected function addTable(Table $table) { $namespaceName = $table->getNamespaceName(); $tableName = $table->getFullQualifiedName($this->getName()); - if (isset($this->_tables[$tableName])) { + if (isset($this->tables[$tableName])) { throw SchemaException::tableAlreadyExists($tableName); } @@ -119,8 +119,8 @@ protected function _addTable(Table $table) $this->createNamespace($namespaceName); } - $this->_tables[$tableName] = $table; - $table->setSchemaConfig($this->_schemaConfig); + $this->tables[$tableName] = $table; + $table->setSchemaConfig($this->schemaConfig); } /** @@ -130,12 +130,12 @@ protected function _addTable(Table $table) * * @throws \Doctrine\DBAL\Schema\SchemaException */ - protected function _addSequence(Sequence $sequence) + protected function addSequence(Sequence $sequence) { $namespaceName = $sequence->getNamespaceName(); $seqName = $sequence->getFullQualifiedName($this->getName()); - if (isset($this->_sequences[$seqName])) { + if (isset($this->sequences[$seqName])) { throw SchemaException::sequenceAlreadyExists($seqName); } @@ -143,7 +143,7 @@ protected function _addSequence(Sequence $sequence) $this->createNamespace($namespaceName); } - $this->_sequences[$seqName] = $sequence; + $this->sequences[$seqName] = $sequence; } /** @@ -163,7 +163,7 @@ public function getNamespaces() */ public function getTables() { - return $this->_tables; + return $this->tables; } /** @@ -176,11 +176,11 @@ public function getTables() public function getTable($tableName) { $tableName = $this->getFullQualifiedAssetName($tableName); - if (!isset($this->_tables[$tableName])) { + if (!isset($this->tables[$tableName])) { throw SchemaException::tableDoesNotExist($tableName); } - return $this->_tables[$tableName]; + return $this->tables[$tableName]; } /** @@ -240,7 +240,7 @@ public function hasTable($tableName) { $tableName = $this->getFullQualifiedAssetName($tableName); - return isset($this->_tables[$tableName]); + return isset($this->tables[$tableName]); } /** @@ -250,7 +250,7 @@ public function hasTable($tableName) */ public function getTableNames() { - return array_keys($this->_tables); + return array_keys($this->tables); } /** @@ -262,7 +262,7 @@ public function hasSequence($sequenceName) { $sequenceName = $this->getFullQualifiedAssetName($sequenceName); - return isset($this->_sequences[$sequenceName]); + return isset($this->sequences[$sequenceName]); } /** @@ -279,7 +279,7 @@ public function getSequence($sequenceName) throw SchemaException::sequenceDoesNotExist($sequenceName); } - return $this->_sequences[$sequenceName]; + return $this->sequences[$sequenceName]; } /** @@ -287,7 +287,7 @@ public function getSequence($sequenceName) */ public function getSequences() { - return $this->_sequences; + return $this->sequences; } /** @@ -322,9 +322,9 @@ public function createNamespace($namespaceName) public function createTable($tableName) { $table = new Table($tableName); - $this->_addTable($table); + $this->addTable($table); - foreach ($this->_schemaConfig->getDefaultTableOptions() as $name => $value) { + foreach ($this->schemaConfig->getDefaultTableOptions() as $name => $value) { $table->addOption($name, $value); } @@ -342,10 +342,10 @@ public function createTable($tableName) public function renameTable($oldTableName, $newTableName) { $table = $this->getTable($oldTableName); - $table->_setName($newTableName); + $table->setName($newTableName); $this->dropTable($oldTableName); - $this->_addTable($table); + $this->addTable($table); return $this; } @@ -361,7 +361,7 @@ public function dropTable($tableName) { $tableName = $this->getFullQualifiedAssetName($tableName); $this->getTable($tableName); - unset($this->_tables[$tableName]); + unset($this->tables[$tableName]); return $this; } @@ -378,7 +378,7 @@ public function dropTable($tableName) public function createSequence($sequenceName, $allocationSize=1, $initialValue=1) { $seq = new Sequence($sequenceName, $allocationSize, $initialValue); - $this->_addSequence($seq); + $this->addSequence($seq); return $seq; } @@ -391,7 +391,7 @@ public function createSequence($sequenceName, $allocationSize=1, $initialValue=1 public function dropSequence($sequenceName) { $sequenceName = $this->getFullQualifiedAssetName($sequenceName); - unset($this->_sequences[$sequenceName]); + unset($this->sequences[$sequenceName]); return $this; } @@ -469,11 +469,11 @@ public function visit(Visitor $visitor) } } - foreach ($this->_tables as $table) { + foreach ($this->tables as $table) { $table->visit($visitor); } - foreach ($this->_sequences as $sequence) { + foreach ($this->sequences as $sequence) { $sequence->visit($visitor); } } @@ -485,11 +485,11 @@ public function visit(Visitor $visitor) */ public function __clone() { - foreach ($this->_tables as $k => $table) { - $this->_tables[$k] = clone $table; + foreach ($this->tables as $k => $table) { + $this->tables[$k] = clone $table; } - foreach ($this->_sequences as $k => $sequence) { - $this->_sequences[$k] = clone $sequence; + foreach ($this->sequences as $k => $sequence) { + $this->sequences[$k] = clone $sequence; } } } diff --git a/lib/Doctrine/DBAL/Schema/SchemaDiff.php b/lib/Doctrine/DBAL/Schema/SchemaDiff.php index df709f12413..5c2d7bab626 100644 --- a/lib/Doctrine/DBAL/Schema/SchemaDiff.php +++ b/lib/Doctrine/DBAL/Schema/SchemaDiff.php @@ -106,7 +106,7 @@ public function __construct($newTables = [], $changedTables = [], $removedTables */ public function toSaveSql(AbstractPlatform $platform) { - return $this->_toSql($platform, true); + return $this->buildSql($platform, true); } /** @@ -116,7 +116,7 @@ public function toSaveSql(AbstractPlatform $platform) */ public function toSql(AbstractPlatform $platform) { - return $this->_toSql($platform, false); + return $this->buildSql($platform, false); } /** @@ -125,7 +125,7 @@ public function toSql(AbstractPlatform $platform) * * @return array */ - protected function _toSql(AbstractPlatform $platform, $saveMode = false) + protected function buildSql(AbstractPlatform $platform, $saveMode = false) { $sql = []; diff --git a/lib/Doctrine/DBAL/Schema/Sequence.php b/lib/Doctrine/DBAL/Schema/Sequence.php index 298af527b52..73cd6b45148 100644 --- a/lib/Doctrine/DBAL/Schema/Sequence.php +++ b/lib/Doctrine/DBAL/Schema/Sequence.php @@ -36,7 +36,7 @@ class Sequence extends AbstractAsset */ public function __construct($name, $allocationSize = 1, $initialValue = 1, $cache = null) { - $this->_setName($name); + $this->setName($name); $this->allocationSize = is_numeric($allocationSize) ? $allocationSize : 1; $this->initialValue = is_numeric($initialValue) ? $initialValue : 1; $this->cache = $cache; diff --git a/lib/Doctrine/DBAL/Schema/SqliteSchemaManager.php b/lib/Doctrine/DBAL/Schema/SqliteSchemaManager.php index 7df1d1f0e7f..77d0cd94902 100644 --- a/lib/Doctrine/DBAL/Schema/SqliteSchemaManager.php +++ b/lib/Doctrine/DBAL/Schema/SqliteSchemaManager.php @@ -34,7 +34,7 @@ public function dropDatabase($database) */ public function createDatabase($database) { - $params = $this->_conn->getParams(); + $params = $this->conn->getParams(); $driver = $params['driver']; $options = [ 'driver' => $driver, @@ -95,13 +95,13 @@ public function dropForeignKey($foreignKey, $table) public function listTableForeignKeys($table, $database = null) { if (null === $database) { - $database = $this->_conn->getDatabase(); + $database = $this->conn->getDatabase(); } - $sql = $this->_platform->getListTableForeignKeysSQL($table, $database); - $tableForeignKeys = $this->_conn->fetchAll($sql); + $sql = $this->platform->getListTableForeignKeysSQL($table, $database); + $tableForeignKeys = $this->conn->fetchAll($sql); if ( ! empty($tableForeignKeys)) { - $createSql = $this->_conn->fetchAll("SELECT sql FROM (SELECT * FROM sqlite_master UNION ALL SELECT * FROM sqlite_temp_master) WHERE type = 'table' AND name = '$table'"); + $createSql = $this->conn->fetchAll("SELECT sql FROM (SELECT * FROM sqlite_master UNION ALL SELECT * FROM sqlite_temp_master) WHERE type = 'table' AND name = '$table'"); $createSql = $createSql[0]['sql'] ?? ''; if (preg_match_all('# @@ -130,13 +130,13 @@ public function listTableForeignKeys($table, $database = null) } } - return $this->_getPortableTableForeignKeysList($tableForeignKeys); + return $this->getPortableTableForeignKeysList($tableForeignKeys); } /** * {@inheritdoc} */ - protected function _getPortableTableDefinition($table) + protected function getPortableTableDefinition($table) { return $table['name']; } @@ -147,12 +147,12 @@ protected function _getPortableTableDefinition($table) * @license New BSD License * @link http://ezcomponents.org/docs/api/trunk/DatabaseSchema/ezcDbSchemaPgsqlReader.html */ - protected function _getPortableTableIndexesList($tableIndexes, $tableName=null) + protected function getPortableTableIndexesList($tableIndexes, $tableName=null) { $indexBuffer = []; // fetch primary - $stmt = $this->_conn->executeQuery("PRAGMA TABLE_INFO ('$tableName')"); + $stmt = $this->conn->executeQuery("PRAGMA TABLE_INFO ('$tableName')"); $indexArray = $stmt->fetchAll(FetchMode::ASSOCIATIVE); usort($indexArray, function($a, $b) { @@ -183,7 +183,7 @@ protected function _getPortableTableIndexesList($tableIndexes, $tableName=null) $idx['primary'] = false; $idx['non_unique'] = $tableIndex['unique']?false:true; - $stmt = $this->_conn->executeQuery("PRAGMA INDEX_INFO ('{$keyName}')"); + $stmt = $this->conn->executeQuery("PRAGMA INDEX_INFO ('{$keyName}')"); $indexArray = $stmt->fetchAll(FetchMode::ASSOCIATIVE); foreach ($indexArray as $indexColumnRow) { @@ -193,13 +193,13 @@ protected function _getPortableTableIndexesList($tableIndexes, $tableName=null) } } - return parent::_getPortableTableIndexesList($indexBuffer, $tableName); + return parent::getPortableTableIndexesList($indexBuffer, $tableName); } /** * {@inheritdoc} */ - protected function _getPortableTableIndexDefinition($tableIndex) + protected function getPortableTableIndexDefinition($tableIndex) { return [ 'name' => $tableIndex['name'], @@ -210,9 +210,9 @@ protected function _getPortableTableIndexDefinition($tableIndex) /** * {@inheritdoc} */ - protected function _getPortableTableColumnList($table, $database, $tableColumns) + protected function getPortableTableColumnList($table, $database, $tableColumns) { - $list = parent::_getPortableTableColumnList($table, $database, $tableColumns); + $list = parent::getPortableTableColumnList($table, $database, $tableColumns); // find column with autoincrement $autoincrementColumn = null; @@ -236,7 +236,7 @@ protected function _getPortableTableColumnList($table, $database, $tableColumns) } // inspect column collation and comments - $createSql = $this->_conn->fetchAll("SELECT sql FROM (SELECT * FROM sqlite_master UNION ALL SELECT * FROM sqlite_temp_master) WHERE type = 'table' AND name = '$table'"); + $createSql = $this->conn->fetchAll("SELECT sql FROM (SELECT * FROM sqlite_master UNION ALL SELECT * FROM sqlite_temp_master) WHERE type = 'table' AND name = '$table'"); $createSql = $createSql[0]['sql'] ?? ''; foreach ($list as $columnName => $column) { @@ -267,7 +267,7 @@ protected function _getPortableTableColumnList($table, $database, $tableColumns) /** * {@inheritdoc} */ - protected function _getPortableTableColumnDefinition($tableColumn) + protected function getPortableTableColumnDefinition($tableColumn) { $parts = explode('(', $tableColumn['type']); $tableColumn['type'] = trim($parts[0]); @@ -286,7 +286,7 @@ protected function _getPortableTableColumnDefinition($tableColumn) } $fixed = false; - $type = $this->_platform->getDoctrineTypeMapping($dbType); + $type = $this->platform->getDoctrineTypeMapping($dbType); $default = $tableColumn['dflt_value']; if ($default == 'NULL') { $default = null; @@ -340,7 +340,7 @@ protected function _getPortableTableColumnDefinition($tableColumn) /** * {@inheritdoc} */ - protected function _getPortableViewDefinition($view) + protected function getPortableViewDefinition($view) { return new View($view['name'], $view['sql']); } @@ -348,7 +348,7 @@ protected function _getPortableViewDefinition($view) /** * {@inheritdoc} */ - protected function _getPortableTableForeignKeysList($tableForeignKeys) + protected function getPortableTableForeignKeysList($tableForeignKeys) { $list = []; foreach ($tableForeignKeys as $value) { @@ -421,7 +421,7 @@ private function getTableDiffForAlterForeignKey(ForeignKeyConstraint $foreignKey private function parseColumnCollationFromSQL(string $column, string $sql) : ?string { - $pattern = '{(?:\W' . preg_quote($column) . '\W|\W' . preg_quote($this->_platform->quoteSingleIdentifier($column)) + $pattern = '{(?:\W' . preg_quote($column) . '\W|\W' . preg_quote($this->platform->quoteSingleIdentifier($column)) . '\W)[^,(]+(?:\([^()]+\)[^,]*)?(?:(?:DEFAULT|CHECK)\s*(?:\(.*?\))?[^,]*)*COLLATE\s+["\']?([^\s,"\')]+)}isx'; if (preg_match($pattern, $sql, $match) !== 1) { @@ -433,7 +433,7 @@ private function parseColumnCollationFromSQL(string $column, string $sql) : ?str private function parseColumnCommentFromSQL(string $column, string $sql) : ?string { - $pattern = '{[\s(,](?:\W' . preg_quote($this->_platform->quoteSingleIdentifier($column)) . '\W|\W' . preg_quote($column) + $pattern = '{[\s(,](?:\W' . preg_quote($this->platform->quoteSingleIdentifier($column)) . '\W|\W' . preg_quote($column) . '\W)(?:\(.*?\)|[^,(])*?,?((?:(?!\n))(?:\s*--[^\n]*\n?)+)}ix'; if (preg_match($pattern, $sql, $match) !== 1) { diff --git a/lib/Doctrine/DBAL/Schema/Table.php b/lib/Doctrine/DBAL/Schema/Table.php index 642a83138bc..665aabffdfc 100644 --- a/lib/Doctrine/DBAL/Schema/Table.php +++ b/lib/Doctrine/DBAL/Schema/Table.php @@ -18,12 +18,12 @@ class Table extends AbstractAsset /** * @var string */ - protected $_name = null; + protected $name = null; /** * @var Column[] */ - protected $_columns = []; + protected $columns = []; /** * @var Index[] @@ -33,32 +33,32 @@ class Table extends AbstractAsset /** * @var Index[] */ - protected $_indexes = []; + protected $indexes = []; /** * @var string */ - protected $_primaryKeyName = false; + protected $primaryKeyName = false; /** * @var UniqueConstraint[] */ - protected $_uniqueConstraints = []; + protected $uniqueConstraints = []; /** * @var ForeignKeyConstraint[] */ - protected $_fkConstraints = []; + protected $fkConstraints = []; /** * @var array */ - protected $_options = []; + protected $options = []; /** * @var SchemaConfig */ - protected $_schemaConfig = null; + protected $schemaConfig = null; /** * @param string $tableName @@ -83,25 +83,25 @@ public function __construct( throw DBALException::invalidTableName($tableName); } - $this->_setName($tableName); + $this->setName($tableName); foreach ($columns as $column) { - $this->_addColumn($column); + $this->addColumnCandidate($column); } foreach ($indexes as $idx) { - $this->_addIndex($idx); + $this->addIndexCandidate($idx); } foreach ($uniqueConstraints as $uniqueConstraint) { - $this->_addUniqueConstraint($uniqueConstraint); + $this->addUniqueConstraintCandidate($uniqueConstraint); } foreach ($fkConstraints as $fkConstraint) { - $this->_addForeignKeyConstraint($fkConstraint); + $this->addForeignKeyConstraintCandidate($fkConstraint); } - $this->_options = $options; + $this->options = $options; } /** @@ -111,7 +111,7 @@ public function __construct( */ public function setSchemaConfig(SchemaConfig $schemaConfig) { - $this->_schemaConfig = $schemaConfig; + $this->schemaConfig = $schemaConfig; } /** @@ -124,7 +124,7 @@ public function setSchemaConfig(SchemaConfig $schemaConfig) */ public function setPrimaryKey(array $columns, $indexName = false) { - $this->_addIndex($this->_createIndex($columns, $indexName ?: "primary", true, true)); + $this->addIndexCandidate($this->createIndex($columns, $indexName ?: "primary", true, true)); foreach ($columns as $columnName) { $column = $this->getColumn($columnName); @@ -145,12 +145,12 @@ public function setPrimaryKey(array $columns, $indexName = false) public function addUniqueConstraint(array $columnNames, $indexName = null, array $flags = array(), array $options = []) { if ($indexName == null) { - $indexName = $this->_generateIdentifierName( - array_merge(array($this->getName()), $columnNames), "uniq", $this->_getMaxIdentifierLength() + $indexName = $this->generateIdentifierName( + array_merge(array($this->getName()), $columnNames), "uniq", $this->getMaxIdentifierLength() ); } - return $this->_addUniqueConstraint($this->_createUniqueConstraint($columnNames, $indexName, $flags, $options)); + return $this->addUniqueConstraintCandidate($this->createUniqueConstraint($columnNames, $indexName, $flags, $options)); } /** @@ -164,12 +164,12 @@ public function addUniqueConstraint(array $columnNames, $indexName = null, array public function addIndex(array $columnNames, $indexName = null, array $flags = [], array $options = []) { if ($indexName == null) { - $indexName = $this->_generateIdentifierName( - array_merge([$this->getName()], $columnNames), "idx", $this->_getMaxIdentifierLength() + $indexName = $this->generateIdentifierName( + array_merge([$this->getName()], $columnNames), "idx", $this->getMaxIdentifierLength() ); } - return $this->_addIndex($this->_createIndex($columnNames, $indexName, false, false, $flags, $options)); + return $this->addIndexCandidate($this->createIndex($columnNames, $indexName, false, false, $flags, $options)); } /** @@ -179,8 +179,8 @@ public function addIndex(array $columnNames, $indexName = null, array $flags = [ */ public function dropPrimaryKey() { - $this->dropIndex($this->_primaryKeyName); - $this->_primaryKeyName = false; + $this->dropIndex($this->primaryKeyName); + $this->primaryKeyName = false; } /** @@ -197,10 +197,10 @@ public function dropIndex($indexName) $indexName = $this->normalizeIdentifier($indexName); if ( ! $this->hasIndex($indexName)) { - throw SchemaException::indexDoesNotExist($indexName, $this->_name); + throw SchemaException::indexDoesNotExist($indexName, $this->name); } - unset($this->_indexes[$indexName]); + unset($this->indexes[$indexName]); } /** @@ -213,12 +213,12 @@ public function dropIndex($indexName) public function addUniqueIndex(array $columnNames, $indexName = null, array $options = []) { if ($indexName === null) { - $indexName = $this->_generateIdentifierName( - array_merge([$this->getName()], $columnNames), "uniq", $this->_getMaxIdentifierLength() + $indexName = $this->generateIdentifierName( + array_merge([$this->getName()], $columnNames), "uniq", $this->getMaxIdentifierLength() ); } - return $this->_addIndex($this->_createIndex($columnNames, $indexName, true, false, [], $options)); + return $this->addIndexCandidate($this->createIndex($columnNames, $indexName, true, false, [], $options)); } /** @@ -243,14 +243,14 @@ public function renameIndex($oldIndexName, $newIndexName = null) } if ( ! $this->hasIndex($oldIndexName)) { - throw SchemaException::indexDoesNotExist($oldIndexName, $this->_name); + throw SchemaException::indexDoesNotExist($oldIndexName, $this->name); } if ($this->hasIndex($normalizedNewIndexName)) { - throw SchemaException::indexAlreadyExists($normalizedNewIndexName, $this->_name); + throw SchemaException::indexAlreadyExists($normalizedNewIndexName, $this->name); } - $oldIndex = $this->_indexes[$oldIndexName]; + $oldIndex = $this->indexes[$oldIndexName]; if ($oldIndex->isPrimary()) { $this->dropPrimaryKey(); @@ -258,7 +258,7 @@ public function renameIndex($oldIndexName, $newIndexName = null) return $this->setPrimaryKey($oldIndex->getColumns(), $newIndexName); } - unset($this->_indexes[$oldIndexName]); + unset($this->indexes[$oldIndexName]); if ($oldIndex->isUnique()) { return $this->addUniqueIndex($oldIndex->getColumns(), $newIndexName, $oldIndex->getOptions()); @@ -297,7 +297,7 @@ public function addColumn($columnName, $typeName, array $options=[]) { $column = new Column($columnName, Type::getType($typeName), $options); - $this->_addColumn($column); + $this->addColumnCandidate($column); return $column; } @@ -349,7 +349,7 @@ public function dropColumn($columnName) { $columnName = $this->normalizeIdentifier($columnName); - unset($this->_columns[$columnName]); + unset($this->columns[$columnName]); return $this; } @@ -370,8 +370,8 @@ public function dropColumn($columnName) public function addForeignKeyConstraint($foreignTable, array $localColumnNames, array $foreignColumnNames, array $options=[], $constraintName = null) { if ( ! $constraintName) { - $constraintName = $this->_generateIdentifierName( - array_merge((array) $this->getName(), $localColumnNames), "fk", $this->_getMaxIdentifierLength() + $constraintName = $this->generateIdentifierName( + array_merge((array) $this->getName(), $localColumnNames), "fk", $this->getMaxIdentifierLength() ); } @@ -424,7 +424,7 @@ public function addNamedForeignKeyConstraint($name, $foreignTable, array $localC foreach ($localColumnNames as $columnName) { if ( ! $this->hasColumn($columnName)) { - throw SchemaException::columnDoesNotExist($columnName, $this->_name); + throw SchemaException::columnDoesNotExist($columnName, $this->name); } } @@ -432,7 +432,7 @@ public function addNamedForeignKeyConstraint($name, $foreignTable, array $localC $localColumnNames, $foreignTable, $foreignColumnNames, $name, $options ); - return $this->_addForeignKeyConstraint($constraint); + return $this->addForeignKeyConstraintCandidate($constraint); } /** @@ -443,7 +443,7 @@ public function addNamedForeignKeyConstraint($name, $foreignTable, array $localC */ public function addOption($name, $value) { - $this->_options[$name] = $value; + $this->options[$name] = $value; return $this; } @@ -459,7 +459,7 @@ public function hasForeignKey($constraintName) { $constraintName = $this->normalizeIdentifier($constraintName); - return isset($this->_fkConstraints[$constraintName]); + return isset($this->fkConstraints[$constraintName]); } /** @@ -476,10 +476,10 @@ public function getForeignKey($constraintName) $constraintName = $this->normalizeIdentifier($constraintName); if ( ! $this->hasForeignKey($constraintName)) { - throw SchemaException::foreignKeyDoesNotExist($constraintName, $this->_name); + throw SchemaException::foreignKeyDoesNotExist($constraintName, $this->name); } - return $this->_fkConstraints[$constraintName]; + return $this->fkConstraints[$constraintName]; } /** @@ -496,10 +496,10 @@ public function removeForeignKey($constraintName) $constraintName = $this->normalizeIdentifier($constraintName); if ( ! $this->hasForeignKey($constraintName)) { - throw SchemaException::foreignKeyDoesNotExist($constraintName, $this->_name); + throw SchemaException::foreignKeyDoesNotExist($constraintName, $this->name); } - unset($this->_fkConstraints[$constraintName]); + unset($this->fkConstraints[$constraintName]); } /** @@ -513,7 +513,7 @@ public function hasUniqueConstraint($constraintName) { $constraintName = $this->normalizeIdentifier($constraintName); - return isset($this->_uniqueConstraints[$constraintName]); + return isset($this->uniqueConstraints[$constraintName]); } /** @@ -530,10 +530,10 @@ public function getUniqueConstraint($constraintName) $constraintName = $this->normalizeIdentifier($constraintName); if ( ! $this->hasUniqueConstraint($constraintName)) { - throw SchemaException::uniqueConstraintDoesNotExist($constraintName, $this->_name); + throw SchemaException::uniqueConstraintDoesNotExist($constraintName, $this->name); } - return $this->_uniqueConstraints[$constraintName]; + return $this->uniqueConstraints[$constraintName]; } /** @@ -550,10 +550,10 @@ public function removeUniqueConstraint($constraintName) $constraintName = $this->normalizeIdentifier($constraintName); if ( ! $this->hasUniqueConstraint($constraintName)) { - throw SchemaException::uniqueConstraintDoesNotExist($constraintName, $this->_name); + throw SchemaException::uniqueConstraintDoesNotExist($constraintName, $this->name); } - unset($this->_uniqueConstraints[$constraintName]); + unset($this->uniqueConstraints[$constraintName]); } /** @@ -562,7 +562,7 @@ public function removeUniqueConstraint($constraintName) */ public function getColumns() { - $columns = $this->_columns; + $columns = $this->columns; $pkCols = []; $fkCols = []; @@ -607,7 +607,7 @@ private function getForeignKeyColumns() */ private function filterColumns(array $columnNames) { - return array_filter($this->_columns, function ($columnName) use ($columnNames) { + return array_filter($this->columns, function ($columnName) use ($columnNames) { return in_array($columnName, $columnNames, true); }, ARRAY_FILTER_USE_KEY); } @@ -623,7 +623,7 @@ public function hasColumn($columnName) { $columnName = $this->normalizeIdentifier($columnName); - return isset($this->_columns[$columnName]); + return isset($this->columns[$columnName]); } /** @@ -640,10 +640,10 @@ public function getColumn($columnName) $columnName = $this->normalizeIdentifier($columnName); if ( ! $this->hasColumn($columnName)) { - throw SchemaException::columnDoesNotExist($columnName, $this->_name); + throw SchemaException::columnDoesNotExist($columnName, $this->name); } - return $this->_columns[$columnName]; + return $this->columns[$columnName]; } /** @@ -654,7 +654,7 @@ public function getColumn($columnName) public function getPrimaryKey() { return $this->hasPrimaryKey() - ? $this->getIndex($this->_primaryKeyName) + ? $this->getIndex($this->primaryKeyName) : null ; } @@ -681,7 +681,7 @@ public function getPrimaryKeyColumns() */ public function hasPrimaryKey() { - return ($this->_primaryKeyName && $this->hasIndex($this->_primaryKeyName)); + return ($this->primaryKeyName && $this->hasIndex($this->primaryKeyName)); } /** @@ -695,7 +695,7 @@ public function hasIndex($indexName) { $indexName = $this->normalizeIdentifier($indexName); - return (isset($this->_indexes[$indexName])); + return (isset($this->indexes[$indexName])); } /** @@ -712,10 +712,10 @@ public function getIndex($indexName) $indexName = $this->normalizeIdentifier($indexName); if ( ! $this->hasIndex($indexName)) { - throw SchemaException::indexDoesNotExist($indexName, $this->_name); + throw SchemaException::indexDoesNotExist($indexName, $this->name); } - return $this->_indexes[$indexName]; + return $this->indexes[$indexName]; } /** @@ -723,7 +723,7 @@ public function getIndex($indexName) */ public function getIndexes() { - return $this->_indexes; + return $this->indexes; } /** @@ -733,7 +733,7 @@ public function getIndexes() */ public function getUniqueConstraints() { - return $this->_uniqueConstraints; + return $this->uniqueConstraints; } /** @@ -743,7 +743,7 @@ public function getUniqueConstraints() */ public function getForeignKeys() { - return $this->_fkConstraints; + return $this->fkConstraints; } /** @@ -753,7 +753,7 @@ public function getForeignKeys() */ public function hasOption($name) { - return isset($this->_options[$name]); + return isset($this->options[$name]); } /** @@ -763,7 +763,7 @@ public function hasOption($name) */ public function getOption($name) { - return $this->_options[$name]; + return $this->options[$name]; } /** @@ -771,7 +771,7 @@ public function getOption($name) */ public function getOptions() { - return $this->_options; + return $this->options; } /** @@ -803,27 +803,27 @@ public function visit(Visitor $visitor) */ public function __clone() { - foreach ($this->_columns as $k => $column) { - $this->_columns[$k] = clone $column; + foreach ($this->columns as $k => $column) { + $this->columns[$k] = clone $column; } - foreach ($this->_indexes as $k => $index) { - $this->_indexes[$k] = clone $index; + foreach ($this->indexes as $k => $index) { + $this->indexes[$k] = clone $index; } - foreach ($this->_fkConstraints as $k => $fk) { - $this->_fkConstraints[$k] = clone $fk; - $this->_fkConstraints[$k]->setLocalTable($this); + foreach ($this->fkConstraints as $k => $fk) { + $this->fkConstraints[$k] = clone $fk; + $this->fkConstraints[$k]->setLocalTable($this); } } /** * @return integer */ - protected function _getMaxIdentifierLength() + protected function getMaxIdentifierLength() { - return ($this->_schemaConfig instanceof SchemaConfig) - ? $this->_schemaConfig->getMaxIdentifierLength() + return ($this->schemaConfig instanceof SchemaConfig) + ? $this->schemaConfig->getMaxIdentifierLength() : 63 ; } @@ -835,16 +835,16 @@ protected function _getMaxIdentifierLength() * * @throws SchemaException */ - protected function _addColumn(Column $column) + protected function addColumnCandidate(Column $column) { $columnName = $column->getName(); $columnName = $this->normalizeIdentifier($columnName); - if (isset($this->_columns[$columnName])) { + if (isset($this->columns[$columnName])) { throw SchemaException::columnAlreadyExists($this->getName(), $columnName); } - $this->_columns[$columnName] = $column; + $this->columns[$columnName] = $column; } /** @@ -856,33 +856,33 @@ protected function _addColumn(Column $column) * * @throws SchemaException */ - protected function _addIndex(Index $indexCandidate) + protected function addIndexCandidate(Index $indexCandidate) { $indexName = $indexCandidate->getName(); $indexName = $this->normalizeIdentifier($indexName); $replacedImplicitIndexes = []; foreach ($this->implicitIndexes as $name => $implicitIndex) { - if ($implicitIndex->isFullfilledBy($indexCandidate) && isset($this->_indexes[$name])) { + if ($implicitIndex->isFullfilledBy($indexCandidate) && isset($this->indexes[$name])) { $replacedImplicitIndexes[] = $name; } } - if ((isset($this->_indexes[$indexName]) && ! in_array($indexName, $replacedImplicitIndexes, true)) || - ($this->_primaryKeyName != false && $indexCandidate->isPrimary()) + if ((isset($this->indexes[$indexName]) && ! in_array($indexName, $replacedImplicitIndexes, true)) || + ($this->primaryKeyName != false && $indexCandidate->isPrimary()) ) { - throw SchemaException::indexAlreadyExists($indexName, $this->_name); + throw SchemaException::indexAlreadyExists($indexName, $this->name); } foreach ($replacedImplicitIndexes as $name) { - unset($this->_indexes[$name], $this->implicitIndexes[$name]); + unset($this->indexes[$name], $this->implicitIndexes[$name]); } if ($indexCandidate->isPrimary()) { - $this->_primaryKeyName = $indexName; + $this->primaryKeyName = $indexName; } - $this->_indexes[$indexName] = $indexCandidate; + $this->indexes[$indexName] = $indexCandidate; return $this; } @@ -892,29 +892,29 @@ protected function _addIndex(Index $indexCandidate) * * @return self */ - protected function _addUniqueConstraint(UniqueConstraint $constraint) + protected function addUniqueConstraintCandidate(UniqueConstraint $constraint) { $name = strlen($constraint->getName()) ? $constraint->getName() - : $this->_generateIdentifierName( - array_merge((array) $this->getName(), $constraint->getLocalColumns()), "fk", $this->_getMaxIdentifierLength() + : $this->generateIdentifierName( + array_merge((array) $this->getName(), $constraint->getLocalColumns()), "fk", $this->getMaxIdentifierLength() ) ; $name = $this->normalizeIdentifier($name); - $this->_uniqueConstraints[$name] = $constraint; + $this->uniqueConstraints[$name] = $constraint; // If there is already an index that fulfills this requirements drop the request. In the case of __construct // calling this method during hydration from schema-details all the explicitly added indexes lead to duplicates. // This creates computation overhead in this case, however no duplicate indexes are ever added (column based). - $indexName = $this->_generateIdentifierName( - array_merge(array($this->getName()), $constraint->getColumns()), "idx", $this->_getMaxIdentifierLength() + $indexName = $this->generateIdentifierName( + array_merge(array($this->getName()), $constraint->getColumns()), "idx", $this->getMaxIdentifierLength() ); - $indexCandidate = $this->_createIndex($constraint->getColumns(), $indexName, true, false); + $indexCandidate = $this->createIndex($constraint->getColumns(), $indexName, true, false); - foreach ($this->_indexes as $existingIndex) { + foreach ($this->indexes as $existingIndex) { if ($indexCandidate->isFullfilledBy($existingIndex)) { return $this; } @@ -930,38 +930,38 @@ protected function _addUniqueConstraint(UniqueConstraint $constraint) * * @return self */ - protected function _addForeignKeyConstraint(ForeignKeyConstraint $constraint) + protected function addForeignKeyConstraintCandidate(ForeignKeyConstraint $constraint) { $constraint->setLocalTable($this); $name = strlen($constraint->getName()) ? $constraint->getName() - : $this->_generateIdentifierName( - array_merge((array) $this->getName(), $constraint->getLocalColumns()), "fk", $this->_getMaxIdentifierLength() + : $this->generateIdentifierName( + array_merge((array) $this->getName(), $constraint->getLocalColumns()), "fk", $this->getMaxIdentifierLength() ) ; $name = $this->normalizeIdentifier($name); - $this->_fkConstraints[$name] = $constraint; + $this->fkConstraints[$name] = $constraint; // add an explicit index on the foreign key columns. // If there is already an index that fulfills this requirements drop the request. In the case of __construct // calling this method during hydration from schema-details all the explicitly added indexes lead to duplicates. // This creates computation overhead in this case, however no duplicate indexes are ever added (column based). - $indexName = $this->_generateIdentifierName( - array_merge(array($this->getName()), $constraint->getColumns()), "idx", $this->_getMaxIdentifierLength() + $indexName = $this->generateIdentifierName( + array_merge(array($this->getName()), $constraint->getColumns()), "idx", $this->getMaxIdentifierLength() ); - $indexCandidate = $this->_createIndex($constraint->getColumns(), $indexName, false, false); + $indexCandidate = $this->createIndex($constraint->getColumns(), $indexName, false, false); - foreach ($this->_indexes as $existingIndex) { + foreach ($this->indexes as $existingIndex) { if ($indexCandidate->isFullfilledBy($existingIndex)) { return $this; } } - $this->_addIndex($indexCandidate); + $this->addIndexCandidate($indexCandidate); $this->implicitIndexes[$this->normalizeIdentifier($indexName)] = $indexCandidate; return $this; @@ -991,7 +991,7 @@ private function normalizeIdentifier($identifier) * * @throws SchemaException */ - private function _createUniqueConstraint(array $columnNames, $indexName, array $flags = array(), array $options = []) + private function createUniqueConstraint(array $columnNames, $indexName, array $flags = array(), array $options = []) { if (preg_match('(([^a-zA-Z0-9_]+))', $this->normalizeIdentifier($indexName))) { throw SchemaException::indexNameInvalid($indexName); @@ -1003,7 +1003,7 @@ private function _createUniqueConstraint(array $columnNames, $indexName, array $ } if ( ! $this->hasColumn($columnName)) { - throw SchemaException::columnDoesNotExist($columnName, $this->_name); + throw SchemaException::columnDoesNotExist($columnName, $this->name); } } @@ -1022,7 +1022,7 @@ private function _createUniqueConstraint(array $columnNames, $indexName, array $ * * @throws SchemaException */ - private function _createIndex(array $columnNames, $indexName, $isUnique, $isPrimary, array $flags = [], array $options = []) + private function createIndex(array $columnNames, $indexName, $isUnique, $isPrimary, array $flags = [], array $options = []) { if (preg_match('(([^a-zA-Z0-9_]+))', $this->normalizeIdentifier($indexName))) { throw SchemaException::indexNameInvalid($indexName); @@ -1034,7 +1034,7 @@ private function _createIndex(array $columnNames, $indexName, $isUnique, $isPrim } if ( ! $this->hasColumn($columnName)) { - throw SchemaException::columnDoesNotExist($columnName, $this->_name); + throw SchemaException::columnDoesNotExist($columnName, $this->name); } } diff --git a/lib/Doctrine/DBAL/Schema/UniqueConstraint.php b/lib/Doctrine/DBAL/Schema/UniqueConstraint.php index d5b94fd3126..12425cf1825 100644 --- a/lib/Doctrine/DBAL/Schema/UniqueConstraint.php +++ b/lib/Doctrine/DBAL/Schema/UniqueConstraint.php @@ -44,12 +44,12 @@ class UniqueConstraint extends AbstractAsset implements Constraint */ public function __construct($indexName, array $columns, array $flags = array(), array $options = array()) { - $this->_setName($indexName); + $this->setName($indexName); $this->options = $options; foreach ($columns as $column) { - $this->_addColumn($column); + $this->addColumn($column); } foreach ($flags as $flag) { @@ -172,7 +172,7 @@ public function getOptions() * * @throws \InvalidArgumentException */ - protected function _addColumn($column) + protected function addColumn($column) { if (is_string($column)) { $this->columns[$column] = new Identifier($column); diff --git a/lib/Doctrine/DBAL/Schema/View.php b/lib/Doctrine/DBAL/Schema/View.php index 9d54cd1ff68..f16b622b395 100644 --- a/lib/Doctrine/DBAL/Schema/View.php +++ b/lib/Doctrine/DBAL/Schema/View.php @@ -14,7 +14,7 @@ class View extends AbstractAsset /** * @var string */ - private $_sql; + private $sql; /** * @param string $name @@ -22,8 +22,8 @@ class View extends AbstractAsset */ public function __construct($name, $sql) { - $this->_setName($name); - $this->_sql = $sql; + $this->setName($name); + $this->sql = $sql; } /** @@ -31,6 +31,6 @@ public function __construct($name, $sql) */ public function getSql() { - return $this->_sql; + return $this->sql; } } diff --git a/lib/Doctrine/DBAL/Sharding/PoolingShardConnection.php b/lib/Doctrine/DBAL/Sharding/PoolingShardConnection.php index 551871eb770..abc734c527f 100644 --- a/lib/Doctrine/DBAL/Sharding/PoolingShardConnection.php +++ b/lib/Doctrine/DBAL/Sharding/PoolingShardConnection.php @@ -178,7 +178,7 @@ public function getPassword() */ public function connect($shardId = null) { - if ($shardId === null && $this->_conn) { + if ($shardId === null && $this->conn) { return false; } @@ -193,16 +193,16 @@ public function connect($shardId = null) $this->activeShardId = (int)$shardId; if (isset($this->activeConnections[$this->activeShardId])) { - $this->_conn = $this->activeConnections[$this->activeShardId]; + $this->conn = $this->activeConnections[$this->activeShardId]; return false; } - $this->_conn = $this->activeConnections[$this->activeShardId] = $this->connectTo($this->activeShardId); + $this->conn = $this->activeConnections[$this->activeShardId] = $this->connectTo($this->activeShardId); - if ($this->_eventManager->hasListeners(Events::postConnect)) { + if ($this->eventManager->hasListeners(Events::postConnect)) { $eventArgs = new ConnectionEventArgs($this); - $this->_eventManager->dispatchEvent(Events::postConnect, $eventArgs); + $this->eventManager->dispatchEvent(Events::postConnect, $eventArgs); } return true; @@ -226,7 +226,7 @@ protected function connectTo($shardId) $user = $connectionParams['user'] ?? null; $password = $connectionParams['password'] ?? null; - return $this->_driver->connect($connectionParams, $user, $password, $driverOptions); + return $this->driver->connect($connectionParams, $user, $password, $driverOptions); } /** @@ -237,7 +237,7 @@ protected function connectTo($shardId) public function isConnected($shardId = null) { if ($shardId === null) { - return $this->_conn !== null; + return $this->conn !== null; } return isset($this->activeConnections[$shardId]); @@ -248,7 +248,7 @@ public function isConnected($shardId = null) */ public function close() { - $this->_conn = null; + $this->conn = null; $this->activeConnections = null; $this->activeShardId = null; } diff --git a/lib/Doctrine/DBAL/Tools/Console/Helper/ConnectionHelper.php b/lib/Doctrine/DBAL/Tools/Console/Helper/ConnectionHelper.php index f85162139a8..c8efd604294 100644 --- a/lib/Doctrine/DBAL/Tools/Console/Helper/ConnectionHelper.php +++ b/lib/Doctrine/DBAL/Tools/Console/Helper/ConnectionHelper.php @@ -22,7 +22,7 @@ class ConnectionHelper extends Helper * * @var \Doctrine\DBAL\Connection */ - protected $_connection; + protected $connection; /** * Constructor. @@ -31,7 +31,7 @@ class ConnectionHelper extends Helper */ public function __construct(Connection $connection) { - $this->_connection = $connection; + $this->connection = $connection; } /** @@ -41,7 +41,7 @@ public function __construct(Connection $connection) */ public function getConnection() { - return $this->_connection; + return $this->connection; } /** diff --git a/lib/Doctrine/DBAL/Types/Type.php b/lib/Doctrine/DBAL/Types/Type.php index ee4c92387c6..d4da5b39baf 100644 --- a/lib/Doctrine/DBAL/Types/Type.php +++ b/lib/Doctrine/DBAL/Types/Type.php @@ -48,14 +48,14 @@ abstract class Type * * @var array */ - private static $_typeObjects = []; + private static $typeObjects = []; /** * The map of supported doctrine mapping types. * * @var array */ - private static $_typesMap = [ + private static $typesMap = [ self::TARRAY => ArrayType::class, self::SIMPLE_ARRAY => SimpleArrayType::class, self::JSON_ARRAY => JsonArrayType::class, @@ -163,14 +163,14 @@ abstract public function getName(); */ public static function getType($name) { - if ( ! isset(self::$_typeObjects[$name])) { - if ( ! isset(self::$_typesMap[$name])) { + if ( ! isset(self::$typeObjects[$name])) { + if ( ! isset(self::$typesMap[$name])) { throw DBALException::unknownColumnType($name); } - self::$_typeObjects[$name] = new self::$_typesMap[$name](); + self::$typeObjects[$name] = new self::$typesMap[$name](); } - return self::$_typeObjects[$name]; + return self::$typeObjects[$name]; } /** @@ -185,11 +185,11 @@ public static function getType($name) */ public static function addType($name, $className) { - if (isset(self::$_typesMap[$name])) { + if (isset(self::$typesMap[$name])) { throw DBALException::typeExists($name); } - self::$_typesMap[$name] = $className; + self::$typesMap[$name] = $className; } /** @@ -201,7 +201,7 @@ public static function addType($name, $className) */ public static function hasType($name) { - return isset(self::$_typesMap[$name]); + return isset(self::$typesMap[$name]); } /** @@ -216,15 +216,15 @@ public static function hasType($name) */ public static function overrideType($name, $className) { - if ( ! isset(self::$_typesMap[$name])) { + if ( ! isset(self::$typesMap[$name])) { throw DBALException::typeNotFound($name); } - if (isset(self::$_typeObjects[$name])) { - unset(self::$_typeObjects[$name]); + if (isset(self::$typeObjects[$name])) { + unset(self::$typeObjects[$name]); } - self::$_typesMap[$name] = $className; + self::$typesMap[$name] = $className; } /** @@ -248,7 +248,7 @@ public function getBindingType() */ public static function getTypesMap() { - return self::$_typesMap; + return self::$typesMap; } /** diff --git a/tests/Doctrine/Tests/DBAL/ConnectionTest.php b/tests/Doctrine/Tests/DBAL/ConnectionTest.php index ef20791120d..9eede167f6c 100644 --- a/tests/Doctrine/Tests/DBAL/ConnectionTest.php +++ b/tests/Doctrine/Tests/DBAL/ConnectionTest.php @@ -28,7 +28,7 @@ class ConnectionTest extends \Doctrine\Tests\DbalTestCase /** * @var \Doctrine\DBAL\Connection */ - protected $_conn = null; + protected $conn = null; protected $params = array( 'driver' => 'pdo_mysql', @@ -40,7 +40,7 @@ class ConnectionTest extends \Doctrine\Tests\DbalTestCase protected function setUp() { - $this->_conn = \Doctrine\DBAL\DriverManager::getConnection($this->params); + $this->conn = \Doctrine\DBAL\DriverManager::getConnection($this->params); } public function getExecuteUpdateMockConnection() @@ -63,73 +63,73 @@ public function getExecuteUpdateMockConnection() public function testIsConnected() { - self::assertFalse($this->_conn->isConnected()); + self::assertFalse($this->conn->isConnected()); } public function testNoTransactionActiveByDefault() { - self::assertFalse($this->_conn->isTransactionActive()); + self::assertFalse($this->conn->isTransactionActive()); } public function testCommitWithNoActiveTransaction_ThrowsException() { $this->expectException(ConnectionException::class); - $this->_conn->commit(); + $this->conn->commit(); } public function testRollbackWithNoActiveTransaction_ThrowsException() { $this->expectException(ConnectionException::class); - $this->_conn->rollBack(); + $this->conn->rollBack(); } public function testSetRollbackOnlyNoActiveTransaction_ThrowsException() { $this->expectException(ConnectionException::class); - $this->_conn->setRollbackOnly(); + $this->conn->setRollbackOnly(); } public function testIsRollbackOnlyNoActiveTransaction_ThrowsException() { $this->expectException(ConnectionException::class); - $this->_conn->isRollbackOnly(); + $this->conn->isRollbackOnly(); } public function testGetConfiguration() { - $config = $this->_conn->getConfiguration(); + $config = $this->conn->getConfiguration(); self::assertInstanceOf('Doctrine\DBAL\Configuration', $config); } public function testGetHost() { - self::assertEquals('localhost', $this->_conn->getHost()); + self::assertEquals('localhost', $this->conn->getHost()); } public function testGetPort() { - self::assertEquals('1234', $this->_conn->getPort()); + self::assertEquals('1234', $this->conn->getPort()); } public function testGetUsername() { - self::assertEquals('root', $this->_conn->getUsername()); + self::assertEquals('root', $this->conn->getUsername()); } public function testGetPassword() { - self::assertEquals('password', $this->_conn->getPassword()); + self::assertEquals('password', $this->conn->getPassword()); } public function testGetDriver() { - self::assertInstanceOf('Doctrine\DBAL\Driver\PDOMySql\Driver', $this->_conn->getDriver()); + self::assertInstanceOf('Doctrine\DBAL\Driver\PDOMySql\Driver', $this->conn->getDriver()); } public function testGetEventManager() { - self::assertInstanceOf('Doctrine\Common\EventManager', $this->_conn->getEventManager()); + self::assertInstanceOf('Doctrine\Common\EventManager', $this->conn->getEventManager()); } public function testConnectDispatchEvent() @@ -196,8 +196,8 @@ public function getQueryMethods() public function testEchoSQLLogger() { $logger = new \Doctrine\DBAL\Logging\EchoSQLLogger(); - $this->_conn->getConfiguration()->setSQLLogger($logger); - self::assertSame($logger, $this->_conn->getConfiguration()->getSQLLogger()); + $this->conn->getConfiguration()->setSQLLogger($logger); + self::assertSame($logger, $this->conn->getConfiguration()->getSQLLogger()); } /** @@ -208,8 +208,8 @@ public function testEchoSQLLogger() public function testDebugSQLStack() { $logger = new \Doctrine\DBAL\Logging\DebugStack(); - $this->_conn->getConfiguration()->setSQLLogger($logger); - self::assertSame($logger, $this->_conn->getConfiguration()->getSQLLogger()); + $this->conn->getConfiguration()->setSQLLogger($logger); + self::assertSame($logger, $this->conn->getConfiguration()->getSQLLogger()); } /** @@ -217,7 +217,7 @@ public function testDebugSQLStack() */ public function testIsAutoCommit() { - self::assertTrue($this->_conn->isAutoCommit()); + self::assertTrue($this->conn->isAutoCommit()); } /** @@ -225,10 +225,10 @@ public function testIsAutoCommit() */ public function testSetAutoCommit() { - $this->_conn->setAutoCommit(false); - self::assertFalse($this->_conn->isAutoCommit()); - $this->_conn->setAutoCommit(0); - self::assertFalse($this->_conn->isAutoCommit()); + $this->conn->setAutoCommit(false); + self::assertFalse($this->conn->isAutoCommit()); + $this->conn->setAutoCommit(0); + self::assertFalse($this->conn->isAutoCommit()); } /** @@ -611,7 +611,7 @@ public function testConnectionIsClosedButNotUnset() // artificially set the wrapped connection to non-null $reflection = new \ReflectionObject($connection); - $connProperty = $reflection->getProperty('_conn'); + $connProperty = $reflection->getProperty('conn'); $connProperty->setAccessible(true); $connProperty->setValue($connection, new \stdClass); diff --git a/tests/Doctrine/Tests/DBAL/Driver/AbstractDriverTest.php b/tests/Doctrine/Tests/DBAL/Driver/AbstractDriverTest.php index dd448d65730..8c50bc39972 100644 --- a/tests/Doctrine/Tests/DBAL/Driver/AbstractDriverTest.php +++ b/tests/Doctrine/Tests/DBAL/Driver/AbstractDriverTest.php @@ -175,7 +175,7 @@ public function testReturnsSchemaManager() $schemaManager = $this->driver->getSchemaManager($connection); self::assertEquals($this->createSchemaManager($connection), $schemaManager); - self::assertAttributeSame($connection, '_conn', $schemaManager); + self::assertAttributeSame($connection, 'conn', $schemaManager); } /** diff --git a/tests/Doctrine/Tests/DBAL/Driver/OCI8/OCI8StatementTest.php b/tests/Doctrine/Tests/DBAL/Driver/OCI8/OCI8StatementTest.php index 06e80338985..c0e78ac1175 100644 --- a/tests/Doctrine/Tests/DBAL/Driver/OCI8/OCI8StatementTest.php +++ b/tests/Doctrine/Tests/DBAL/Driver/OCI8/OCI8StatementTest.php @@ -64,7 +64,7 @@ public function testExecute(array $params) $conn->expects($this->once()) ->method('getExecuteMode'); - $reflProperty = new \ReflectionProperty($statement, '_conn'); + $reflProperty = new \ReflectionProperty($statement, 'conn'); $reflProperty->setAccessible(true); $reflProperty->setValue($statement, $conn); diff --git a/tests/Doctrine/Tests/DBAL/Driver/StatementIteratorTest.php b/tests/Doctrine/Tests/DBAL/Driver/StatementIteratorTest.php index 82b2790fc19..34a018131c3 100644 --- a/tests/Doctrine/Tests/DBAL/Driver/StatementIteratorTest.php +++ b/tests/Doctrine/Tests/DBAL/Driver/StatementIteratorTest.php @@ -33,7 +33,7 @@ public function testIterationCallsFetchOncePerStep() }); $stmtIterator = new StatementIterator($stmt); - foreach ($stmtIterator as $i => $_) { + foreach ($stmtIterator as $i => $value) { $this->assertEquals($i + 1, $calls); } } diff --git a/tests/Doctrine/Tests/DBAL/Functional/BlobTest.php b/tests/Doctrine/Tests/DBAL/Functional/BlobTest.php index 11547b2e82f..1c4d0a905d4 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/BlobTest.php +++ b/tests/Doctrine/Tests/DBAL/Functional/BlobTest.php @@ -14,7 +14,7 @@ protected function setUp() { parent::setUp(); - if ($this->_conn->getDriver() instanceof \Doctrine\DBAL\Driver\PDOSqlsrv\Driver) { + if ($this->conn->getDriver() instanceof \Doctrine\DBAL\Driver\PDOSqlsrv\Driver) { $this->markTestSkipped('This test does not work on pdo_sqlsrv driver due to a bug. See: http://social.msdn.microsoft.com/Forums/sqlserver/en-US/5a755bdd-41e9-45cb-9166-c9da4475bb94/how-to-set-null-for-varbinarymax-using-bindvalue-using-pdosqlsrv?forum=sqldriverforphp'); } @@ -27,17 +27,17 @@ protected function setUp() $table->addColumn('binaryfield', 'binary', array('length' => 50)); $table->setPrimaryKey(array('id')); - $sm = $this->_conn->getSchemaManager(); + $sm = $this->conn->getSchemaManager(); $sm->createTable($table); } catch(\Exception $e) { } - $this->_conn->exec($this->_conn->getDatabasePlatform()->getTruncateTableSQL('blob_table')); + $this->conn->exec($this->conn->getDatabasePlatform()->getTruncateTableSQL('blob_table')); } public function testInsert() { - $ret = $this->_conn->insert('blob_table', + $ret = $this->conn->insert('blob_table', array('id' => 1, 'clobfield' => 'test', 'blobfield' => 'test', 'binaryfield' => 'test'), array(ParameterType::INTEGER, ParameterType::STRING, ParameterType::LARGE_OBJECT, ParameterType::LARGE_OBJECT) ); @@ -46,7 +46,7 @@ public function testInsert() public function testSelect() { - $this->_conn->insert('blob_table', + $this->conn->insert('blob_table', array('id' => 1, 'clobfield' => 'test', 'blobfield' => 'test', 'binaryfield' => 'test'), array(ParameterType::INTEGER, ParameterType::STRING, ParameterType::LARGE_OBJECT, ParameterType::LARGE_OBJECT) ); @@ -56,12 +56,12 @@ public function testSelect() public function testUpdate() { - $this->_conn->insert('blob_table', + $this->conn->insert('blob_table', array('id' => 1, 'clobfield' => 'test', 'blobfield' => 'test', 'binaryfield' => 'test'), array(ParameterType::INTEGER, ParameterType::STRING, ParameterType::LARGE_OBJECT, ParameterType::LARGE_OBJECT) ); - $this->_conn->update('blob_table', + $this->conn->update('blob_table', array('blobfield' => 'test2', 'binaryfield' => 'test2'), array('id' => 1), array(ParameterType::LARGE_OBJECT, ParameterType::LARGE_OBJECT, ParameterType::INTEGER) @@ -73,12 +73,12 @@ public function testUpdate() private function assertBinaryContains($text) { - $rows = $this->_conn->fetchAll('SELECT * FROM blob_table'); + $rows = $this->conn->fetchAll('SELECT * FROM blob_table'); self::assertCount(1, $rows); $row = array_change_key_case($rows[0], CASE_LOWER); - $blobValue = Type::getType('binary')->convertToPHPValue($row['binaryfield'], $this->_conn->getDatabasePlatform()); + $blobValue = Type::getType('binary')->convertToPHPValue($row['binaryfield'], $this->conn->getDatabasePlatform()); self::assertInternalType('resource', $blobValue); self::assertEquals($text, stream_get_contents($blobValue)); @@ -86,12 +86,12 @@ private function assertBinaryContains($text) private function assertBlobContains($text) { - $rows = $this->_conn->fetchAll('SELECT * FROM blob_table'); + $rows = $this->conn->fetchAll('SELECT * FROM blob_table'); self::assertCount(1, $rows); $row = array_change_key_case($rows[0], CASE_LOWER); - $blobValue = Type::getType('blob')->convertToPHPValue($row['blobfield'], $this->_conn->getDatabasePlatform()); + $blobValue = Type::getType('blob')->convertToPHPValue($row['blobfield'], $this->conn->getDatabasePlatform()); self::assertInternalType('resource', $blobValue); self::assertEquals($text, stream_get_contents($blobValue)); diff --git a/tests/Doctrine/Tests/DBAL/Functional/ConnectionTest.php b/tests/Doctrine/Tests/DBAL/Functional/ConnectionTest.php index e59a9520f29..cc809676d16 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/ConnectionTest.php +++ b/tests/Doctrine/Tests/DBAL/Functional/ConnectionTest.php @@ -24,204 +24,204 @@ protected function tearDown() public function testGetWrappedConnection() { - self::assertInstanceOf('Doctrine\DBAL\Driver\Connection', $this->_conn->getWrappedConnection()); + self::assertInstanceOf('Doctrine\DBAL\Driver\Connection', $this->conn->getWrappedConnection()); } public function testCommitWithRollbackOnlyThrowsException() { - $this->_conn->beginTransaction(); - $this->_conn->setRollbackOnly(); + $this->conn->beginTransaction(); + $this->conn->setRollbackOnly(); $this->expectException(ConnectionException::class); - $this->_conn->commit(); + $this->conn->commit(); } public function testTransactionNestingBehavior() { try { - $this->_conn->beginTransaction(); - self::assertEquals(1, $this->_conn->getTransactionNestingLevel()); + $this->conn->beginTransaction(); + self::assertEquals(1, $this->conn->getTransactionNestingLevel()); try { - $this->_conn->beginTransaction(); - self::assertEquals(2, $this->_conn->getTransactionNestingLevel()); + $this->conn->beginTransaction(); + self::assertEquals(2, $this->conn->getTransactionNestingLevel()); throw new \Exception; - $this->_conn->commit(); // never reached + $this->conn->commit(); // never reached } catch (\Exception $e) { - $this->_conn->rollBack(); - self::assertEquals(1, $this->_conn->getTransactionNestingLevel()); + $this->conn->rollBack(); + self::assertEquals(1, $this->conn->getTransactionNestingLevel()); //no rethrow } - self::assertTrue($this->_conn->isRollbackOnly()); + self::assertTrue($this->conn->isRollbackOnly()); - $this->_conn->commit(); // should throw exception + $this->conn->commit(); // should throw exception $this->fail('Transaction commit after failed nested transaction should fail.'); } catch (ConnectionException $e) { - self::assertEquals(1, $this->_conn->getTransactionNestingLevel()); - $this->_conn->rollBack(); - self::assertEquals(0, $this->_conn->getTransactionNestingLevel()); + self::assertEquals(1, $this->conn->getTransactionNestingLevel()); + $this->conn->rollBack(); + self::assertEquals(0, $this->conn->getTransactionNestingLevel()); } } public function testTransactionNestingBehaviorWithSavepoints() { - if (!$this->_conn->getDatabasePlatform()->supportsSavepoints()) { + if (!$this->conn->getDatabasePlatform()->supportsSavepoints()) { $this->markTestSkipped('This test requires the platform to support savepoints.'); } - $this->_conn->setNestTransactionsWithSavepoints(true); + $this->conn->setNestTransactionsWithSavepoints(true); try { - $this->_conn->beginTransaction(); - self::assertEquals(1, $this->_conn->getTransactionNestingLevel()); + $this->conn->beginTransaction(); + self::assertEquals(1, $this->conn->getTransactionNestingLevel()); try { - $this->_conn->beginTransaction(); - self::assertEquals(2, $this->_conn->getTransactionNestingLevel()); - $this->_conn->beginTransaction(); - self::assertEquals(3, $this->_conn->getTransactionNestingLevel()); - $this->_conn->commit(); - self::assertEquals(2, $this->_conn->getTransactionNestingLevel()); + $this->conn->beginTransaction(); + self::assertEquals(2, $this->conn->getTransactionNestingLevel()); + $this->conn->beginTransaction(); + self::assertEquals(3, $this->conn->getTransactionNestingLevel()); + $this->conn->commit(); + self::assertEquals(2, $this->conn->getTransactionNestingLevel()); throw new \Exception; - $this->_conn->commit(); // never reached + $this->conn->commit(); // never reached } catch (\Exception $e) { - $this->_conn->rollBack(); - self::assertEquals(1, $this->_conn->getTransactionNestingLevel()); + $this->conn->rollBack(); + self::assertEquals(1, $this->conn->getTransactionNestingLevel()); //no rethrow } - self::assertFalse($this->_conn->isRollbackOnly()); + self::assertFalse($this->conn->isRollbackOnly()); try { - $this->_conn->setNestTransactionsWithSavepoints(false); + $this->conn->setNestTransactionsWithSavepoints(false); $this->fail('Should not be able to disable savepoints in usage for nested transactions inside an open transaction.'); } catch (ConnectionException $e) { - self::assertTrue($this->_conn->getNestTransactionsWithSavepoints()); + self::assertTrue($this->conn->getNestTransactionsWithSavepoints()); } - $this->_conn->commit(); // should not throw exception + $this->conn->commit(); // should not throw exception } catch (ConnectionException $e) { $this->fail('Transaction commit after failed nested transaction should not fail when using savepoints.'); - $this->_conn->rollBack(); + $this->conn->rollBack(); } } public function testTransactionNestingBehaviorCantBeChangedInActiveTransaction() { - if (!$this->_conn->getDatabasePlatform()->supportsSavepoints()) { + if (!$this->conn->getDatabasePlatform()->supportsSavepoints()) { $this->markTestSkipped('This test requires the platform to support savepoints.'); } - $this->_conn->beginTransaction(); + $this->conn->beginTransaction(); $this->expectException(ConnectionException::class); - $this->_conn->setNestTransactionsWithSavepoints(true); + $this->conn->setNestTransactionsWithSavepoints(true); } public function testSetNestedTransactionsThroughSavepointsNotSupportedThrowsException() { - if ($this->_conn->getDatabasePlatform()->supportsSavepoints()) { + if ($this->conn->getDatabasePlatform()->supportsSavepoints()) { $this->markTestSkipped('This test requires the platform not to support savepoints.'); } $this->expectException(ConnectionException::class); $this->expectExceptionMessage("Savepoints are not supported by this driver."); - $this->_conn->setNestTransactionsWithSavepoints(true); + $this->conn->setNestTransactionsWithSavepoints(true); } public function testCreateSavepointsNotSupportedThrowsException() { - if ($this->_conn->getDatabasePlatform()->supportsSavepoints()) { + if ($this->conn->getDatabasePlatform()->supportsSavepoints()) { $this->markTestSkipped('This test requires the platform not to support savepoints.'); } $this->expectException(ConnectionException::class); $this->expectExceptionMessage("Savepoints are not supported by this driver."); - $this->_conn->createSavepoint('foo'); + $this->conn->createSavepoint('foo'); } public function testReleaseSavepointsNotSupportedThrowsException() { - if ($this->_conn->getDatabasePlatform()->supportsSavepoints()) { + if ($this->conn->getDatabasePlatform()->supportsSavepoints()) { $this->markTestSkipped('This test requires the platform not to support savepoints.'); } $this->expectException(ConnectionException::class); $this->expectExceptionMessage("Savepoints are not supported by this driver."); - $this->_conn->releaseSavepoint('foo'); + $this->conn->releaseSavepoint('foo'); } public function testRollbackSavepointsNotSupportedThrowsException() { - if ($this->_conn->getDatabasePlatform()->supportsSavepoints()) { + if ($this->conn->getDatabasePlatform()->supportsSavepoints()) { $this->markTestSkipped('This test requires the platform not to support savepoints.'); } $this->expectException(ConnectionException::class); $this->expectExceptionMessage("Savepoints are not supported by this driver."); - $this->_conn->rollbackSavepoint('foo'); + $this->conn->rollbackSavepoint('foo'); } public function testTransactionBehaviorWithRollback() { try { - $this->_conn->beginTransaction(); - self::assertEquals(1, $this->_conn->getTransactionNestingLevel()); + $this->conn->beginTransaction(); + self::assertEquals(1, $this->conn->getTransactionNestingLevel()); throw new \Exception; - $this->_conn->commit(); // never reached + $this->conn->commit(); // never reached } catch (\Exception $e) { - self::assertEquals(1, $this->_conn->getTransactionNestingLevel()); - $this->_conn->rollBack(); - self::assertEquals(0, $this->_conn->getTransactionNestingLevel()); + self::assertEquals(1, $this->conn->getTransactionNestingLevel()); + $this->conn->rollBack(); + self::assertEquals(0, $this->conn->getTransactionNestingLevel()); } } public function testTransactionBehaviour() { try { - $this->_conn->beginTransaction(); - self::assertEquals(1, $this->_conn->getTransactionNestingLevel()); - $this->_conn->commit(); + $this->conn->beginTransaction(); + self::assertEquals(1, $this->conn->getTransactionNestingLevel()); + $this->conn->commit(); } catch (\Exception $e) { - $this->_conn->rollBack(); - self::assertEquals(0, $this->_conn->getTransactionNestingLevel()); + $this->conn->rollBack(); + self::assertEquals(0, $this->conn->getTransactionNestingLevel()); } - self::assertEquals(0, $this->_conn->getTransactionNestingLevel()); + self::assertEquals(0, $this->conn->getTransactionNestingLevel()); } public function testTransactionalWithException() { try { - $this->_conn->transactional(function($conn) { + $this->conn->transactional(function($conn) { /* @var $conn \Doctrine\DBAL\Connection */ $conn->executeQuery($conn->getDatabasePlatform()->getDummySelectSQL()); throw new \RuntimeException("Ooops!"); }); $this->fail('Expected exception'); } catch (\RuntimeException $expected) { - self::assertEquals(0, $this->_conn->getTransactionNestingLevel()); + self::assertEquals(0, $this->conn->getTransactionNestingLevel()); } } public function testTransactionalWithThrowable() { try { - $this->_conn->transactional(function($conn) { + $this->conn->transactional(function($conn) { /* @var $conn \Doctrine\DBAL\Connection */ $conn->executeQuery($conn->getDatabasePlatform()->getDummySelectSQL()); throw new \Error("Ooops!"); }); $this->fail('Expected exception'); } catch (\Error $expected) { - self::assertEquals(0, $this->_conn->getTransactionNestingLevel()); + self::assertEquals(0, $this->conn->getTransactionNestingLevel()); } } public function testTransactional() { - $res = $this->_conn->transactional(function($conn) { + $res = $this->conn->transactional(function($conn) { /* @var $conn \Doctrine\DBAL\Connection */ $conn->executeQuery($conn->getDatabasePlatform()->getDummySelectSQL()); }); @@ -231,7 +231,7 @@ public function testTransactional() public function testTransactionalReturnValue() { - $res = $this->_conn->transactional(function() { + $res = $this->conn->transactional(function() { return 42; }); @@ -244,15 +244,15 @@ public function testTransactionalReturnValue() public function testQuote() { self::assertEquals( - $this->_conn->quote("foo", Type::STRING), - $this->_conn->quote("foo", ParameterType::STRING) + $this->conn->quote("foo", Type::STRING), + $this->conn->quote("foo", ParameterType::STRING) ); } public function testPingDoesTriggersConnect() { - self::assertTrue($this->_conn->ping()); - self::assertTrue($this->_conn->isConnected()); + self::assertTrue($this->conn->ping()); + self::assertTrue($this->conn->isConnected()); } /** @@ -260,17 +260,17 @@ public function testPingDoesTriggersConnect() */ public function testConnectWithoutExplicitDatabaseName() { - if (in_array($this->_conn->getDatabasePlatform()->getName(), array('oracle', 'db2'), true)) { + if (in_array($this->conn->getDatabasePlatform()->getName(), array('oracle', 'db2'), true)) { $this->markTestSkipped('Platform does not support connecting without database name.'); } - $params = $this->_conn->getParams(); + $params = $this->conn->getParams(); unset($params['dbname']); $connection = DriverManager::getConnection( $params, - $this->_conn->getConfiguration(), - $this->_conn->getEventManager() + $this->conn->getConfiguration(), + $this->conn->getEventManager() ); self::assertTrue($connection->connect()); @@ -283,17 +283,17 @@ public function testConnectWithoutExplicitDatabaseName() */ public function testDeterminesDatabasePlatformWhenConnectingToNonExistentDatabase() { - if (in_array($this->_conn->getDatabasePlatform()->getName(), ['oracle', 'db2'], true)) { + if (in_array($this->conn->getDatabasePlatform()->getName(), ['oracle', 'db2'], true)) { $this->markTestSkipped('Platform does not support connecting without database name.'); } - $params = $this->_conn->getParams(); + $params = $this->conn->getParams(); $params['dbname'] = 'foo_bar'; $connection = DriverManager::getConnection( $params, - $this->_conn->getConfiguration(), - $this->_conn->getEventManager() + $this->conn->getConfiguration(), + $this->conn->getEventManager() ); self::assertInstanceOf(AbstractPlatform::class, $connection->getDatabasePlatform()); diff --git a/tests/Doctrine/Tests/DBAL/Functional/DataAccessTest.php b/tests/Doctrine/Tests/DBAL/Functional/DataAccessTest.php index e465327a2e9..33b1b5008ea 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/DataAccessTest.php +++ b/tests/Doctrine/Tests/DBAL/Functional/DataAccessTest.php @@ -24,10 +24,10 @@ protected function setUp() $table->addColumn('test_datetime', 'datetime', array('notnull' => false)); $table->setPrimaryKey(array('test_int')); - $sm = $this->_conn->getSchemaManager(); + $sm = $this->conn->getSchemaManager(); $sm->createTable($table); - $this->_conn->insert('fetch_table', array('test_int' => 1, 'test_string' => 'foo', 'test_datetime' => '2010-01-01 10:10:10')); + $this->conn->insert('fetch_table', array('test_int' => 1, 'test_string' => 'foo', 'test_datetime' => '2010-01-01 10:10:10')); self::$generated = true; } } @@ -35,7 +35,7 @@ protected function setUp() public function testPrepareWithBindValue() { $sql = "SELECT test_int, test_string FROM fetch_table WHERE test_int = ? AND test_string = ?"; - $stmt = $this->_conn->prepare($sql); + $stmt = $this->conn->prepare($sql); self::assertInstanceOf('Doctrine\DBAL\Statement', $stmt); $stmt->bindValue(1, 1); @@ -53,7 +53,7 @@ public function testPrepareWithBindParam() $paramStr = 'foo'; $sql = "SELECT test_int, test_string FROM fetch_table WHERE test_int = ? AND test_string = ?"; - $stmt = $this->_conn->prepare($sql); + $stmt = $this->conn->prepare($sql); self::assertInstanceOf('Doctrine\DBAL\Statement', $stmt); $stmt->bindParam(1, $paramInt); @@ -71,7 +71,7 @@ public function testPrepareWithFetchAll() $paramStr = 'foo'; $sql = "SELECT test_int, test_string FROM fetch_table WHERE test_int = ? AND test_string = ?"; - $stmt = $this->_conn->prepare($sql); + $stmt = $this->conn->prepare($sql); self::assertInstanceOf('Doctrine\DBAL\Statement', $stmt); $stmt->bindParam(1, $paramInt); @@ -92,7 +92,7 @@ public function testPrepareWithFetchAllBoth() $paramStr = 'foo'; $sql = "SELECT test_int, test_string FROM fetch_table WHERE test_int = ? AND test_string = ?"; - $stmt = $this->_conn->prepare($sql); + $stmt = $this->conn->prepare($sql); self::assertInstanceOf('Doctrine\DBAL\Statement', $stmt); $stmt->bindParam(1, $paramInt); @@ -110,7 +110,7 @@ public function testPrepareWithFetchColumn() $paramStr = 'foo'; $sql = "SELECT test_int FROM fetch_table WHERE test_int = ? AND test_string = ?"; - $stmt = $this->_conn->prepare($sql); + $stmt = $this->conn->prepare($sql); self::assertInstanceOf('Doctrine\DBAL\Statement', $stmt); $stmt->bindParam(1, $paramInt); @@ -127,7 +127,7 @@ public function testPrepareWithIterator() $paramStr = 'foo'; $sql = "SELECT test_int, test_string FROM fetch_table WHERE test_int = ? AND test_string = ?"; - $stmt = $this->_conn->prepare($sql); + $stmt = $this->conn->prepare($sql); self::assertInstanceOf('Doctrine\DBAL\Statement', $stmt); $stmt->bindParam(1, $paramInt); @@ -149,9 +149,9 @@ public function testPrepareWithQuoted() $paramInt = 1; $paramStr = 'foo'; - $sql = "SELECT test_int, test_string FROM " . $this->_conn->quoteIdentifier($table) . " ". - "WHERE test_int = " . $this->_conn->quote($paramInt) . " AND test_string = " . $this->_conn->quote($paramStr); - $stmt = $this->_conn->prepare($sql); + $sql = "SELECT test_int, test_string FROM " . $this->conn->quoteIdentifier($table) . " ". + "WHERE test_int = " . $this->conn->quote($paramInt) . " AND test_string = " . $this->conn->quote($paramStr); + $stmt = $this->conn->prepare($sql); self::assertInstanceOf('Doctrine\DBAL\Statement', $stmt); } @@ -161,7 +161,7 @@ public function testPrepareWithExecuteParams() $paramStr = 'foo'; $sql = "SELECT test_int, test_string FROM fetch_table WHERE test_int = ? AND test_string = ?"; - $stmt = $this->_conn->prepare($sql); + $stmt = $this->conn->prepare($sql); self::assertInstanceOf('Doctrine\DBAL\Statement', $stmt); $stmt->execute(array($paramInt, $paramStr)); @@ -174,7 +174,7 @@ public function testPrepareWithExecuteParams() public function testFetchAll() { $sql = "SELECT test_int, test_string FROM fetch_table WHERE test_int = ? AND test_string = ?"; - $data = $this->_conn->fetchAll($sql, array(1, 'foo')); + $data = $this->conn->fetchAll($sql, array(1, 'foo')); self::assertCount(1, $data); @@ -195,7 +195,7 @@ public function testFetchAllWithTypes() $datetime = new \DateTime($datetimeString); $sql = "SELECT test_int, test_datetime FROM fetch_table WHERE test_int = ? AND test_datetime = ?"; - $data = $this->_conn->fetchAll($sql, array(1, $datetime), array(ParameterType::STRING, Type::DATETIME)); + $data = $this->conn->fetchAll($sql, array(1, $datetime), array(ParameterType::STRING, Type::DATETIME)); self::assertCount(1, $data); @@ -213,21 +213,21 @@ public function testFetchAllWithTypes() */ public function testFetchAllWithMissingTypes() { - if ($this->_conn->getDriver() instanceof \Doctrine\DBAL\Driver\Mysqli\Driver || - $this->_conn->getDriver() instanceof \Doctrine\DBAL\Driver\SQLSrv\Driver) { + if ($this->conn->getDriver() instanceof \Doctrine\DBAL\Driver\Mysqli\Driver || + $this->conn->getDriver() instanceof \Doctrine\DBAL\Driver\SQLSrv\Driver) { $this->markTestSkipped('mysqli and sqlsrv actually supports this'); } $datetimeString = '2010-01-01 10:10:10'; $datetime = new \DateTime($datetimeString); $sql = "SELECT test_int, test_datetime FROM fetch_table WHERE test_int = ? AND test_datetime = ?"; - $data = $this->_conn->fetchAll($sql, array(1, $datetime)); + $data = $this->conn->fetchAll($sql, array(1, $datetime)); } public function testFetchBoth() { $sql = "SELECT test_int, test_string FROM fetch_table WHERE test_int = ? AND test_string = ?"; - $row = $this->_conn->executeQuery($sql, array(1, 'foo'))->fetch(FetchMode::MIXED); + $row = $this->conn->executeQuery($sql, array(1, 'foo'))->fetch(FetchMode::MIXED); self::assertNotFalse($row); @@ -242,14 +242,14 @@ public function testFetchBoth() public function testFetchNoResult() { self::assertFalse( - $this->_conn->executeQuery('SELECT test_int FROM fetch_table WHERE test_int = ?', [-1])->fetch() + $this->conn->executeQuery('SELECT test_int FROM fetch_table WHERE test_int = ?', [-1])->fetch() ); } public function testFetchAssoc() { $sql = "SELECT test_int, test_string FROM fetch_table WHERE test_int = ? AND test_string = ?"; - $row = $this->_conn->fetchAssoc($sql, array(1, 'foo')); + $row = $this->conn->fetchAssoc($sql, array(1, 'foo')); self::assertNotFalse($row); @@ -265,7 +265,7 @@ public function testFetchAssocWithTypes() $datetime = new \DateTime($datetimeString); $sql = "SELECT test_int, test_datetime FROM fetch_table WHERE test_int = ? AND test_datetime = ?"; - $row = $this->_conn->fetchAssoc($sql, array(1, $datetime), array(ParameterType::STRING, Type::DATETIME)); + $row = $this->conn->fetchAssoc($sql, array(1, $datetime), array(ParameterType::STRING, Type::DATETIME)); self::assertNotFalse($row); @@ -280,21 +280,21 @@ public function testFetchAssocWithTypes() */ public function testFetchAssocWithMissingTypes() { - if ($this->_conn->getDriver() instanceof \Doctrine\DBAL\Driver\Mysqli\Driver || - $this->_conn->getDriver() instanceof \Doctrine\DBAL\Driver\SQLSrv\Driver) { + if ($this->conn->getDriver() instanceof \Doctrine\DBAL\Driver\Mysqli\Driver || + $this->conn->getDriver() instanceof \Doctrine\DBAL\Driver\SQLSrv\Driver) { $this->markTestSkipped('mysqli and sqlsrv actually supports this'); } $datetimeString = '2010-01-01 10:10:10'; $datetime = new \DateTime($datetimeString); $sql = "SELECT test_int, test_datetime FROM fetch_table WHERE test_int = ? AND test_datetime = ?"; - $row = $this->_conn->fetchAssoc($sql, array(1, $datetime)); + $row = $this->conn->fetchAssoc($sql, array(1, $datetime)); } public function testFetchArray() { $sql = "SELECT test_int, test_string FROM fetch_table WHERE test_int = ? AND test_string = ?"; - $row = $this->_conn->fetchArray($sql, array(1, 'foo')); + $row = $this->conn->fetchArray($sql, array(1, 'foo')); self::assertEquals(1, $row[0]); self::assertEquals('foo', $row[1]); @@ -306,7 +306,7 @@ public function testFetchArrayWithTypes() $datetime = new \DateTime($datetimeString); $sql = "SELECT test_int, test_datetime FROM fetch_table WHERE test_int = ? AND test_datetime = ?"; - $row = $this->_conn->fetchArray($sql, array(1, $datetime), array(ParameterType::STRING, Type::DATETIME)); + $row = $this->conn->fetchArray($sql, array(1, $datetime), array(ParameterType::STRING, Type::DATETIME)); self::assertNotFalse($row); @@ -321,26 +321,26 @@ public function testFetchArrayWithTypes() */ public function testFetchArrayWithMissingTypes() { - if ($this->_conn->getDriver() instanceof \Doctrine\DBAL\Driver\Mysqli\Driver || - $this->_conn->getDriver() instanceof \Doctrine\DBAL\Driver\SQLSrv\Driver) { + if ($this->conn->getDriver() instanceof \Doctrine\DBAL\Driver\Mysqli\Driver || + $this->conn->getDriver() instanceof \Doctrine\DBAL\Driver\SQLSrv\Driver) { $this->markTestSkipped('mysqli and sqlsrv actually supports this'); } $datetimeString = '2010-01-01 10:10:10'; $datetime = new \DateTime($datetimeString); $sql = "SELECT test_int, test_datetime FROM fetch_table WHERE test_int = ? AND test_datetime = ?"; - $row = $this->_conn->fetchArray($sql, array(1, $datetime)); + $row = $this->conn->fetchArray($sql, array(1, $datetime)); } public function testFetchColumn() { $sql = "SELECT test_int, test_string FROM fetch_table WHERE test_int = ? AND test_string = ?"; - $testInt = $this->_conn->fetchColumn($sql, array(1, 'foo'), 0); + $testInt = $this->conn->fetchColumn($sql, array(1, 'foo'), 0); self::assertEquals(1, $testInt); $sql = "SELECT test_int, test_string FROM fetch_table WHERE test_int = ? AND test_string = ?"; - $testString = $this->_conn->fetchColumn($sql, array(1, 'foo'), 1); + $testString = $this->conn->fetchColumn($sql, array(1, 'foo'), 1); self::assertEquals('foo', $testString); } @@ -351,7 +351,7 @@ public function testFetchColumnWithTypes() $datetime = new \DateTime($datetimeString); $sql = "SELECT test_int, test_datetime FROM fetch_table WHERE test_int = ? AND test_datetime = ?"; - $column = $this->_conn->fetchColumn( + $column = $this->conn->fetchColumn( $sql, array(1, $datetime), 1, @@ -368,15 +368,15 @@ public function testFetchColumnWithTypes() */ public function testFetchColumnWithMissingTypes() { - if ($this->_conn->getDriver() instanceof \Doctrine\DBAL\Driver\Mysqli\Driver || - $this->_conn->getDriver() instanceof \Doctrine\DBAL\Driver\SQLSrv\Driver) { + if ($this->conn->getDriver() instanceof \Doctrine\DBAL\Driver\Mysqli\Driver || + $this->conn->getDriver() instanceof \Doctrine\DBAL\Driver\SQLSrv\Driver) { $this->markTestSkipped('mysqli and sqlsrv actually supports this'); } $datetimeString = '2010-01-01 10:10:10'; $datetime = new \DateTime($datetimeString); $sql = "SELECT test_int, test_datetime FROM fetch_table WHERE test_int = ? AND test_datetime = ?"; - $column = $this->_conn->fetchColumn($sql, array(1, $datetime), 1); + $column = $this->conn->fetchColumn($sql, array(1, $datetime), 1); } /** @@ -385,7 +385,7 @@ public function testFetchColumnWithMissingTypes() public function testExecuteQueryBindDateTimeType() { $sql = 'SELECT count(*) AS c FROM fetch_table WHERE test_datetime = ?'; - $stmt = $this->_conn->executeQuery($sql, + $stmt = $this->conn->executeQuery($sql, array(1 => new \DateTime('2010-01-01 10:10:10')), array(1 => Type::DATETIME) ); @@ -401,7 +401,7 @@ public function testExecuteUpdateBindDateTimeType() $datetime = new \DateTime('2010-02-02 20:20:20'); $sql = 'INSERT INTO fetch_table (test_int, test_string, test_datetime) VALUES (?, ?, ?)'; - $affectedRows = $this->_conn->executeUpdate($sql, + $affectedRows = $this->conn->executeUpdate($sql, array( 1 => 50, 2 => 'foo', @@ -415,7 +415,7 @@ public function testExecuteUpdateBindDateTimeType() ); self::assertEquals(1, $affectedRows); - self::assertEquals(1, $this->_conn->executeQuery( + self::assertEquals(1, $this->conn->executeQuery( 'SELECT count(*) AS c FROM fetch_table WHERE test_datetime = ?', array(1 => $datetime), array(1 => Type::DATETIME) @@ -428,7 +428,7 @@ public function testExecuteUpdateBindDateTimeType() public function testPrepareQueryBindValueDateTimeType() { $sql = 'SELECT count(*) AS c FROM fetch_table WHERE test_datetime = ?'; - $stmt = $this->_conn->prepare($sql); + $stmt = $this->conn->prepare($sql); $stmt->bindValue(1, new \DateTime('2010-01-01 10:10:10'), Type::DATETIME); $stmt->execute(); @@ -441,17 +441,17 @@ public function testPrepareQueryBindValueDateTimeType() public function testNativeArrayListSupport() { for ($i = 100; $i < 110; $i++) { - $this->_conn->insert('fetch_table', array('test_int' => $i, 'test_string' => 'foo' . $i, 'test_datetime' => '2010-01-01 10:10:10')); + $this->conn->insert('fetch_table', array('test_int' => $i, 'test_string' => 'foo' . $i, 'test_datetime' => '2010-01-01 10:10:10')); } - $stmt = $this->_conn->executeQuery('SELECT test_int FROM fetch_table WHERE test_int IN (?)', + $stmt = $this->conn->executeQuery('SELECT test_int FROM fetch_table WHERE test_int IN (?)', array(array(100, 101, 102, 103, 104)), array(Connection::PARAM_INT_ARRAY)); $data = $stmt->fetchAll(FetchMode::NUMERIC); self::assertCount(5, $data); self::assertEquals(array(array(100), array(101), array(102), array(103), array(104)), $data); - $stmt = $this->_conn->executeQuery('SELECT test_int FROM fetch_table WHERE test_string IN (?)', + $stmt = $this->conn->executeQuery('SELECT test_int FROM fetch_table WHERE test_string IN (?)', array(array('foo100', 'foo101', 'foo102', 'foo103', 'foo104')), array(Connection::PARAM_STR_ARRAY)); $data = $stmt->fetchAll(FetchMode::NUMERIC); @@ -465,10 +465,10 @@ public function testNativeArrayListSupport() public function testTrimExpression($value, $position, $char, $expectedResult) { $sql = 'SELECT ' . - $this->_conn->getDatabasePlatform()->getTrimExpression($value, $position, $char) . ' AS trimmed ' . + $this->conn->getDatabasePlatform()->getTrimExpression($value, $position, $char) . ' AS trimmed ' . 'FROM fetch_table'; - $row = $this->_conn->fetchAssoc($sql); + $row = $this->conn->fetchAssoc($sql); $row = array_change_key_case($row, CASE_LOWER); self::assertEquals($expectedResult, $row['trimmed']); @@ -521,7 +521,7 @@ public function getTrimExpressionData() */ public function testDateArithmetics() { - $p = $this->_conn->getDatabasePlatform(); + $p = $this->conn->getDatabasePlatform(); $sql = 'SELECT '; $sql .= $p->getDateDiffExpression('test_datetime', $p->getCurrentTimestampSQL()) .' AS diff, '; $sql .= $p->getDateAddSecondsExpression('test_datetime', 1) .' AS add_seconds, '; @@ -542,7 +542,7 @@ public function testDateArithmetics() $sql .= $p->getDateSubYearsExpression('test_datetime', 6) .' AS sub_years '; $sql .= 'FROM fetch_table'; - $row = $this->_conn->fetchAssoc($sql); + $row = $this->conn->fetchAssoc($sql); $row = array_change_key_case($row, CASE_LOWER); $diff = (strtotime('2010-01-01') - strtotime(date('Y-m-d'))) / 3600 / 24; @@ -567,7 +567,7 @@ public function testDateArithmetics() public function testLocateExpression() { - $platform = $this->_conn->getDatabasePlatform(); + $platform = $this->conn->getDatabasePlatform(); $sql = 'SELECT '; $sql .= $platform->getLocateExpression('test_string', "'oo'") .' AS locate1, '; @@ -581,7 +581,7 @@ public function testLocateExpression() $sql .= $platform->getLocateExpression('test_string', "'oo'", 3) .' AS locate9 '; $sql .= 'FROM fetch_table'; - $row = $this->_conn->fetchAssoc($sql); + $row = $this->conn->fetchAssoc($sql); $row = array_change_key_case($row, CASE_LOWER); self::assertEquals(2, $row['locate1']); @@ -597,8 +597,8 @@ public function testLocateExpression() public function testQuoteSQLInjection() { - $sql = "SELECT * FROM fetch_table WHERE test_string = " . $this->_conn->quote("bar' OR '1'='1"); - $rows = $this->_conn->fetchAll($sql); + $sql = "SELECT * FROM fetch_table WHERE test_string = " . $this->conn->quote("bar' OR '1'='1"); + $rows = $this->conn->fetchAll($sql); self::assertCount(0, $rows, "no result should be returned, otherwise SQL injection is possible"); } @@ -608,8 +608,8 @@ public function testQuoteSQLInjection() */ public function testBitComparisonExpressionSupport() { - $this->_conn->exec('DELETE FROM fetch_table'); - $platform = $this->_conn->getDatabasePlatform(); + $this->conn->exec('DELETE FROM fetch_table'); + $platform = $this->conn->getDatabasePlatform(); $bitmap = array(); for ($i = 2; $i < 9; $i = $i + 2) { @@ -617,7 +617,7 @@ public function testBitComparisonExpressionSupport() 'bit_or' => ($i | 2), 'bit_and' => ($i & 2) ); - $this->_conn->insert('fetch_table', array( + $this->conn->insert('fetch_table', array( 'test_int' => $i, 'test_string' => json_encode($bitmap[$i]), 'test_datetime' => '2010-01-01 10:10:10' @@ -631,7 +631,7 @@ public function testBitComparisonExpressionSupport() $sql[] = $platform->getBitAndComparisonExpression('test_int', 2) . ' AS bit_and '; $sql[] = 'FROM fetch_table'; - $stmt = $this->_conn->executeQuery(implode(PHP_EOL, $sql)); + $stmt = $this->conn->executeQuery(implode(PHP_EOL, $sql)); $data = $stmt->fetchAll(FetchMode::ASSOCIATIVE); @@ -657,7 +657,7 @@ public function testBitComparisonExpressionSupport() public function testSetDefaultFetchMode() { - $stmt = $this->_conn->query("SELECT * FROM fetch_table"); + $stmt = $this->conn->query("SELECT * FROM fetch_table"); $stmt->setFetchMode(FetchMode::NUMERIC); $row = array_keys($stmt->fetch()); @@ -672,7 +672,7 @@ public function testFetchAllStyleObject() $this->setupFixture(); $sql = 'SELECT test_int, test_string, test_datetime FROM fetch_table'; - $stmt = $this->_conn->prepare($sql); + $stmt = $this->conn->prepare($sql); $stmt->execute(); @@ -704,7 +704,7 @@ public function testFetchAllSupportFetchClass() $this->setupFixture(); $sql = "SELECT test_int, test_string, test_datetime FROM fetch_table"; - $stmt = $this->_conn->prepare($sql); + $stmt = $this->conn->prepare($sql); $stmt->execute(); $results = $stmt->fetchAll( @@ -726,13 +726,13 @@ public function testFetchAllSupportFetchClass() public function testFetchAllStyleColumn() { $sql = "DELETE FROM fetch_table"; - $this->_conn->executeUpdate($sql); + $this->conn->executeUpdate($sql); - $this->_conn->insert('fetch_table', array('test_int' => 1, 'test_string' => 'foo')); - $this->_conn->insert('fetch_table', array('test_int' => 10, 'test_string' => 'foo')); + $this->conn->insert('fetch_table', array('test_int' => 1, 'test_string' => 'foo')); + $this->conn->insert('fetch_table', array('test_int' => 10, 'test_string' => 'foo')); $sql = "SELECT test_int FROM fetch_table"; - $rows = $this->_conn->query($sql)->fetchAll(FetchMode::COLUMN); + $rows = $this->conn->query($sql)->fetchAll(FetchMode::COLUMN); self::assertEquals(array(1, 10), $rows); } @@ -746,7 +746,7 @@ public function testSetFetchModeClassFetchAll() $this->setupFixture(); $sql = "SELECT * FROM fetch_table"; - $stmt = $this->_conn->query($sql); + $stmt = $this->conn->query($sql); $stmt->setFetchMode(FetchMode::CUSTOM_OBJECT, __NAMESPACE__ . '\\MyFetchClass'); $results = $stmt->fetchAll(); @@ -768,7 +768,7 @@ public function testSetFetchModeClassFetch() $this->setupFixture(); $sql = "SELECT * FROM fetch_table"; - $stmt = $this->_conn->query($sql); + $stmt = $this->conn->query($sql); $stmt->setFetchMode(FetchMode::CUSTOM_OBJECT, __NAMESPACE__ . '\\MyFetchClass'); $results = array(); @@ -789,11 +789,11 @@ public function testSetFetchModeClassFetch() */ public function testEmptyFetchColumnReturnsFalse() { - $this->_conn->beginTransaction(); - $this->_conn->exec('DELETE FROM fetch_table'); - self::assertFalse($this->_conn->fetchColumn('SELECT test_int FROM fetch_table')); - self::assertFalse($this->_conn->query('SELECT test_int FROM fetch_table')->fetchColumn()); - $this->_conn->rollBack(); + $this->conn->beginTransaction(); + $this->conn->exec('DELETE FROM fetch_table'); + self::assertFalse($this->conn->fetchColumn('SELECT test_int FROM fetch_table')); + self::assertFalse($this->conn->query('SELECT test_int FROM fetch_table')->fetchColumn()); + $this->conn->rollBack(); } /** @@ -802,7 +802,7 @@ public function testEmptyFetchColumnReturnsFalse() public function testSetFetchModeOnDbalStatement() { $sql = "SELECT test_int, test_string FROM fetch_table WHERE test_int = ? AND test_string = ?"; - $stmt = $this->_conn->executeQuery($sql, array(1, "foo")); + $stmt = $this->conn->executeQuery($sql, array(1, "foo")); $stmt->setFetchMode(FetchMode::NUMERIC); $row = $stmt->fetch(); @@ -818,7 +818,7 @@ public function testSetFetchModeOnDbalStatement() public function testEmptyParameters() { $sql = "SELECT * FROM fetch_table WHERE test_int IN (?)"; - $stmt = $this->_conn->executeQuery($sql, array(array()), array(\Doctrine\DBAL\Connection::PARAM_INT_ARRAY)); + $stmt = $this->conn->executeQuery($sql, array(array()), array(\Doctrine\DBAL\Connection::PARAM_INT_ARRAY)); $rows = $stmt->fetchAll(); self::assertEquals(array(), $rows); @@ -829,13 +829,13 @@ public function testEmptyParameters() */ public function testFetchColumnNullValue() { - $this->_conn->executeUpdate( + $this->conn->executeUpdate( 'INSERT INTO fetch_table (test_int, test_string) VALUES (?, ?)', array(2, 'foo') ); self::assertNull( - $this->_conn->fetchColumn('SELECT test_datetime FROM fetch_table WHERE test_int = ?', array(2)) + $this->conn->fetchColumn('SELECT test_datetime FROM fetch_table WHERE test_int = ?', array(2)) ); } @@ -844,14 +844,14 @@ public function testFetchColumnNullValue() */ public function testFetchColumnNonExistingIndex() { - if ($this->_conn->getDriver()->getName() === 'pdo_sqlsrv') { + if ($this->conn->getDriver()->getName() === 'pdo_sqlsrv') { $this->markTestSkipped( 'Test does not work for pdo_sqlsrv driver as it throws a fatal error for a non-existing column index.' ); } self::assertNull( - $this->_conn->fetchColumn('SELECT test_int FROM fetch_table WHERE test_int = ?', array(1), 1) + $this->conn->fetchColumn('SELECT test_int FROM fetch_table WHERE test_int = ?', array(1), 1) ); } @@ -861,14 +861,14 @@ public function testFetchColumnNonExistingIndex() public function testFetchColumnNoResult() { self::assertFalse( - $this->_conn->fetchColumn('SELECT test_int FROM fetch_table WHERE test_int = ?', array(-1)) + $this->conn->fetchColumn('SELECT test_int FROM fetch_table WHERE test_int = ?', array(-1)) ); } private function setupFixture() { - $this->_conn->exec('DELETE FROM fetch_table'); - $this->_conn->insert('fetch_table', array( + $this->conn->exec('DELETE FROM fetch_table'); + $this->conn->insert('fetch_table', array( 'test_int' => 1, 'test_string' => 'foo', 'test_datetime' => '2010-01-01 10:10:10' @@ -880,7 +880,7 @@ private function skipOci8AndMysqli() if (isset($GLOBALS['db_type']) && $GLOBALS['db_type'] == "oci8") { $this->markTestSkipped("Not supported by OCI8"); } - if ('mysqli' == $this->_conn->getDriver()->getName()) { + if ('mysqli' == $this->conn->getDriver()->getName()) { $this->markTestSkipped('Mysqli driver dont support this feature.'); } } diff --git a/tests/Doctrine/Tests/DBAL/Functional/Driver/AbstractDriverTest.php b/tests/Doctrine/Tests/DBAL/Functional/Driver/AbstractDriverTest.php index 4857e81a5e1..67af2450b84 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/Driver/AbstractDriverTest.php +++ b/tests/Doctrine/Tests/DBAL/Functional/Driver/AbstractDriverTest.php @@ -26,7 +26,7 @@ protected function setUp() */ public function testConnectsWithoutDatabaseNameParameter() { - $params = $this->_conn->getParams(); + $params = $this->conn->getParams(); unset($params['dbname']); $user = $params['user'] ?? null; @@ -42,14 +42,14 @@ public function testConnectsWithoutDatabaseNameParameter() */ public function testReturnsDatabaseNameWithoutDatabaseNameParameter() { - $params = $this->_conn->getParams(); + $params = $this->conn->getParams(); unset($params['dbname']); $connection = new Connection( $params, - $this->_conn->getDriver(), - $this->_conn->getConfiguration(), - $this->_conn->getEventManager() + $this->conn->getDriver(), + $this->conn->getConfiguration(), + $this->conn->getEventManager() ); self::assertSame( diff --git a/tests/Doctrine/Tests/DBAL/Functional/Driver/IBMDB2/DB2DriverTest.php b/tests/Doctrine/Tests/DBAL/Functional/Driver/IBMDB2/DB2DriverTest.php index f345e88d92c..fd289f4f200 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/Driver/IBMDB2/DB2DriverTest.php +++ b/tests/Doctrine/Tests/DBAL/Functional/Driver/IBMDB2/DB2DriverTest.php @@ -15,7 +15,7 @@ protected function setUp() parent::setUp(); - if (! $this->_conn->getDriver() instanceof DB2Driver) { + if (! $this->conn->getDriver() instanceof DB2Driver) { $this->markTestSkipped('ibm_db2 only test.'); } } diff --git a/tests/Doctrine/Tests/DBAL/Functional/Driver/IBMDB2/DB2StatementTest.php b/tests/Doctrine/Tests/DBAL/Functional/Driver/IBMDB2/DB2StatementTest.php index c915ef7723f..45c5164d2bb 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/Driver/IBMDB2/DB2StatementTest.php +++ b/tests/Doctrine/Tests/DBAL/Functional/Driver/IBMDB2/DB2StatementTest.php @@ -18,14 +18,14 @@ protected function setUp() parent::setUp(); - if ( ! $this->_conn->getDriver() instanceof DB2Driver) { + if ( ! $this->conn->getDriver() instanceof DB2Driver) { $this->markTestSkipped('ibm_db2 only test.'); } } public function testExecutionErrorsAreNotSuppressed() { - $stmt = $this->_conn->prepare('SELECT * FROM SYSIBM.SYSDUMMY1 WHERE \'foo\' = ?'); + $stmt = $this->conn->prepare('SELECT * FROM SYSIBM.SYSDUMMY1 WHERE \'foo\' = ?'); // unwrap the statement to prevent the wrapper from handling the PHPUnit-originated exception $wrappedStmt = $stmt->getWrappedStatement(); diff --git a/tests/Doctrine/Tests/DBAL/Functional/Driver/Mysqli/ConnectionTest.php b/tests/Doctrine/Tests/DBAL/Functional/Driver/Mysqli/ConnectionTest.php index a320aca3fd2..7d235ffe330 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/Driver/Mysqli/ConnectionTest.php +++ b/tests/Doctrine/Tests/DBAL/Functional/Driver/Mysqli/ConnectionTest.php @@ -11,7 +11,7 @@ protected function setUp() parent::setUp(); - if ( !($this->_conn->getDriver() instanceof \Doctrine\DBAL\Driver\Mysqli\Driver)) { + if ( !($this->conn->getDriver() instanceof \Doctrine\DBAL\Driver\Mysqli\Driver)) { $this->markTestSkipped('MySQLi only test.'); } } diff --git a/tests/Doctrine/Tests/DBAL/Functional/Driver/Mysqli/DriverTest.php b/tests/Doctrine/Tests/DBAL/Functional/Driver/Mysqli/DriverTest.php index 3c56fbec79f..5db2431453b 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/Driver/Mysqli/DriverTest.php +++ b/tests/Doctrine/Tests/DBAL/Functional/Driver/Mysqli/DriverTest.php @@ -15,7 +15,7 @@ protected function setUp() parent::setUp(); - if (! $this->_conn->getDriver() instanceof Driver) { + if (! $this->conn->getDriver() instanceof Driver) { $this->markTestSkipped('MySQLi only test.'); } } diff --git a/tests/Doctrine/Tests/DBAL/Functional/Driver/OCI8/DriverTest.php b/tests/Doctrine/Tests/DBAL/Functional/Driver/OCI8/DriverTest.php index 000c8140dd8..f626c113929 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/Driver/OCI8/DriverTest.php +++ b/tests/Doctrine/Tests/DBAL/Functional/Driver/OCI8/DriverTest.php @@ -15,7 +15,7 @@ protected function setUp() parent::setUp(); - if (! $this->_conn->getDriver() instanceof Driver) { + if (! $this->conn->getDriver() instanceof Driver) { $this->markTestSkipped('oci8 only test.'); } } diff --git a/tests/Doctrine/Tests/DBAL/Functional/Driver/OCI8/OCI8ConnectionTest.php b/tests/Doctrine/Tests/DBAL/Functional/Driver/OCI8/OCI8ConnectionTest.php index 3c41e51a12e..2370bd32cfa 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/Driver/OCI8/OCI8ConnectionTest.php +++ b/tests/Doctrine/Tests/DBAL/Functional/Driver/OCI8/OCI8ConnectionTest.php @@ -21,11 +21,11 @@ protected function setUp() parent::setUp(); - if (! $this->_conn->getDriver() instanceof Driver) { + if (! $this->conn->getDriver() instanceof Driver) { $this->markTestSkipped('oci8 only test.'); } - $this->driverConnection = $this->_conn->getWrappedConnection(); + $this->driverConnection = $this->conn->getWrappedConnection(); } /** @@ -33,8 +33,8 @@ protected function setUp() */ public function testLastInsertIdAcceptsFqn() { - $platform = $this->_conn->getDatabasePlatform(); - $schemaManager = $this->_conn->getSchemaManager(); + $platform = $this->conn->getDatabasePlatform(); + $schemaManager = $this->conn->getSchemaManager(); $table = new Table('DBAL2595'); $table->addColumn('id', 'integer', array('autoincrement' => true)); @@ -42,9 +42,9 @@ public function testLastInsertIdAcceptsFqn() $schemaManager->dropAndCreateTable($table); - $this->_conn->executeUpdate('INSERT INTO DBAL2595 (foo) VALUES (1)'); + $this->conn->executeUpdate('INSERT INTO DBAL2595 (foo) VALUES (1)'); - $schema = $this->_conn->getDatabase(); + $schema = $this->conn->getDatabase(); $sequence = $platform->getIdentitySequenceName($schema . '.DBAL2595', 'id'); self::assertSame(1, $this->driverConnection->lastInsertId($sequence)); diff --git a/tests/Doctrine/Tests/DBAL/Functional/Driver/OCI8/StatementTest.php b/tests/Doctrine/Tests/DBAL/Functional/Driver/OCI8/StatementTest.php index 9de812f7358..13ad6c94a90 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/Driver/OCI8/StatementTest.php +++ b/tests/Doctrine/Tests/DBAL/Functional/Driver/OCI8/StatementTest.php @@ -15,7 +15,7 @@ protected function setUp() parent::setUp(); - if (! $this->_conn->getDriver() instanceof Driver) { + if (! $this->conn->getDriver() instanceof Driver) { $this->markTestSkipped('oci8 only test.'); } } @@ -27,7 +27,7 @@ public function testQueryConversion($query, array $params, array $expected) { self::assertEquals( $expected, - $this->_conn->executeQuery($query, $params)->fetch() + $this->conn->executeQuery($query, $params)->fetch() ); } diff --git a/tests/Doctrine/Tests/DBAL/Functional/Driver/PDOConnectionTest.php b/tests/Doctrine/Tests/DBAL/Functional/Driver/PDOConnectionTest.php index 558bbdd7f27..26d672107dd 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/Driver/PDOConnectionTest.php +++ b/tests/Doctrine/Tests/DBAL/Functional/Driver/PDOConnectionTest.php @@ -22,7 +22,7 @@ protected function setUp() parent::setUp(); - $this->driverConnection = $this->_conn->getWrappedConnection(); + $this->driverConnection = $this->conn->getWrappedConnection(); if ( ! $this->driverConnection instanceof PDOConnection) { $this->markTestSkipped('PDO connection only test.'); @@ -64,7 +64,7 @@ public function testThrowsWrappedExceptionOnExec() */ public function testThrowsWrappedExceptionOnPrepare() { - if ($this->_conn->getDriver()->getName() === 'pdo_sqlsrv') { + if ($this->conn->getDriver()->getName() === 'pdo_sqlsrv') { $this->markTestSkipped('pdo_sqlsrv does not allow setting PDO::ATTR_EMULATE_PREPARES at connection level.'); } @@ -82,7 +82,7 @@ public function testThrowsWrappedExceptionOnPrepare() sprintf( 'The PDO adapter %s does not check the query to be prepared server-side, ' . 'so no assertions can be made.', - $this->_conn->getDriver()->getName() + $this->conn->getDriver()->getName() ) ); } diff --git a/tests/Doctrine/Tests/DBAL/Functional/Driver/PDOMySql/DriverTest.php b/tests/Doctrine/Tests/DBAL/Functional/Driver/PDOMySql/DriverTest.php index 09840ba268c..6ee5c325df9 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/Driver/PDOMySql/DriverTest.php +++ b/tests/Doctrine/Tests/DBAL/Functional/Driver/PDOMySql/DriverTest.php @@ -15,7 +15,7 @@ protected function setUp() parent::setUp(); - if (! $this->_conn->getDriver() instanceof Driver) { + if (! $this->conn->getDriver() instanceof Driver) { $this->markTestSkipped('pdo_mysql only test.'); } } diff --git a/tests/Doctrine/Tests/DBAL/Functional/Driver/PDOOracle/DriverTest.php b/tests/Doctrine/Tests/DBAL/Functional/Driver/PDOOracle/DriverTest.php index ddfdf780d5f..4e2d8940b37 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/Driver/PDOOracle/DriverTest.php +++ b/tests/Doctrine/Tests/DBAL/Functional/Driver/PDOOracle/DriverTest.php @@ -15,7 +15,7 @@ protected function setUp() parent::setUp(); - if (! $this->_conn->getDriver() instanceof Driver) { + if (! $this->conn->getDriver() instanceof Driver) { $this->markTestSkipped('PDO_OCI only test.'); } } diff --git a/tests/Doctrine/Tests/DBAL/Functional/Driver/PDOPgSql/DriverTest.php b/tests/Doctrine/Tests/DBAL/Functional/Driver/PDOPgSql/DriverTest.php index 90c9464d07c..1475b1bc07b 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/Driver/PDOPgSql/DriverTest.php +++ b/tests/Doctrine/Tests/DBAL/Functional/Driver/PDOPgSql/DriverTest.php @@ -17,7 +17,7 @@ protected function setUp() parent::setUp(); - if (! $this->_conn->getDriver() instanceof Driver) { + if (! $this->conn->getDriver() instanceof Driver) { $this->markTestSkipped('pdo_pgsql only test.'); } } @@ -27,15 +27,15 @@ protected function setUp() */ public function testDatabaseParameters($databaseName, $defaultDatabaseName, $expectedDatabaseName) { - $params = $this->_conn->getParams(); + $params = $this->conn->getParams(); $params['dbname'] = $databaseName; $params['default_dbname'] = $defaultDatabaseName; $connection = new Connection( $params, - $this->_conn->getDriver(), - $this->_conn->getConfiguration(), - $this->_conn->getEventManager() + $this->conn->getDriver(), + $this->conn->getConfiguration(), + $this->conn->getEventManager() ); self::assertSame( @@ -64,7 +64,7 @@ public function getDatabaseParameter() */ public function testConnectsWithApplicationNameParameter() { - $parameters = $this->_conn->getParams(); + $parameters = $this->conn->getParams(); $parameters['application_name'] = 'doctrine'; $user = $parameters['user'] ?? null; diff --git a/tests/Doctrine/Tests/DBAL/Functional/Driver/PDOPgsqlConnectionTest.php b/tests/Doctrine/Tests/DBAL/Functional/Driver/PDOPgsqlConnectionTest.php index 4669df7c19c..382b63b32f7 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/Driver/PDOPgsqlConnectionTest.php +++ b/tests/Doctrine/Tests/DBAL/Functional/Driver/PDOPgsqlConnectionTest.php @@ -17,7 +17,7 @@ protected function setUp() parent::setUp(); - if ( ! $this->_conn->getDatabasePlatform() instanceof PostgreSqlPlatform) { + if ( ! $this->conn->getDatabasePlatform() instanceof PostgreSqlPlatform) { $this->markTestSkipped('PDOPgsql only test.'); } } @@ -32,13 +32,13 @@ protected function setUp() */ public function testConnectsWithValidCharsetOption($charset) { - $params = $this->_conn->getParams(); + $params = $this->conn->getParams(); $params['charset'] = $charset; $connection = DriverManager::getConnection( $params, - $this->_conn->getConfiguration(), - $this->_conn->getEventManager() + $this->conn->getConfiguration(), + $this->conn->getEventManager() ); self::assertEquals( diff --git a/tests/Doctrine/Tests/DBAL/Functional/Driver/PDOSqlite/DriverTest.php b/tests/Doctrine/Tests/DBAL/Functional/Driver/PDOSqlite/DriverTest.php index beb1b0d1910..d72f74d2dbf 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/Driver/PDOSqlite/DriverTest.php +++ b/tests/Doctrine/Tests/DBAL/Functional/Driver/PDOSqlite/DriverTest.php @@ -15,7 +15,7 @@ protected function setUp() parent::setUp(); - if (! $this->_conn->getDriver() instanceof Driver) { + if (! $this->conn->getDriver() instanceof Driver) { $this->markTestSkipped('pdo_sqlite only test.'); } } diff --git a/tests/Doctrine/Tests/DBAL/Functional/Driver/PDOSqlsrv/Driver.php b/tests/Doctrine/Tests/DBAL/Functional/Driver/PDOSqlsrv/Driver.php index 517907f83b5..15c50e52e7b 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/Driver/PDOSqlsrv/Driver.php +++ b/tests/Doctrine/Tests/DBAL/Functional/Driver/PDOSqlsrv/Driver.php @@ -15,7 +15,7 @@ protected function setUp() parent::setUp(); - if (! $this->_conn->getDriver() instanceof Driver) { + if (! $this->conn->getDriver() instanceof Driver) { $this->markTestSkipped('pdo_sqlsrv only test.'); } } diff --git a/tests/Doctrine/Tests/DBAL/Functional/Driver/SQLAnywhere/ConnectionTest.php b/tests/Doctrine/Tests/DBAL/Functional/Driver/SQLAnywhere/ConnectionTest.php index 764e4ef102a..36da7ece59d 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/Driver/SQLAnywhere/ConnectionTest.php +++ b/tests/Doctrine/Tests/DBAL/Functional/Driver/SQLAnywhere/ConnectionTest.php @@ -15,14 +15,14 @@ protected function setUp() parent::setUp(); - if (! $this->_conn->getDriver() instanceof Driver) { + if (! $this->conn->getDriver() instanceof Driver) { $this->markTestSkipped('sqlanywhere only test.'); } } public function testNonPersistentConnection() { - $params = $this->_conn->getParams(); + $params = $this->conn->getParams(); $params['persistent'] = false; $conn = DriverManager::getConnection($params); @@ -34,7 +34,7 @@ public function testNonPersistentConnection() public function testPersistentConnection() { - $params = $this->_conn->getParams(); + $params = $this->conn->getParams(); $params['persistent'] = true; $conn = DriverManager::getConnection($params); diff --git a/tests/Doctrine/Tests/DBAL/Functional/Driver/SQLAnywhere/DriverTest.php b/tests/Doctrine/Tests/DBAL/Functional/Driver/SQLAnywhere/DriverTest.php index 735ad673768..7d513831d77 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/Driver/SQLAnywhere/DriverTest.php +++ b/tests/Doctrine/Tests/DBAL/Functional/Driver/SQLAnywhere/DriverTest.php @@ -16,21 +16,21 @@ protected function setUp() parent::setUp(); - if (! $this->_conn->getDriver() instanceof Driver) { + if (! $this->conn->getDriver() instanceof Driver) { $this->markTestSkipped('sqlanywhere only test.'); } } public function testReturnsDatabaseNameWithoutDatabaseNameParameter() { - $params = $this->_conn->getParams(); + $params = $this->conn->getParams(); unset($params['dbname']); $connection = new Connection( $params, - $this->_conn->getDriver(), - $this->_conn->getConfiguration(), - $this->_conn->getEventManager() + $this->conn->getDriver(), + $this->conn->getConfiguration(), + $this->conn->getEventManager() ); // SQL Anywhere has no "default" database. The name of the default database diff --git a/tests/Doctrine/Tests/DBAL/Functional/Driver/SQLAnywhere/StatementTest.php b/tests/Doctrine/Tests/DBAL/Functional/Driver/SQLAnywhere/StatementTest.php index 719edb9925c..9292e64b2d2 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/Driver/SQLAnywhere/StatementTest.php +++ b/tests/Doctrine/Tests/DBAL/Functional/Driver/SQLAnywhere/StatementTest.php @@ -15,14 +15,14 @@ protected function setUp() parent::setUp(); - if (! $this->_conn->getDriver() instanceof Driver) { + if (! $this->conn->getDriver() instanceof Driver) { $this->markTestSkipped('sqlanywhere only test.'); } } public function testNonPersistentStatement() { - $params = $this->_conn->getParams(); + $params = $this->conn->getParams(); $params['persistent'] = false; $conn = DriverManager::getConnection($params); @@ -37,7 +37,7 @@ public function testNonPersistentStatement() public function testPersistentStatement() { - $params = $this->_conn->getParams(); + $params = $this->conn->getParams(); $params['persistent'] = true; $conn = DriverManager::getConnection($params); diff --git a/tests/Doctrine/Tests/DBAL/Functional/Driver/SQLSrv/Driver.php b/tests/Doctrine/Tests/DBAL/Functional/Driver/SQLSrv/Driver.php index da94f26e256..459d141003f 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/Driver/SQLSrv/Driver.php +++ b/tests/Doctrine/Tests/DBAL/Functional/Driver/SQLSrv/Driver.php @@ -15,7 +15,7 @@ protected function setUp() parent::setUp(); - if (! $this->_conn->getDriver() instanceof Driver) { + if (! $this->conn->getDriver() instanceof Driver) { $this->markTestSkipped('sqlsrv only test.'); } } diff --git a/tests/Doctrine/Tests/DBAL/Functional/Driver/SQLSrv/StatementTest.php b/tests/Doctrine/Tests/DBAL/Functional/Driver/SQLSrv/StatementTest.php index a545e7a3898..32ed01bb039 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/Driver/SQLSrv/StatementTest.php +++ b/tests/Doctrine/Tests/DBAL/Functional/Driver/SQLSrv/StatementTest.php @@ -16,7 +16,7 @@ protected function setUp() parent::setUp(); - if (!$this->_conn->getDriver() instanceof Driver) { + if (!$this->conn->getDriver() instanceof Driver) { self::markTestSkipped('sqlsrv only test'); } } @@ -24,7 +24,7 @@ protected function setUp() public function testFailureToPrepareResultsInException() { // use the driver connection directly to avoid having exception wrapped - $stmt = $this->_conn->getWrappedConnection()->prepare(null); + $stmt = $this->conn->getWrappedConnection()->prepare(null); // it's impossible to prepare the statement without bound variables for SQL Server, // so the preparation happens before the first execution when variables are already in place diff --git a/tests/Doctrine/Tests/DBAL/Functional/ExceptionTest.php b/tests/Doctrine/Tests/DBAL/Functional/ExceptionTest.php index 277e020392f..cd85dea8e96 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/ExceptionTest.php +++ b/tests/Doctrine/Tests/DBAL/Functional/ExceptionTest.php @@ -11,7 +11,7 @@ protected function setUp() { parent::setUp(); - if ( !($this->_conn->getDriver() instanceof ExceptionConverterDriver)) { + if ( !($this->conn->getDriver() instanceof ExceptionConverterDriver)) { $this->markTestSkipped('Driver does not support special exception handling.'); } } @@ -22,12 +22,12 @@ public function testPrimaryConstraintViolationException() $table->addColumn('id', 'integer', array()); $table->setPrimaryKey(array('id')); - $this->_conn->getSchemaManager()->createTable($table); + $this->conn->getSchemaManager()->createTable($table); - $this->_conn->insert("duplicatekey_table", array('id' => 1)); + $this->conn->insert("duplicatekey_table", array('id' => 1)); $this->expectException(Exception\UniqueConstraintViolationException::class); - $this->_conn->insert("duplicatekey_table", array('id' => 1)); + $this->conn->insert("duplicatekey_table", array('id' => 1)); } public function testTableNotFoundException() @@ -35,12 +35,12 @@ public function testTableNotFoundException() $sql = "SELECT * FROM unknown_table"; $this->expectException(Exception\TableNotFoundException::class); - $this->_conn->executeQuery($sql); + $this->conn->executeQuery($sql); } public function testTableExistsException() { - $schemaManager = $this->_conn->getSchemaManager(); + $schemaManager = $this->conn->getSchemaManager(); $table = new \Doctrine\DBAL\Schema\Table("alreadyexist_table"); $table->addColumn('id', 'integer', array()); $table->setPrimaryKey(array('id')); @@ -52,15 +52,15 @@ public function testTableExistsException() public function testForeignKeyConstraintViolationExceptionOnInsert() { - if ( ! $this->_conn->getDatabasePlatform()->supportsForeignKeyConstraints()) { + if ( ! $this->conn->getDatabasePlatform()->supportsForeignKeyConstraints()) { $this->markTestSkipped("Only fails on platforms with foreign key constraints."); } $this->setUpForeignKeyConstraintViolationExceptionTest(); try { - $this->_conn->insert("constraint_error_table", array('id' => 1)); - $this->_conn->insert("owning_table", array('id' => 1, 'constraint_id' => 1)); + $this->conn->insert("constraint_error_table", array('id' => 1)); + $this->conn->insert("owning_table", array('id' => 1, 'constraint_id' => 1)); } catch (\Exception $exception) { $this->tearDownForeignKeyConstraintViolationExceptionTest(); @@ -70,7 +70,7 @@ public function testForeignKeyConstraintViolationExceptionOnInsert() $this->expectException(Exception\ForeignKeyConstraintViolationException::class); try { - $this->_conn->insert('owning_table', array('id' => 2, 'constraint_id' => 2)); + $this->conn->insert('owning_table', array('id' => 2, 'constraint_id' => 2)); } catch (Exception\ForeignKeyConstraintViolationException $exception) { $this->tearDownForeignKeyConstraintViolationExceptionTest(); @@ -86,15 +86,15 @@ public function testForeignKeyConstraintViolationExceptionOnInsert() public function testForeignKeyConstraintViolationExceptionOnUpdate() { - if ( ! $this->_conn->getDatabasePlatform()->supportsForeignKeyConstraints()) { + if ( ! $this->conn->getDatabasePlatform()->supportsForeignKeyConstraints()) { $this->markTestSkipped("Only fails on platforms with foreign key constraints."); } $this->setUpForeignKeyConstraintViolationExceptionTest(); try { - $this->_conn->insert("constraint_error_table", array('id' => 1)); - $this->_conn->insert("owning_table", array('id' => 1, 'constraint_id' => 1)); + $this->conn->insert("constraint_error_table", array('id' => 1)); + $this->conn->insert("owning_table", array('id' => 1, 'constraint_id' => 1)); } catch (\Exception $exception) { $this->tearDownForeignKeyConstraintViolationExceptionTest(); @@ -104,7 +104,7 @@ public function testForeignKeyConstraintViolationExceptionOnUpdate() $this->expectException(Exception\ForeignKeyConstraintViolationException::class); try { - $this->_conn->update('constraint_error_table', array('id' => 2), array('id' => 1)); + $this->conn->update('constraint_error_table', array('id' => 2), array('id' => 1)); } catch (Exception\ForeignKeyConstraintViolationException $exception) { $this->tearDownForeignKeyConstraintViolationExceptionTest(); @@ -120,15 +120,15 @@ public function testForeignKeyConstraintViolationExceptionOnUpdate() public function testForeignKeyConstraintViolationExceptionOnDelete() { - if ( ! $this->_conn->getDatabasePlatform()->supportsForeignKeyConstraints()) { + if ( ! $this->conn->getDatabasePlatform()->supportsForeignKeyConstraints()) { $this->markTestSkipped("Only fails on platforms with foreign key constraints."); } $this->setUpForeignKeyConstraintViolationExceptionTest(); try { - $this->_conn->insert("constraint_error_table", array('id' => 1)); - $this->_conn->insert("owning_table", array('id' => 1, 'constraint_id' => 1)); + $this->conn->insert("constraint_error_table", array('id' => 1)); + $this->conn->insert("owning_table", array('id' => 1, 'constraint_id' => 1)); } catch (\Exception $exception) { $this->tearDownForeignKeyConstraintViolationExceptionTest(); @@ -138,7 +138,7 @@ public function testForeignKeyConstraintViolationExceptionOnDelete() $this->expectException(Exception\ForeignKeyConstraintViolationException::class); try { - $this->_conn->delete('constraint_error_table', array('id' => 1)); + $this->conn->delete('constraint_error_table', array('id' => 1)); } catch (Exception\ForeignKeyConstraintViolationException $exception) { $this->tearDownForeignKeyConstraintViolationExceptionTest(); @@ -154,7 +154,7 @@ public function testForeignKeyConstraintViolationExceptionOnDelete() public function testForeignKeyConstraintViolationExceptionOnTruncate() { - $platform = $this->_conn->getDatabasePlatform(); + $platform = $this->conn->getDatabasePlatform(); if (!$platform->supportsForeignKeyConstraints()) { $this->markTestSkipped("Only fails on platforms with foreign key constraints."); @@ -163,8 +163,8 @@ public function testForeignKeyConstraintViolationExceptionOnTruncate() $this->setUpForeignKeyConstraintViolationExceptionTest(); try { - $this->_conn->insert("constraint_error_table", array('id' => 1)); - $this->_conn->insert("owning_table", array('id' => 1, 'constraint_id' => 1)); + $this->conn->insert("constraint_error_table", array('id' => 1)); + $this->conn->insert("owning_table", array('id' => 1, 'constraint_id' => 1)); } catch (\Exception $exception) { $this->tearDownForeignKeyConstraintViolationExceptionTest(); @@ -174,7 +174,7 @@ public function testForeignKeyConstraintViolationExceptionOnTruncate() $this->expectException(Exception\ForeignKeyConstraintViolationException::class); try { - $this->_conn->executeUpdate($platform->getTruncateTableSQL('constraint_error_table')); + $this->conn->executeUpdate($platform->getTruncateTableSQL('constraint_error_table')); } catch (Exception\ForeignKeyConstraintViolationException $exception) { $this->tearDownForeignKeyConstraintViolationExceptionTest(); @@ -197,12 +197,12 @@ public function testNotNullConstraintViolationException() $table->addColumn('value', 'integer', array('notnull' => true)); $table->setPrimaryKey(array('id')); - foreach ($schema->toSql($this->_conn->getDatabasePlatform()) as $sql) { - $this->_conn->exec($sql); + foreach ($schema->toSql($this->conn->getDatabasePlatform()) as $sql) { + $this->conn->exec($sql); } $this->expectException(Exception\NotNullConstraintViolationException::class); - $this->_conn->insert("notnull_table", array('id' => 1, 'value' => null)); + $this->conn->insert("notnull_table", array('id' => 1, 'value' => null)); } public function testInvalidFieldNameException() @@ -212,12 +212,12 @@ public function testInvalidFieldNameException() $table = $schema->createTable("bad_fieldname_table"); $table->addColumn('id', 'integer', array()); - foreach ($schema->toSql($this->_conn->getDatabasePlatform()) as $sql) { - $this->_conn->exec($sql); + foreach ($schema->toSql($this->conn->getDatabasePlatform()) as $sql) { + $this->conn->exec($sql); } $this->expectException(Exception\InvalidFieldNameException::class); - $this->_conn->insert("bad_fieldname_table", array('name' => 5)); + $this->conn->insert("bad_fieldname_table", array('name' => 5)); } public function testNonUniqueFieldNameException() @@ -230,13 +230,13 @@ public function testNonUniqueFieldNameException() $table2 = $schema->createTable("ambiguous_list_table_2"); $table2->addColumn('id', 'integer'); - foreach ($schema->toSql($this->_conn->getDatabasePlatform()) as $sql) { - $this->_conn->exec($sql); + foreach ($schema->toSql($this->conn->getDatabasePlatform()) as $sql) { + $this->conn->exec($sql); } $sql = 'SELECT id FROM ambiguous_list_table, ambiguous_list_table_2'; $this->expectException(Exception\NonUniqueFieldNameException::class); - $this->_conn->executeQuery($sql); + $this->conn->executeQuery($sql); } public function testUniqueConstraintViolationException() @@ -247,13 +247,13 @@ public function testUniqueConstraintViolationException() $table->addColumn('id', 'integer'); $table->addUniqueIndex(array('id')); - foreach ($schema->toSql($this->_conn->getDatabasePlatform()) as $sql) { - $this->_conn->exec($sql); + foreach ($schema->toSql($this->conn->getDatabasePlatform()) as $sql) { + $this->conn->exec($sql); } - $this->_conn->insert("unique_field_table", array('id' => 5)); + $this->conn->insert("unique_field_table", array('id' => 5)); $this->expectException(Exception\UniqueConstraintViolationException::class); - $this->_conn->insert("unique_field_table", array('id' => 5)); + $this->conn->insert("unique_field_table", array('id' => 5)); } public function testSyntaxErrorException() @@ -262,11 +262,11 @@ public function testSyntaxErrorException() $table->addColumn('id', 'integer', array()); $table->setPrimaryKey(array('id')); - $this->_conn->getSchemaManager()->createTable($table); + $this->conn->getSchemaManager()->createTable($table); $sql = 'SELECT id FRO syntax_error_table'; $this->expectException(Exception\SyntaxErrorException::class); - $this->_conn->executeQuery($sql); + $this->conn->executeQuery($sql); } /** @@ -274,7 +274,7 @@ public function testSyntaxErrorException() */ public function testConnectionExceptionSqLite($mode, $exceptionClass) { - if ($this->_conn->getDatabasePlatform()->getName() != 'sqlite') { + if ($this->conn->getDatabasePlatform()->getName() != 'sqlite') { $this->markTestSkipped("Only fails this way on sqlite"); } @@ -319,19 +319,19 @@ public function getSqLiteOpenConnection() */ public function testConnectionException($params) { - if ($this->_conn->getDatabasePlatform()->getName() == 'sqlite') { + if ($this->conn->getDatabasePlatform()->getName() == 'sqlite') { $this->markTestSkipped("Only skipped if platform is not sqlite"); } - if ($this->_conn->getDatabasePlatform()->getName() == 'drizzle') { + if ($this->conn->getDatabasePlatform()->getName() == 'drizzle') { $this->markTestSkipped("Drizzle does not always support authentication"); } - if ($this->_conn->getDatabasePlatform()->getName() == 'postgresql' && isset($params['password'])) { + if ($this->conn->getDatabasePlatform()->getName() == 'postgresql' && isset($params['password'])) { $this->markTestSkipped("Does not work on Travis"); } - $defaultParams = $this->_conn->getParams(); + $defaultParams = $this->conn->getParams(); $params = array_merge($defaultParams, $params); $conn = \Doctrine\DBAL\DriverManager::getConnection($params); @@ -358,7 +358,7 @@ public function getConnectionParams() private function setUpForeignKeyConstraintViolationExceptionTest() { - $schemaManager = $this->_conn->getSchemaManager(); + $schemaManager = $this->conn->getSchemaManager(); $table = new Table("constraint_error_table"); $table->addColumn('id', 'integer', array()); @@ -376,7 +376,7 @@ private function setUpForeignKeyConstraintViolationExceptionTest() private function tearDownForeignKeyConstraintViolationExceptionTest() { - $schemaManager = $this->_conn->getSchemaManager(); + $schemaManager = $this->conn->getSchemaManager(); $schemaManager->dropTable('owning_table'); $schemaManager->dropTable('constraint_error_table'); diff --git a/tests/Doctrine/Tests/DBAL/Functional/LoggingTest.php b/tests/Doctrine/Tests/DBAL/Functional/LoggingTest.php index f32520485ef..8f1727e0a2e 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/LoggingTest.php +++ b/tests/Doctrine/Tests/DBAL/Functional/LoggingTest.php @@ -6,7 +6,7 @@ class LoggingTest extends \Doctrine\Tests\DbalFunctionalTestCase { public function testLogExecuteQuery() { - $sql = $this->_conn->getDatabasePlatform()->getDummySelectSQL(); + $sql = $this->conn->getDatabasePlatform()->getDummySelectSQL(); $logMock = $this->createMock('Doctrine\DBAL\Logging\SQLLogger'); $logMock->expects($this->at(0)) @@ -14,15 +14,15 @@ public function testLogExecuteQuery() ->with($this->equalTo($sql), $this->equalTo(array()), $this->equalTo(array())); $logMock->expects($this->at(1)) ->method('stopQuery'); - $this->_conn->getConfiguration()->setSQLLogger($logMock); - $this->_conn->executeQuery($sql, array()); + $this->conn->getConfiguration()->setSQLLogger($logMock); + $this->conn->executeQuery($sql, array()); } public function testLogExecuteUpdate() { $this->markTestSkipped('Test breaks MySQL but works on all other platforms (Unbuffered Queries stuff).'); - $sql = $this->_conn->getDatabasePlatform()->getDummySelectSQL(); + $sql = $this->conn->getDatabasePlatform()->getDummySelectSQL(); $logMock = $this->createMock('Doctrine\DBAL\Logging\SQLLogger'); $logMock->expects($this->at(0)) @@ -30,13 +30,13 @@ public function testLogExecuteUpdate() ->with($this->equalTo($sql), $this->equalTo(array()), $this->equalTo(array())); $logMock->expects($this->at(1)) ->method('stopQuery'); - $this->_conn->getConfiguration()->setSQLLogger($logMock); - $this->_conn->executeUpdate($sql, array()); + $this->conn->getConfiguration()->setSQLLogger($logMock); + $this->conn->executeUpdate($sql, array()); } public function testLogPrepareExecute() { - $sql = $this->_conn->getDatabasePlatform()->getDummySelectSQL(); + $sql = $this->conn->getDatabasePlatform()->getDummySelectSQL(); $logMock = $this->createMock('Doctrine\DBAL\Logging\SQLLogger'); $logMock->expects($this->once()) @@ -44,9 +44,9 @@ public function testLogPrepareExecute() ->with($this->equalTo($sql), $this->equalTo(array())); $logMock->expects($this->at(1)) ->method('stopQuery'); - $this->_conn->getConfiguration()->setSQLLogger($logMock); + $this->conn->getConfiguration()->setSQLLogger($logMock); - $stmt = $this->_conn->prepare($sql); + $stmt = $this->conn->prepare($sql); $stmt->execute(); } } diff --git a/tests/Doctrine/Tests/DBAL/Functional/MasterSlaveConnectionTest.php b/tests/Doctrine/Tests/DBAL/Functional/MasterSlaveConnectionTest.php index fc97c7d27dc..2c382617193 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/MasterSlaveConnectionTest.php +++ b/tests/Doctrine/Tests/DBAL/Functional/MasterSlaveConnectionTest.php @@ -15,7 +15,7 @@ protected function setUp() { parent::setUp(); - $platformName = $this->_conn->getDatabasePlatform()->getName(); + $platformName = $this->conn->getDatabasePlatform()->getName(); // This is a MySQL specific test, skip other vendors. if ($platformName != 'mysql') { @@ -28,15 +28,15 @@ protected function setUp() $table->addColumn('test_int', 'integer'); $table->setPrimaryKey(array('test_int')); - $sm = $this->_conn->getSchemaManager(); + $sm = $this->conn->getSchemaManager(); $sm->createTable($table); } catch(\Exception $e) { } - $this->_conn->executeUpdate('DELETE FROM master_slave_table'); - $this->_conn->insert('master_slave_table', array('test_int' => 1)); + $this->conn->executeUpdate('DELETE FROM master_slave_table'); + $this->conn->insert('master_slave_table', array('test_int' => 1)); } private function createMasterSlaveConnection(bool $keepSlave = false) : MasterSlaveConnection @@ -46,7 +46,7 @@ private function createMasterSlaveConnection(bool $keepSlave = false) : MasterSl private function createMasterSlaveConnectionParams(bool $keepSlave = false) : array { - $params = $this->_conn->getParams(); + $params = $this->conn->getParams(); $params['master'] = $params; $params['slaves'] = array($params, $params); $params['keepSlave'] = $keepSlave; diff --git a/tests/Doctrine/Tests/DBAL/Functional/ModifyLimitQueryTest.php b/tests/Doctrine/Tests/DBAL/Functional/ModifyLimitQueryTest.php index f03dc0f11f1..41ae78f7bad 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/ModifyLimitQueryTest.php +++ b/tests/Doctrine/Tests/DBAL/Functional/ModifyLimitQueryTest.php @@ -21,21 +21,21 @@ protected function setUp() $table2->addColumn('test_int', 'integer'); $table2->setPrimaryKey(array('id')); - $sm = $this->_conn->getSchemaManager(); + $sm = $this->conn->getSchemaManager(); $sm->createTable($table); $sm->createTable($table2); self::$tableCreated = true; } - $this->_conn->exec($this->_conn->getDatabasePlatform()->getTruncateTableSQL('modify_limit_table')); - $this->_conn->exec($this->_conn->getDatabasePlatform()->getTruncateTableSQL('modify_limit_table2')); + $this->conn->exec($this->conn->getDatabasePlatform()->getTruncateTableSQL('modify_limit_table')); + $this->conn->exec($this->conn->getDatabasePlatform()->getTruncateTableSQL('modify_limit_table2')); } public function testModifyLimitQuerySimpleQuery() { - $this->_conn->insert('modify_limit_table', array('test_int' => 1)); - $this->_conn->insert('modify_limit_table', array('test_int' => 2)); - $this->_conn->insert('modify_limit_table', array('test_int' => 3)); - $this->_conn->insert('modify_limit_table', array('test_int' => 4)); + $this->conn->insert('modify_limit_table', array('test_int' => 1)); + $this->conn->insert('modify_limit_table', array('test_int' => 2)); + $this->conn->insert('modify_limit_table', array('test_int' => 3)); + $this->conn->insert('modify_limit_table', array('test_int' => 4)); $sql = "SELECT * FROM modify_limit_table ORDER BY test_int ASC"; @@ -47,14 +47,14 @@ public function testModifyLimitQuerySimpleQuery() public function testModifyLimitQueryJoinQuery() { - $this->_conn->insert('modify_limit_table', array('test_int' => 1)); - $this->_conn->insert('modify_limit_table', array('test_int' => 2)); + $this->conn->insert('modify_limit_table', array('test_int' => 1)); + $this->conn->insert('modify_limit_table', array('test_int' => 2)); - $this->_conn->insert('modify_limit_table2', array('test_int' => 1)); - $this->_conn->insert('modify_limit_table2', array('test_int' => 1)); - $this->_conn->insert('modify_limit_table2', array('test_int' => 1)); - $this->_conn->insert('modify_limit_table2', array('test_int' => 2)); - $this->_conn->insert('modify_limit_table2', array('test_int' => 2)); + $this->conn->insert('modify_limit_table2', array('test_int' => 1)); + $this->conn->insert('modify_limit_table2', array('test_int' => 1)); + $this->conn->insert('modify_limit_table2', array('test_int' => 1)); + $this->conn->insert('modify_limit_table2', array('test_int' => 2)); + $this->conn->insert('modify_limit_table2', array('test_int' => 2)); $sql = "SELECT modify_limit_table.test_int FROM modify_limit_table INNER JOIN modify_limit_table2 ON modify_limit_table.test_int = modify_limit_table2.test_int ORDER BY modify_limit_table.test_int DESC"; @@ -65,10 +65,10 @@ public function testModifyLimitQueryJoinQuery() public function testModifyLimitQueryNonDeterministic() { - $this->_conn->insert('modify_limit_table', array('test_int' => 1)); - $this->_conn->insert('modify_limit_table', array('test_int' => 2)); - $this->_conn->insert('modify_limit_table', array('test_int' => 3)); - $this->_conn->insert('modify_limit_table', array('test_int' => 4)); + $this->conn->insert('modify_limit_table', array('test_int' => 1)); + $this->conn->insert('modify_limit_table', array('test_int' => 2)); + $this->conn->insert('modify_limit_table', array('test_int' => 3)); + $this->conn->insert('modify_limit_table', array('test_int' => 4)); $sql = "SELECT * FROM modify_limit_table"; @@ -79,14 +79,14 @@ public function testModifyLimitQueryNonDeterministic() public function testModifyLimitQueryGroupBy() { - $this->_conn->insert('modify_limit_table', array('test_int' => 1)); - $this->_conn->insert('modify_limit_table', array('test_int' => 2)); + $this->conn->insert('modify_limit_table', array('test_int' => 1)); + $this->conn->insert('modify_limit_table', array('test_int' => 2)); - $this->_conn->insert('modify_limit_table2', array('test_int' => 1)); - $this->_conn->insert('modify_limit_table2', array('test_int' => 1)); - $this->_conn->insert('modify_limit_table2', array('test_int' => 1)); - $this->_conn->insert('modify_limit_table2', array('test_int' => 2)); - $this->_conn->insert('modify_limit_table2', array('test_int' => 2)); + $this->conn->insert('modify_limit_table2', array('test_int' => 1)); + $this->conn->insert('modify_limit_table2', array('test_int' => 1)); + $this->conn->insert('modify_limit_table2', array('test_int' => 1)); + $this->conn->insert('modify_limit_table2', array('test_int' => 2)); + $this->conn->insert('modify_limit_table2', array('test_int' => 2)); $sql = "SELECT modify_limit_table.test_int FROM modify_limit_table " . "INNER JOIN modify_limit_table2 ON modify_limit_table.test_int = modify_limit_table2.test_int ". @@ -99,10 +99,10 @@ public function testModifyLimitQueryGroupBy() public function testModifyLimitQuerySubSelect() { - $this->_conn->insert('modify_limit_table', array('test_int' => 1)); - $this->_conn->insert('modify_limit_table', array('test_int' => 2)); - $this->_conn->insert('modify_limit_table', array('test_int' => 3)); - $this->_conn->insert('modify_limit_table', array('test_int' => 4)); + $this->conn->insert('modify_limit_table', array('test_int' => 1)); + $this->conn->insert('modify_limit_table', array('test_int' => 2)); + $this->conn->insert('modify_limit_table', array('test_int' => 3)); + $this->conn->insert('modify_limit_table', array('test_int' => 4)); $sql = "SELECT modify_limit_table.*, (SELECT COUNT(*) FROM modify_limit_table) AS cnt FROM modify_limit_table ORDER BY test_int DESC"; @@ -113,10 +113,10 @@ public function testModifyLimitQuerySubSelect() public function testModifyLimitQueryFromSubSelect() { - $this->_conn->insert('modify_limit_table', array('test_int' => 1)); - $this->_conn->insert('modify_limit_table', array('test_int' => 2)); - $this->_conn->insert('modify_limit_table', array('test_int' => 3)); - $this->_conn->insert('modify_limit_table', array('test_int' => 4)); + $this->conn->insert('modify_limit_table', array('test_int' => 1)); + $this->conn->insert('modify_limit_table', array('test_int' => 2)); + $this->conn->insert('modify_limit_table', array('test_int' => 3)); + $this->conn->insert('modify_limit_table', array('test_int' => 4)); $sql = "SELECT * FROM (SELECT * FROM modify_limit_table) sub ORDER BY test_int DESC"; @@ -127,9 +127,9 @@ public function testModifyLimitQueryFromSubSelect() public function testModifyLimitQueryLineBreaks() { - $this->_conn->insert('modify_limit_table', array('test_int' => 1)); - $this->_conn->insert('modify_limit_table', array('test_int' => 2)); - $this->_conn->insert('modify_limit_table', array('test_int' => 3)); + $this->conn->insert('modify_limit_table', array('test_int' => 1)); + $this->conn->insert('modify_limit_table', array('test_int' => 2)); + $this->conn->insert('modify_limit_table', array('test_int' => 3)); $sql = <<_conn->insert('modify_limit_table', array('test_int' => 1)); - $this->_conn->insert('modify_limit_table', array('test_int' => 2)); + $this->conn->insert('modify_limit_table', array('test_int' => 1)); + $this->conn->insert('modify_limit_table', array('test_int' => 2)); $sql = "SELECT test_int FROM modify_limit_table ORDER BY test_int ASC"; @@ -157,9 +157,9 @@ public function testModifyLimitQueryZeroOffsetNoLimit() public function assertLimitResult($expectedResults, $sql, $limit, $offset, $deterministic = true) { - $p = $this->_conn->getDatabasePlatform(); + $p = $this->conn->getDatabasePlatform(); $data = array(); - foreach ($this->_conn->fetchAll($p->modifyLimitQuery($sql, $limit, $offset)) as $row) { + foreach ($this->conn->fetchAll($p->modifyLimitQuery($sql, $limit, $offset)) as $row) { $row = array_change_key_case($row, CASE_LOWER); $data[] = $row['test_int']; } diff --git a/tests/Doctrine/Tests/DBAL/Functional/NamedParametersTest.php b/tests/Doctrine/Tests/DBAL/Functional/NamedParametersTest.php index e878a71d0fe..acb03017fcc 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/NamedParametersTest.php +++ b/tests/Doctrine/Tests/DBAL/Functional/NamedParametersTest.php @@ -120,7 +120,7 @@ protected function setUp() { parent::setUp(); - if (!$this->_conn->getSchemaManager()->tablesExist("ddc1372_foobar")) { + if (!$this->conn->getSchemaManager()->tablesExist("ddc1372_foobar")) { try { $table = new \Doctrine\DBAL\Schema\Table("ddc1372_foobar"); $table->addColumn('id', 'integer'); @@ -129,25 +129,25 @@ protected function setUp() $table->setPrimaryKey(array('id')); - $sm = $this->_conn->getSchemaManager(); + $sm = $this->conn->getSchemaManager(); $sm->createTable($table); - $this->_conn->insert('ddc1372_foobar', array( + $this->conn->insert('ddc1372_foobar', array( 'id' => 1, 'foo' => 1, 'bar' => 1 )); - $this->_conn->insert('ddc1372_foobar', array( + $this->conn->insert('ddc1372_foobar', array( 'id' => 2, 'foo' => 1, 'bar' => 2 )); - $this->_conn->insert('ddc1372_foobar', array( + $this->conn->insert('ddc1372_foobar', array( 'id' => 3, 'foo' => 1, 'bar' => 3 )); - $this->_conn->insert('ddc1372_foobar', array( + $this->conn->insert('ddc1372_foobar', array( 'id' => 4, 'foo' => 1, 'bar' => 4 )); - $this->_conn->insert('ddc1372_foobar', array( + $this->conn->insert('ddc1372_foobar', array( 'id' => 5, 'foo' => 2, 'bar' => 1 )); - $this->_conn->insert('ddc1372_foobar', array( + $this->conn->insert('ddc1372_foobar', array( 'id' => 6, 'foo' => 2, 'bar' => 2 )); } catch(\Exception $e) { @@ -165,7 +165,7 @@ protected function setUp() */ public function testTicket($query,$params,$types,$expected) { - $stmt = $this->_conn->executeQuery($query, $params, $types); + $stmt = $this->conn->executeQuery($query, $params, $types); $result = $stmt->fetchAll(FetchMode::ASSOCIATIVE); foreach ($result as $k => $v) { diff --git a/tests/Doctrine/Tests/DBAL/Functional/PortabilityTest.php b/tests/Doctrine/Tests/DBAL/Functional/PortabilityTest.php index 78d0a03f68b..60dd822f28c 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/PortabilityTest.php +++ b/tests/Doctrine/Tests/DBAL/Functional/PortabilityTest.php @@ -34,13 +34,13 @@ private function getPortableConnection( $case = ColumnCase::LOWER ) { if (!$this->portableConnection) { - $params = $this->_conn->getParams(); + $params = $this->conn->getParams(); $params['wrapperClass'] = ConnectionPortability::class; $params['portability'] = $portabilityMode; $params['fetch_case'] = $case; - $this->portableConnection = DriverManager::getConnection($params, $this->_conn->getConfiguration(), $this->_conn->getEventManager()); + $this->portableConnection = DriverManager::getConnection($params, $this->conn->getConfiguration(), $this->conn->getEventManager()); try { /* @var $sm \Doctrine\DBAL\Schema\AbstractSchemaManager */ diff --git a/tests/Doctrine/Tests/DBAL/Functional/ResultCacheTest.php b/tests/Doctrine/Tests/DBAL/Functional/ResultCacheTest.php index 367a09f9e35..be91609fd5d 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/ResultCacheTest.php +++ b/tests/Doctrine/Tests/DBAL/Functional/ResultCacheTest.php @@ -22,14 +22,14 @@ protected function setUp() $table->addColumn('test_string', 'string', array('notnull' => false)); $table->setPrimaryKey(array('test_int')); - $sm = $this->_conn->getSchemaManager(); + $sm = $this->conn->getSchemaManager(); $sm->createTable($table); foreach ($this->expectedResult as $row) { - $this->_conn->insert('caching', $row); + $this->conn->insert('caching', $row); } - $config = $this->_conn->getConfiguration(); + $config = $this->conn->getConfiguration(); $config->setSQLLogger($this->sqlLogger = new \Doctrine\DBAL\Logging\DebugStack); $cache = new \Doctrine\Common\Cache\ArrayCache; @@ -38,7 +38,7 @@ protected function setUp() protected function tearDown() { - $this->_conn->getSchemaManager()->dropTable('caching'); + $this->conn->getSchemaManager()->dropTable('caching'); parent::tearDown(); } @@ -87,13 +87,13 @@ public function testMixingFetch() foreach ($this->expectedResult as $v) { $numExpectedResult[] = array_values($v); } - $stmt = $this->_conn->executeQuery("SELECT * FROM caching ORDER BY test_int ASC", array(), array(), new QueryCacheProfile(10, "testcachekey")); + $stmt = $this->conn->executeQuery("SELECT * FROM caching ORDER BY test_int ASC", array(), array(), new QueryCacheProfile(10, "testcachekey")); $data = $this->hydrateStmt($stmt, FetchMode::ASSOCIATIVE); self::assertEquals($this->expectedResult, $data); - $stmt = $this->_conn->executeQuery("SELECT * FROM caching ORDER BY test_int ASC", array(), array(), new QueryCacheProfile(10, "testcachekey")); + $stmt = $this->conn->executeQuery("SELECT * FROM caching ORDER BY test_int ASC", array(), array(), new QueryCacheProfile(10, "testcachekey")); $data = $this->hydrateStmt($stmt, FetchMode::NUMERIC); @@ -109,10 +109,10 @@ public function testIteratorFetch() public function assertStandardAndIteratorFetchAreEqual($fetchMode) { - $stmt = $this->_conn->executeQuery("SELECT * FROM caching ORDER BY test_int ASC", array(), array(), new QueryCacheProfile(10, "testcachekey")); + $stmt = $this->conn->executeQuery("SELECT * FROM caching ORDER BY test_int ASC", array(), array(), new QueryCacheProfile(10, "testcachekey")); $data = $this->hydrateStmt($stmt, $fetchMode); - $stmt = $this->_conn->executeQuery("SELECT * FROM caching ORDER BY test_int ASC", array(), array(), new QueryCacheProfile(10, "testcachekey")); + $stmt = $this->conn->executeQuery("SELECT * FROM caching ORDER BY test_int ASC", array(), array(), new QueryCacheProfile(10, "testcachekey")); $data_iterator = $this->hydrateStmtIterator($stmt, $fetchMode); self::assertEquals($data, $data_iterator); @@ -120,7 +120,7 @@ public function assertStandardAndIteratorFetchAreEqual($fetchMode) public function testDontCloseNoCache() { - $stmt = $this->_conn->executeQuery("SELECT * FROM caching ORDER BY test_int ASC", array(), array(), new QueryCacheProfile(10, "testcachekey")); + $stmt = $this->conn->executeQuery("SELECT * FROM caching ORDER BY test_int ASC", array(), array(), new QueryCacheProfile(10, "testcachekey")); $data = array(); @@ -128,7 +128,7 @@ public function testDontCloseNoCache() $data[] = $row; } - $stmt = $this->_conn->executeQuery("SELECT * FROM caching ORDER BY test_int ASC", array(), array(), new QueryCacheProfile(10, "testcachekey")); + $stmt = $this->conn->executeQuery("SELECT * FROM caching ORDER BY test_int ASC", array(), array(), new QueryCacheProfile(10, "testcachekey")); $data = array(); @@ -141,12 +141,12 @@ public function testDontCloseNoCache() public function testDontFinishNoCache() { - $stmt = $this->_conn->executeQuery("SELECT * FROM caching ORDER BY test_int ASC", array(), array(), new QueryCacheProfile(10, "testcachekey")); + $stmt = $this->conn->executeQuery("SELECT * FROM caching ORDER BY test_int ASC", array(), array(), new QueryCacheProfile(10, "testcachekey")); $stmt->fetch(FetchMode::ASSOCIATIVE); $stmt->closeCursor(); - $stmt = $this->_conn->executeQuery("SELECT * FROM caching ORDER BY test_int ASC", array(), array(), new QueryCacheProfile(10, "testcachekey")); + $stmt = $this->conn->executeQuery("SELECT * FROM caching ORDER BY test_int ASC", array(), array(), new QueryCacheProfile(10, "testcachekey")); $this->hydrateStmt($stmt, FetchMode::NUMERIC); @@ -155,13 +155,13 @@ public function testDontFinishNoCache() public function assertCacheNonCacheSelectSameFetchModeAreEqual($expectedResult, $fetchMode) { - $stmt = $this->_conn->executeQuery("SELECT * FROM caching ORDER BY test_int ASC", array(), array(), new QueryCacheProfile(10, "testcachekey")); + $stmt = $this->conn->executeQuery("SELECT * FROM caching ORDER BY test_int ASC", array(), array(), new QueryCacheProfile(10, "testcachekey")); self::assertEquals(2, $stmt->columnCount()); $data = $this->hydrateStmt($stmt, $fetchMode); self::assertEquals($expectedResult, $data); - $stmt = $this->_conn->executeQuery("SELECT * FROM caching ORDER BY test_int ASC", array(), array(), new QueryCacheProfile(10, "testcachekey")); + $stmt = $this->conn->executeQuery("SELECT * FROM caching ORDER BY test_int ASC", array(), array(), new QueryCacheProfile(10, "testcachekey")); self::assertEquals(2, $stmt->columnCount()); $data = $this->hydrateStmt($stmt, $fetchMode); @@ -171,10 +171,10 @@ public function assertCacheNonCacheSelectSameFetchModeAreEqual($expectedResult, public function testEmptyResultCache() { - $stmt = $this->_conn->executeQuery("SELECT * FROM caching WHERE test_int > 500", array(), array(), new QueryCacheProfile(10, "emptycachekey")); + $stmt = $this->conn->executeQuery("SELECT * FROM caching WHERE test_int > 500", array(), array(), new QueryCacheProfile(10, "emptycachekey")); $data = $this->hydrateStmt($stmt); - $stmt = $this->_conn->executeQuery("SELECT * FROM caching WHERE test_int > 500", array(), array(), new QueryCacheProfile(10, "emptycachekey")); + $stmt = $this->conn->executeQuery("SELECT * FROM caching WHERE test_int > 500", array(), array(), new QueryCacheProfile(10, "emptycachekey")); $data = $this->hydrateStmt($stmt); self::assertCount(1, $this->sqlLogger->queries, "just one dbal hit"); @@ -182,11 +182,11 @@ public function testEmptyResultCache() public function testChangeCacheImpl() { - $stmt = $this->_conn->executeQuery("SELECT * FROM caching WHERE test_int > 500", array(), array(), new QueryCacheProfile(10, "emptycachekey")); + $stmt = $this->conn->executeQuery("SELECT * FROM caching WHERE test_int > 500", array(), array(), new QueryCacheProfile(10, "emptycachekey")); $data = $this->hydrateStmt($stmt); $secondCache = new \Doctrine\Common\Cache\ArrayCache; - $stmt = $this->_conn->executeQuery("SELECT * FROM caching WHERE test_int > 500", array(), array(), new QueryCacheProfile(10, "emptycachekey", $secondCache)); + $stmt = $this->conn->executeQuery("SELECT * FROM caching WHERE test_int > 500", array(), array(), new QueryCacheProfile(10, "emptycachekey", $secondCache)); $data = $this->hydrateStmt($stmt); self::assertCount(2, $this->sqlLogger->queries, "two hits"); diff --git a/tests/Doctrine/Tests/DBAL/Functional/Schema/Db2SchemaManagerTest.php b/tests/Doctrine/Tests/DBAL/Functional/Schema/Db2SchemaManagerTest.php index cf3bb2da97b..cc7362f7bad 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/Schema/Db2SchemaManagerTest.php +++ b/tests/Doctrine/Tests/DBAL/Functional/Schema/Db2SchemaManagerTest.php @@ -15,9 +15,9 @@ public function testGetBooleanColumn() $table->addColumn('bool', 'boolean'); $table->addColumn('bool_commented', 'boolean', array('comment' => "That's a comment")); - $this->_sm->createTable($table); + $this->sm->createTable($table); - $columns = $this->_sm->listTableColumns('boolean_column_test'); + $columns = $this->sm->listTableColumns('boolean_column_test'); self::assertInstanceOf('Doctrine\DBAL\Types\BooleanType', $columns['bool']->getType()); self::assertInstanceOf('Doctrine\DBAL\Types\BooleanType', $columns['bool_commented']->getType()); diff --git a/tests/Doctrine/Tests/DBAL/Functional/Schema/DrizzleSchemaManagerTest.php b/tests/Doctrine/Tests/DBAL/Functional/Schema/DrizzleSchemaManagerTest.php index 5b63b363a51..50cf0762eb6 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/Schema/DrizzleSchemaManagerTest.php +++ b/tests/Doctrine/Tests/DBAL/Functional/Schema/DrizzleSchemaManagerTest.php @@ -16,9 +16,9 @@ public function testListTableWithBinary() $table->addColumn('column_binary', 'binary', array('fixed' => true)); $table->setPrimaryKey(array('id')); - $this->_sm->createTable($table); + $this->sm->createTable($table); - $table = $this->_sm->listTableDetails($tableName); + $table = $this->sm->listTableDetails($tableName); self::assertInstanceOf('Doctrine\DBAL\Types\BinaryType', $table->getColumn('column_varbinary')->getType()); self::assertFalse($table->getColumn('column_varbinary')->getFixed()); @@ -35,9 +35,9 @@ public function testColumnCollation() $table->addColumn('text', 'text'); $table->addColumn('foo', 'text')->setPlatformOption('collation', 'utf8_swedish_ci'); $table->addColumn('bar', 'text')->setPlatformOption('collation', 'utf8_general_ci'); - $this->_sm->dropAndCreateTable($table); + $this->sm->dropAndCreateTable($table); - $columns = $this->_sm->listTableColumns('test_collation'); + $columns = $this->sm->listTableColumns('test_collation'); self::assertArrayNotHasKey('collation', $columns['id']->getPlatformOptions()); self::assertEquals('utf8_unicode_ci', $columns['text']->getPlatformOption('collation')); diff --git a/tests/Doctrine/Tests/DBAL/Functional/Schema/MySqlSchemaManagerTest.php b/tests/Doctrine/Tests/DBAL/Functional/Schema/MySqlSchemaManagerTest.php index d6c93761274..85054f48cb2 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/Schema/MySqlSchemaManagerTest.php +++ b/tests/Doctrine/Tests/DBAL/Functional/Schema/MySqlSchemaManagerTest.php @@ -27,15 +27,15 @@ public function testSwitchPrimaryKeyColumns() $tableOld->addColumn('foo_id', 'integer'); $tableOld->addColumn('bar_id', 'integer'); - $this->_sm->createTable($tableOld); - $tableFetched = $this->_sm->listTableDetails("switch_primary_key_columns"); + $this->sm->createTable($tableOld); + $tableFetched = $this->sm->listTableDetails("switch_primary_key_columns"); $tableNew = clone $tableFetched; $tableNew->setPrimaryKey(array('bar_id', 'foo_id')); $comparator = new Comparator; - $this->_sm->alterTable($comparator->diffTable($tableFetched, $tableNew)); + $this->sm->alterTable($comparator->diffTable($tableFetched, $tableNew)); - $table = $this->_sm->listTableDetails('switch_primary_key_columns'); + $table = $this->sm->listTableDetails('switch_primary_key_columns'); $primaryKey = $table->getPrimaryKeyColumns(); self::assertCount(2, $primaryKey); @@ -57,8 +57,8 @@ public function testDiffTableBug() $table->addUniqueIndex(array('route', 'locale', 'attribute')); $table->addIndex(array('localized_value')); // this is much more selective than the unique index - $this->_sm->createTable($table); - $tableFetched = $this->_sm->listTableDetails("diffbug_routing_translations"); + $this->sm->createTable($table); + $tableFetched = $this->sm->listTableDetails("diffbug_routing_translations"); $comparator = new Comparator; $diff = $comparator->diffTable($tableFetched, $table); @@ -76,9 +76,9 @@ public function testFulltextIndex() $index = $table->getIndex('f_index'); $index->addFlag('fulltext'); - $this->_sm->dropAndCreateTable($table); + $this->sm->dropAndCreateTable($table); - $indexes = $this->_sm->listTableIndexes('fulltext_index'); + $indexes = $this->sm->listTableIndexes('fulltext_index'); self::assertArrayHasKey('f_index', $indexes); self::assertTrue($indexes['f_index']->hasFlag('fulltext')); } @@ -93,9 +93,9 @@ public function testSpatialIndex() $index = $table->getIndex('s_index'); $index->addFlag('spatial'); - $this->_sm->dropAndCreateTable($table); + $this->sm->dropAndCreateTable($table); - $indexes = $this->_sm->listTableIndexes('spatial_index'); + $indexes = $this->sm->listTableIndexes('spatial_index'); self::assertArrayHasKey('s_index', $indexes); self::assertTrue($indexes['s_index']->hasFlag('spatial')); } @@ -110,7 +110,7 @@ public function testAlterTableAddPrimaryKey() $table->addColumn('foo', 'integer'); $table->addIndex(array('id'), 'idx_id'); - $this->_sm->createTable($table); + $this->sm->createTable($table); $comparator = new Comparator(); $diffTable = clone $table; @@ -118,9 +118,9 @@ public function testAlterTableAddPrimaryKey() $diffTable->dropIndex('idx_id'); $diffTable->setPrimaryKey(array('id')); - $this->_sm->alterTable($comparator->diffTable($table, $diffTable)); + $this->sm->alterTable($comparator->diffTable($table, $diffTable)); - $table = $this->_sm->listTableDetails("alter_table_add_pk"); + $table = $this->sm->listTableDetails("alter_table_add_pk"); self::assertFalse($table->hasIndex('idx_id')); self::assertTrue($table->hasPrimaryKey()); @@ -136,7 +136,7 @@ public function testDropPrimaryKeyWithAutoincrementColumn() $table->addColumn('foo', 'integer'); $table->setPrimaryKey(array('id', 'foo')); - $this->_sm->dropAndCreateTable($table); + $this->sm->dropAndCreateTable($table); $diffTable = clone $table; @@ -144,9 +144,9 @@ public function testDropPrimaryKeyWithAutoincrementColumn() $comparator = new Comparator(); - $this->_sm->alterTable($comparator->diffTable($table, $diffTable)); + $this->sm->alterTable($comparator->diffTable($table, $diffTable)); - $table = $this->_sm->listTableDetails("drop_primary_key"); + $table = $this->sm->listTableDetails("drop_primary_key"); self::assertFalse($table->hasPrimaryKey()); self::assertFalse($table->getColumn('id')->getAutoincrement()); @@ -157,7 +157,7 @@ public function testDropPrimaryKeyWithAutoincrementColumn() */ public function testDoesNotPropagateDefaultValuesForUnsupportedColumnTypes() { - if ($this->_sm->getDatabasePlatform() instanceof MariaDb1027Platform) { + if ($this->sm->getDatabasePlatform() instanceof MariaDb1027Platform) { $this->markTestSkipped( 'MariaDb102Platform supports default values for BLOB and TEXT columns and will propagate values' ); @@ -169,9 +169,9 @@ public function testDoesNotPropagateDefaultValuesForUnsupportedColumnTypes() $table->addColumn('def_blob', 'blob', ['default' => 'def']); $table->addColumn('def_blob_null', 'blob', ['notnull' => false, 'default' => 'def']); - $this->_sm->dropAndCreateTable($table); + $this->sm->dropAndCreateTable($table); - $onlineTable = $this->_sm->listTableDetails("text_blob_default_value"); + $onlineTable = $this->sm->listTableDetails("text_blob_default_value"); self::assertNull($onlineTable->getColumn('def_text')->getDefault()); self::assertNull($onlineTable->getColumn('def_text_null')->getDefault()); @@ -182,9 +182,9 @@ public function testDoesNotPropagateDefaultValuesForUnsupportedColumnTypes() $comparator = new Comparator(); - $this->_sm->alterTable($comparator->diffTable($table, $onlineTable)); + $this->sm->alterTable($comparator->diffTable($table, $onlineTable)); - $onlineTable = $this->_sm->listTableDetails("text_blob_default_value"); + $onlineTable = $this->sm->listTableDetails("text_blob_default_value"); self::assertNull($onlineTable->getColumn('def_text')->getDefault()); self::assertNull($onlineTable->getColumn('def_text_null')->getDefault()); @@ -203,9 +203,9 @@ public function testColumnCollation() $table->addColumn('text', 'text'); $table->addColumn('foo', 'text')->setPlatformOption('collation', 'latin1_swedish_ci'); $table->addColumn('bar', 'text')->setPlatformOption('collation', 'utf8_general_ci'); - $this->_sm->dropAndCreateTable($table); + $this->sm->dropAndCreateTable($table); - $columns = $this->_sm->listTableColumns('test_collation'); + $columns = $this->sm->listTableColumns('test_collation'); self::assertArrayNotHasKey('collation', $columns['id']->getPlatformOptions()); self::assertEquals('latin1_swedish_ci', $columns['text']->getPlatformOption('collation')); @@ -231,11 +231,11 @@ public function testListLobTypeColumns() $table->addColumn('col_mediumblob', 'blob', array('length' => MySqlPlatform::LENGTH_LIMIT_MEDIUMBLOB)); $table->addColumn('col_longblob', 'blob'); - $this->_sm->dropAndCreateTable($table); + $this->sm->dropAndCreateTable($table); - $platform = $this->_sm->getDatabasePlatform(); + $platform = $this->sm->getDatabasePlatform(); $offlineColumns = $table->getColumns(); - $onlineColumns = $this->_sm->listTableColumns($tableName); + $onlineColumns = $this->sm->listTableColumns($tableName); self::assertSame( $platform->getClobTypeDeclarationSQL($offlineColumns['col_tinytext']->toArray()), @@ -280,9 +280,9 @@ public function testDiffListGuidTableColumn() $offlineTable = new Table('list_guid_table_column'); $offlineTable->addColumn('col_guid', 'guid'); - $this->_sm->dropAndCreateTable($offlineTable); + $this->sm->dropAndCreateTable($offlineTable); - $onlineTable = $this->_sm->listTableDetails('list_guid_table_column'); + $onlineTable = $this->sm->listTableDetails('list_guid_table_column'); $comparator = new Comparator(); @@ -303,9 +303,9 @@ public function testListDecimalTypeColumns() $table->addColumn('col', 'decimal'); $table->addColumn('col_unsigned', 'decimal', array('unsigned' => true)); - $this->_sm->dropAndCreateTable($table); + $this->sm->dropAndCreateTable($table); - $columns = $this->_sm->listTableColumns($tableName); + $columns = $this->sm->listTableColumns($tableName); self::assertArrayHasKey('col', $columns); self::assertArrayHasKey('col_unsigned', $columns); @@ -324,9 +324,9 @@ public function testListFloatTypeColumns() $table->addColumn('col', 'float'); $table->addColumn('col_unsigned', 'float', array('unsigned' => true)); - $this->_sm->dropAndCreateTable($table); + $this->sm->dropAndCreateTable($table); - $columns = $this->_sm->listTableColumns($tableName); + $columns = $this->sm->listTableColumns($tableName); self::assertArrayHasKey('col', $columns); self::assertArrayHasKey('col_unsigned', $columns); @@ -338,16 +338,16 @@ public function testJsonColumnType() : void { $table = new Table('test_mysql_json'); $table->addColumn('col_json', 'json'); - $this->_sm->dropAndCreateTable($table); + $this->sm->dropAndCreateTable($table); - $columns = $this->_sm->listTableColumns('test_mysql_json'); + $columns = $this->sm->listTableColumns('test_mysql_json'); self::assertSame(TYPE::JSON, $columns['col_json']->getType()->getName()); } public function testColumnDefaultCurrentTimestamp() : void { - $platform = $this->_sm->getDatabasePlatform(); + $platform = $this->sm->getDatabasePlatform(); $table = new Table("test_column_defaults_current_timestamp"); @@ -356,9 +356,9 @@ public function testColumnDefaultCurrentTimestamp() : void $table->addColumn('col_datetime', 'datetime', ['notnull' => true, 'default' => $currentTimeStampSql]); $table->addColumn('col_datetime_nullable', 'datetime', ['default' => $currentTimeStampSql]); - $this->_sm->dropAndCreateTable($table); + $this->sm->dropAndCreateTable($table); - $onlineTable = $this->_sm->listTableDetails("test_column_defaults_current_timestamp"); + $onlineTable = $this->sm->listTableDetails("test_column_defaults_current_timestamp"); self::assertSame($currentTimeStampSql, $onlineTable->getColumn('col_datetime')->getDefault()); self::assertSame($currentTimeStampSql, $onlineTable->getColumn('col_datetime_nullable')->getDefault()); @@ -372,7 +372,7 @@ public function testColumnDefaultsAreValid() { $table = new Table("test_column_defaults_are_valid"); - $currentTimeStampSql = $this->_sm->getDatabasePlatform()->getCurrentTimestampSQL(); + $currentTimeStampSql = $this->sm->getDatabasePlatform()->getCurrentTimestampSQL(); $table->addColumn('col_datetime', 'datetime', ['default' => $currentTimeStampSql]); $table->addColumn('col_datetime_null', 'datetime', ['notnull' => false, 'default' => null]); $table->addColumn('col_int', 'integer', ['default' => 1]); @@ -381,13 +381,13 @@ public function testColumnDefaultsAreValid() $table->addColumn('col_decimal', 'decimal', ['scale' => 3, 'precision' => 6, 'default' => -2.3]); $table->addColumn('col_date', 'date', ['default' => '2012-12-12']); - $this->_sm->dropAndCreateTable($table); + $this->sm->dropAndCreateTable($table); - $this->_conn->executeUpdate( + $this->conn->executeUpdate( "INSERT INTO test_column_defaults_are_valid () VALUES()" ); - $row = $this->_conn->fetchAssoc( + $row = $this->conn->fetchAssoc( 'SELECT *, DATEDIFF(CURRENT_TIMESTAMP(), col_datetime) as diff_seconds FROM test_column_defaults_are_valid' ); @@ -413,11 +413,11 @@ public function testColumnDefaultsAreValid() */ public function testColumnDefaultValuesCurrentTimeAndDate() : void { - if ( ! $this->_sm->getDatabasePlatform() instanceof MariaDb1027Platform) { + if ( ! $this->sm->getDatabasePlatform() instanceof MariaDb1027Platform) { $this->markTestSkipped('Only relevant for MariaDb102Platform.'); } - $platform = $this->_sm->getDatabasePlatform(); + $platform = $this->sm->getDatabasePlatform(); $table = new Table("test_column_defaults_current_time_and_date"); @@ -429,9 +429,9 @@ public function testColumnDefaultValuesCurrentTimeAndDate() : void $table->addColumn('col_date', 'date', ['default' => $currentDateSql]); $table->addColumn('col_time', 'time', ['default' => $currentTimeSql]); - $this->_sm->dropAndCreateTable($table); + $this->sm->dropAndCreateTable($table); - $onlineTable = $this->_sm->listTableDetails("test_column_defaults_current_time_and_date"); + $onlineTable = $this->sm->listTableDetails("test_column_defaults_current_time_and_date"); self::assertSame($currentTimestampSql, $onlineTable->getColumn('col_datetime')->getDefault()); self::assertSame($currentDateSql, $onlineTable->getColumn('col_date')->getDefault()); @@ -451,8 +451,8 @@ public function testColumnDefaultValuesCurrentTimeAndDate() : void */ public function testEnsureDefaultsAreUnescapedFromSchemaIntrospection() : void { - $platform = $this->_sm->getDatabasePlatform(); - $this->_conn->query('DROP TABLE IF EXISTS test_column_defaults_with_create'); + $platform = $this->sm->getDatabasePlatform(); + $this->conn->query('DROP TABLE IF EXISTS test_column_defaults_with_create'); $escapeSequences = [ "\\0", // An ASCII NUL (X'00') character @@ -473,8 +473,8 @@ public function testEnsureDefaultsAreUnescapedFromSchemaIntrospection() : void $sql = "CREATE TABLE test_column_defaults_with_create( col1 VARCHAR(255) NULL DEFAULT {$platform->quoteStringLiteral($default)} )"; - $this->_conn->query($sql); - $onlineTable = $this->_sm->listTableDetails("test_column_defaults_with_create"); + $this->conn->query($sql); + $onlineTable = $this->sm->listTableDetails("test_column_defaults_with_create"); self::assertSame($default, $onlineTable->getColumn('col1')->getDefault()); } } diff --git a/tests/Doctrine/Tests/DBAL/Functional/Schema/OracleSchemaManagerTest.php b/tests/Doctrine/Tests/DBAL/Functional/Schema/OracleSchemaManagerTest.php index 60a3493f267..6a9b358f349 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/Schema/OracleSchemaManagerTest.php +++ b/tests/Doctrine/Tests/DBAL/Functional/Schema/OracleSchemaManagerTest.php @@ -27,13 +27,13 @@ protected function setUp() public function testRenameTable() { - $this->_sm->tryMethod('DropTable', 'list_tables_test'); - $this->_sm->tryMethod('DropTable', 'list_tables_test_new_name'); + $this->sm->tryMethod('DropTable', 'list_tables_test'); + $this->sm->tryMethod('DropTable', 'list_tables_test_new_name'); $this->createTestTable('list_tables_test'); - $this->_sm->renameTable('list_tables_test', 'list_tables_test_new_name'); + $this->sm->renameTable('list_tables_test', 'list_tables_test_new_name'); - $tables = $this->_sm->listTables(); + $tables = $this->sm->listTables(); self::assertHasTable($tables, 'list_tables_test_new_name'); } @@ -48,9 +48,9 @@ public function testListTableWithBinary() $table->addColumn('column_binary', 'binary', array('fixed' => true)); $table->setPrimaryKey(array('id')); - $this->_sm->createTable($table); + $this->sm->createTable($table); - $table = $this->_sm->listTableDetails($tableName); + $table = $this->sm->listTableDetails($tableName); self::assertInstanceOf('Doctrine\DBAL\Types\BinaryType', $table->getColumn('column_varbinary')->getType()); self::assertFalse($table->getColumn('column_varbinary')->getFixed()); @@ -74,9 +74,9 @@ public function testAlterTableColumnNotNull() $table->addColumn('bar', 'string'); $table->setPrimaryKey(array('id')); - $this->_sm->dropAndCreateTable($table); + $this->sm->dropAndCreateTable($table); - $columns = $this->_sm->listTableColumns($tableName); + $columns = $this->sm->listTableColumns($tableName); self::assertTrue($columns['id']->getNotnull()); self::assertTrue($columns['foo']->getNotnull()); @@ -86,9 +86,9 @@ public function testAlterTableColumnNotNull() $diffTable->changeColumn('foo', array('notnull' => false)); $diffTable->changeColumn('bar', array('length' => 1024)); - $this->_sm->alterTable($comparator->diffTable($table, $diffTable)); + $this->sm->alterTable($comparator->diffTable($table, $diffTable)); - $columns = $this->_sm->listTableColumns($tableName); + $columns = $this->sm->listTableColumns($tableName); self::assertTrue($columns['id']->getNotnull()); self::assertFalse($columns['foo']->getNotnull()); @@ -102,7 +102,7 @@ public function testListDatabases() $sm->dropAndCreateDatabase('c##test_create_database'); - $databases = $this->_sm->listDatabases(); + $databases = $this->sm->listDatabases(); $databases = array_map('strtolower', $databases); self::assertContains('c##test_create_database', $databases); @@ -144,16 +144,16 @@ public function testListTableDetailsWithDifferentIdentifierQuotingRequirements() ); $offlineForeignTable->setPrimaryKey(array('id')); - $this->_sm->tryMethod('dropTable', $foreignTableName); - $this->_sm->tryMethod('dropTable', $primaryTableName); + $this->sm->tryMethod('dropTable', $foreignTableName); + $this->sm->tryMethod('dropTable', $primaryTableName); - $this->_sm->createTable($offlinePrimaryTable); - $this->_sm->createTable($offlineForeignTable); + $this->sm->createTable($offlinePrimaryTable); + $this->sm->createTable($offlineForeignTable); - $onlinePrimaryTable = $this->_sm->listTableDetails($primaryTableName); - $onlineForeignTable = $this->_sm->listTableDetails($foreignTableName); + $onlinePrimaryTable = $this->sm->listTableDetails($primaryTableName); + $onlineForeignTable = $this->sm->listTableDetails($foreignTableName); - $platform = $this->_sm->getDatabasePlatform(); + $platform = $this->sm->getDatabasePlatform(); // Primary table assertions self::assertSame($primaryTableName, $onlinePrimaryTable->getQuotedName($platform)); @@ -222,13 +222,13 @@ public function testListTableDetailsWithDifferentIdentifierQuotingRequirements() public function testListTableColumnsSameTableNamesInDifferentSchemas() { $table = $this->createListTableColumns(); - $this->_sm->dropAndCreateTable($table); + $this->sm->dropAndCreateTable($table); $otherTable = new Table($table->getName()); $otherTable->addColumn('id', Type::STRING); TestUtil::getTempConnection()->getSchemaManager()->dropAndCreateTable($otherTable); - $columns = $this->_sm->listTableColumns($table->getName(), $this->_conn->getUsername()); + $columns = $this->sm->listTableColumns($table->getName(), $this->conn->getUsername()); self::assertCount(7, $columns); } @@ -238,16 +238,16 @@ public function testListTableColumnsSameTableNamesInDifferentSchemas() public function testListTableIndexesPrimaryKeyConstraintNameDiffersFromIndexName() { $table = new Table('list_table_indexes_pk_id_test'); - $table->setSchemaConfig($this->_sm->createSchemaConfig()); + $table->setSchemaConfig($this->sm->createSchemaConfig()); $table->addColumn('id', 'integer', array('notnull' => true)); $table->addUniqueIndex(array('id'), 'id_unique_index'); - $this->_sm->dropAndCreateTable($table); + $this->sm->dropAndCreateTable($table); // Adding a primary key on already indexed columns // Oracle will reuse the unique index, which cause a constraint name differing from the index name - $this->_sm->createConstraint(new Schema\Index('id_pk_id_index', array('id'), true, true), 'list_table_indexes_pk_id_test'); + $this->sm->createConstraint(new Schema\Index('id_pk_id_index', array('id'), true, true), 'list_table_indexes_pk_id_test'); - $tableIndexes = $this->_sm->listTableIndexes('list_table_indexes_pk_id_test'); + $tableIndexes = $this->sm->listTableIndexes('list_table_indexes_pk_id_test'); self::assertArrayHasKey('primary', $tableIndexes, 'listTableIndexes() has to return a "primary" array key.'); self::assertEquals(array('id'), array_map('strtolower', $tableIndexes['primary']->getColumns())); @@ -265,9 +265,9 @@ public function testListTableDateTypeColumns() $table->addColumn('col_datetime', 'datetime'); $table->addColumn('col_datetimetz', 'datetimetz'); - $this->_sm->dropAndCreateTable($table); + $this->sm->dropAndCreateTable($table); - $columns = $this->_sm->listTableColumns('tbl_date'); + $columns = $this->sm->listTableColumns('tbl_date'); self::assertSame('date', $columns['col_date']->getType()->getName()); self::assertSame('datetime', $columns['col_datetime']->getType()->getName()); diff --git a/tests/Doctrine/Tests/DBAL/Functional/Schema/PostgreSqlSchemaManagerTest.php b/tests/Doctrine/Tests/DBAL/Functional/Schema/PostgreSqlSchemaManagerTest.php index 24efc5cc5b3..68fc1017096 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/Schema/PostgreSqlSchemaManagerTest.php +++ b/tests/Doctrine/Tests/DBAL/Functional/Schema/PostgreSqlSchemaManagerTest.php @@ -16,11 +16,11 @@ protected function tearDown() { parent::tearDown(); - if (!$this->_conn) { + if (!$this->conn) { return; } - $this->_conn->getConfiguration()->setFilterSchemaAssetsExpression(null); + $this->conn->getConfiguration()->setFilterSchemaAssetsExpression(null); } /** @@ -28,9 +28,9 @@ protected function tearDown() */ public function testGetSearchPath() { - $params = $this->_conn->getParams(); + $params = $this->conn->getParams(); - $paths = $this->_sm->getSchemaSearchPaths(); + $paths = $this->sm->getSchemaSearchPaths(); self::assertEquals([$params['user'], 'public'], $paths); } @@ -39,7 +39,7 @@ public function testGetSearchPath() */ public function testGetSchemaNames() { - $names = $this->_sm->getSchemaNames(); + $names = $this->sm->getSchemaNames(); self::assertInternalType('array', $names); self::assertNotEmpty($names); @@ -52,18 +52,18 @@ public function testGetSchemaNames() public function testSupportDomainTypeFallback() { $createDomainTypeSQL = "CREATE DOMAIN MyMoney AS DECIMAL(18,2)"; - $this->_conn->exec($createDomainTypeSQL); + $this->conn->exec($createDomainTypeSQL); $createTableSQL = "CREATE TABLE domain_type_test (id INT PRIMARY KEY, value MyMoney)"; - $this->_conn->exec($createTableSQL); + $this->conn->exec($createTableSQL); - $table = $this->_conn->getSchemaManager()->listTableDetails('domain_type_test'); + $table = $this->conn->getSchemaManager()->listTableDetails('domain_type_test'); self::assertInstanceOf('Doctrine\DBAL\Types\DecimalType', $table->getColumn('value')->getType()); Type::addType('MyMoney', 'Doctrine\Tests\DBAL\Functional\Schema\MoneyType'); - $this->_conn->getDatabasePlatform()->registerDoctrineTypeMapping('MyMoney', 'MyMoney'); + $this->conn->getDatabasePlatform()->registerDoctrineTypeMapping('MyMoney', 'MyMoney'); - $table = $this->_conn->getSchemaManager()->listTableDetails('domain_type_test'); + $table = $this->conn->getSchemaManager()->listTableDetails('domain_type_test'); self::assertInstanceOf('Doctrine\Tests\DBAL\Functional\Schema\MoneyType', $table->getColumn('value')->getType()); } @@ -75,8 +75,8 @@ public function testDetectsAutoIncrement() $autoincTable = new \Doctrine\DBAL\Schema\Table('autoinc_table'); $column = $autoincTable->addColumn('id', 'integer'); $column->setAutoincrement(true); - $this->_sm->createTable($autoincTable); - $autoincTable = $this->_sm->listTableDetails('autoinc_table'); + $this->sm->createTable($autoincTable); + $autoincTable = $this->sm->listTableDetails('autoinc_table'); self::assertTrue($autoincTable->getColumn('id')->getAutoincrement()); } @@ -88,8 +88,8 @@ public function testAlterTableAutoIncrementAdd() { $tableFrom = new \Doctrine\DBAL\Schema\Table('autoinc_table_add'); $column = $tableFrom->addColumn('id', 'integer'); - $this->_sm->createTable($tableFrom); - $tableFrom = $this->_sm->listTableDetails('autoinc_table_add'); + $this->sm->createTable($tableFrom); + $tableFrom = $this->sm->listTableDetails('autoinc_table_add'); self::assertFalse($tableFrom->getColumn('id')->getAutoincrement()); $tableTo = new \Doctrine\DBAL\Schema\Table('autoinc_table_add'); @@ -98,15 +98,15 @@ public function testAlterTableAutoIncrementAdd() $c = new \Doctrine\DBAL\Schema\Comparator(); $diff = $c->diffTable($tableFrom, $tableTo); - $sql = $this->_conn->getDatabasePlatform()->getAlterTableSQL($diff); + $sql = $this->conn->getDatabasePlatform()->getAlterTableSQL($diff); self::assertEquals(array( "CREATE SEQUENCE autoinc_table_add_id_seq", "SELECT setval('autoinc_table_add_id_seq', (SELECT MAX(id) FROM autoinc_table_add))", "ALTER TABLE autoinc_table_add ALTER id SET DEFAULT nextval('autoinc_table_add_id_seq')", ), $sql); - $this->_sm->alterTable($diff); - $tableFinal = $this->_sm->listTableDetails('autoinc_table_add'); + $this->sm->alterTable($diff); + $tableFinal = $this->sm->listTableDetails('autoinc_table_add'); self::assertTrue($tableFinal->getColumn('id')->getAutoincrement()); } @@ -118,8 +118,8 @@ public function testAlterTableAutoIncrementDrop() $tableFrom = new \Doctrine\DBAL\Schema\Table('autoinc_table_drop'); $column = $tableFrom->addColumn('id', 'integer'); $column->setAutoincrement(true); - $this->_sm->createTable($tableFrom); - $tableFrom = $this->_sm->listTableDetails('autoinc_table_drop'); + $this->sm->createTable($tableFrom); + $tableFrom = $this->sm->listTableDetails('autoinc_table_drop'); self::assertTrue($tableFrom->getColumn('id')->getAutoincrement()); $tableTo = new \Doctrine\DBAL\Schema\Table('autoinc_table_drop'); @@ -128,10 +128,10 @@ public function testAlterTableAutoIncrementDrop() $c = new \Doctrine\DBAL\Schema\Comparator(); $diff = $c->diffTable($tableFrom, $tableTo); self::assertInstanceOf('Doctrine\DBAL\Schema\TableDiff', $diff, "There should be a difference and not false being returned from the table comparison"); - self::assertEquals(array("ALTER TABLE autoinc_table_drop ALTER id DROP DEFAULT"), $this->_conn->getDatabasePlatform()->getAlterTableSQL($diff)); + self::assertEquals(array("ALTER TABLE autoinc_table_drop ALTER id DROP DEFAULT"), $this->conn->getDatabasePlatform()->getAlterTableSQL($diff)); - $this->_sm->alterTable($diff); - $tableFinal = $this->_sm->listTableDetails('autoinc_table_drop'); + $this->sm->alterTable($diff); + $tableFinal = $this->sm->listTableDetails('autoinc_table_drop'); self::assertFalse($tableFinal->getColumn('id')->getAutoincrement()); } @@ -140,7 +140,7 @@ public function testAlterTableAutoIncrementDrop() */ public function testTableWithSchema() { - $this->_conn->exec('CREATE SCHEMA nested'); + $this->conn->exec('CREATE SCHEMA nested'); $nestedRelatedTable = new \Doctrine\DBAL\Schema\Table('nested.schemarelated'); $column = $nestedRelatedTable->addColumn('id', 'integer'); @@ -153,13 +153,13 @@ public function testTableWithSchema() $nestedSchemaTable->setPrimaryKey(array('id')); $nestedSchemaTable->addUnnamedForeignKeyConstraint($nestedRelatedTable, array('id'), array('id')); - $this->_sm->createTable($nestedRelatedTable); - $this->_sm->createTable($nestedSchemaTable); + $this->sm->createTable($nestedRelatedTable); + $this->sm->createTable($nestedSchemaTable); - $tables = $this->_sm->listTableNames(); + $tables = $this->sm->listTableNames(); self::assertContains('nested.schematable', $tables, "The table should be detected with its non-public schema."); - $nestedSchemaTable = $this->_sm->listTableDetails('nested.schematable'); + $nestedSchemaTable = $this->sm->listTableDetails('nested.schematable'); self::assertTrue($nestedSchemaTable->hasColumn('id')); self::assertEquals(array('id'), $nestedSchemaTable->getPrimaryKey()->getColumns()); @@ -176,19 +176,19 @@ public function testTableWithSchema() public function testReturnQuotedAssets() { $sql = 'create table dbal91_something ( id integer CONSTRAINT id_something PRIMARY KEY NOT NULL ,"table" integer );'; - $this->_conn->exec($sql); + $this->conn->exec($sql); $sql = 'ALTER TABLE dbal91_something ADD CONSTRAINT something_input FOREIGN KEY( "table" ) REFERENCES dbal91_something ON UPDATE CASCADE;'; - $this->_conn->exec($sql); + $this->conn->exec($sql); - $table = $this->_sm->listTableDetails('dbal91_something'); + $table = $this->sm->listTableDetails('dbal91_something'); self::assertEquals( array( "CREATE TABLE dbal91_something (id INT NOT NULL, \"table\" INT DEFAULT NULL, PRIMARY KEY(id))", "CREATE INDEX IDX_A9401304ECA7352B ON dbal91_something (\"table\")", ), - $this->_conn->getDatabasePlatform()->getCreateTableSQL($table) + $this->conn->getDatabasePlatform()->getCreateTableSQL($table) ); } @@ -199,23 +199,23 @@ public function testFilterSchemaExpression() { $testTable = new \Doctrine\DBAL\Schema\Table('dbal204_test_prefix'); $column = $testTable->addColumn('id', 'integer'); - $this->_sm->createTable($testTable); + $this->sm->createTable($testTable); $testTable = new \Doctrine\DBAL\Schema\Table('dbal204_without_prefix'); $column = $testTable->addColumn('id', 'integer'); - $this->_sm->createTable($testTable); + $this->sm->createTable($testTable); - $this->_conn->getConfiguration()->setFilterSchemaAssetsExpression('#^dbal204_#'); - $names = $this->_sm->listTableNames(); + $this->conn->getConfiguration()->setFilterSchemaAssetsExpression('#^dbal204_#'); + $names = $this->sm->listTableNames(); self::assertCount(2, $names); - $this->_conn->getConfiguration()->setFilterSchemaAssetsExpression('#^dbal204_test#'); - $names = $this->_sm->listTableNames(); + $this->conn->getConfiguration()->setFilterSchemaAssetsExpression('#^dbal204_test#'); + $names = $this->sm->listTableNames(); self::assertCount(1, $names); } public function testListForeignKeys() { - if(!$this->_conn->getDatabasePlatform()->supportsForeignKeyConstraints()) { + if(!$this->conn->getDatabasePlatform()->supportsForeignKeyConstraints()) { $this->markTestSkipped('Does not support foreign key constraints.'); } @@ -227,13 +227,13 @@ public function testListForeignKeys() $foreignKeys[] = new \Doctrine\DBAL\Schema\ForeignKeyConstraint( array("foreign_key_test$i"), 'test_create_fk2', array('id'), "foreign_key_test_$i"."_fk", array('onDelete' => $fkOptions[$i])); } - $this->_sm->dropAndCreateTable($fkTable); + $this->sm->dropAndCreateTable($fkTable); $this->createTestTable('test_create_fk2'); foreach($foreignKeys as $foreignKey) { - $this->_sm->createForeignKey($foreignKey, 'test_create_fk1'); + $this->sm->createForeignKey($foreignKey, 'test_create_fk1'); } - $fkeys = $this->_sm->listTableForeignKeys('test_create_fk1'); + $fkeys = $this->sm->listTableForeignKeys('test_create_fk1'); self::assertEquals(count($foreignKeys), count($fkeys), "Table 'test_create_fk1' has to have " . count($foreignKeys) . " foreign keys."); for ($i = 0; $i < count($fkeys); $i++) { self::assertEquals(array("foreign_key_test$i"), array_map('strtolower', $fkeys[$i]->getLocalColumns())); @@ -257,9 +257,9 @@ public function testDefaultValueCharacterVarying() $testTable->addColumn('def', 'string', array('default' => 'foo')); $testTable->setPrimaryKey(array('id')); - $this->_sm->createTable($testTable); + $this->sm->createTable($testTable); - $databaseTable = $this->_sm->listTableDetails($testTable->getName()); + $databaseTable = $this->sm->listTableDetails($testTable->getName()); self::assertEquals('foo', $databaseTable->getColumn('def')->getDefault()); } @@ -273,9 +273,9 @@ public function testBooleanDefault() $table->addColumn('id', 'integer'); $table->addColumn('checked', 'boolean', array('default' => false)); - $this->_sm->createTable($table); + $this->sm->createTable($table); - $databaseTable = $this->_sm->listTableDetails($table->getName()); + $databaseTable = $this->sm->listTableDetails($table->getName()); $c = new \Doctrine\DBAL\Schema\Comparator(); $diff = $c->diffTable($table, $databaseTable); @@ -293,9 +293,9 @@ public function testListTableWithBinary() $table->addColumn('column_binary', 'binary', array('fixed' => true)); $table->setPrimaryKey(array('id')); - $this->_sm->createTable($table); + $this->sm->createTable($table); - $table = $this->_sm->listTableDetails($tableName); + $table = $this->sm->listTableDetails($tableName); self::assertInstanceOf('Doctrine\DBAL\Types\BlobType', $table->getColumn('column_varbinary')->getType()); self::assertFalse($table->getColumn('column_varbinary')->getFixed()); @@ -313,9 +313,9 @@ public function testListQuotedTable() $offlineTable->setPrimaryKey(array('id')); $offlineTable->addForeignKeyConstraint($offlineTable, array('fk'), array('id')); - $this->_sm->dropAndCreateTable($offlineTable); + $this->sm->dropAndCreateTable($offlineTable); - $onlineTable = $this->_sm->listTableDetails('"user"'); + $onlineTable = $this->sm->listTableDetails('"user"'); $comparator = new Schema\Comparator(); @@ -331,9 +331,9 @@ public function testListTablesExcludesViews() $view = new Schema\View($name, $sql); - $this->_sm->dropAndCreateView($view); + $this->sm->dropAndCreateView($view); - $tables = $this->_sm->listTables(); + $tables = $this->sm->listTables(); $foundTable = false; foreach ($tables as $table) { @@ -357,9 +357,9 @@ public function testPartialIndexes() $offlineTable->addColumn('email', 'string'); $offlineTable->addUniqueIndex(array('id', 'name'), 'simple_partial_index', array('where' => '(id IS NULL)')); - $this->_sm->dropAndCreateTable($offlineTable); + $this->sm->dropAndCreateTable($offlineTable); - $onlineTable = $this->_sm->listTableDetails('person'); + $onlineTable = $this->sm->listTableDetails('person'); $comparator = new Schema\Comparator(); @@ -374,17 +374,17 @@ public function testPartialIndexes() */ public function testJsonbColumn(string $type): void { - if (!$this->_sm->getDatabasePlatform() instanceof PostgreSQL94Platform) { + if (!$this->sm->getDatabasePlatform() instanceof PostgreSQL94Platform) { $this->markTestSkipped("Requires PostgresSQL 9.4+"); return; } $table = new Schema\Table('test_jsonb'); $table->addColumn('foo', $type)->setPlatformOption('jsonb', true); - $this->_sm->dropAndCreateTable($table); + $this->sm->dropAndCreateTable($table); /** @var Schema\Column[] $columns */ - $columns = $this->_sm->listTableColumns('test_jsonb'); + $columns = $this->sm->listTableColumns('test_jsonb'); self::assertSame($type, $columns['foo']->getType()->getName()); self::assertTrue(true, $columns['foo']->getPlatformOption('jsonb')); @@ -411,9 +411,9 @@ public function testListNegativeColumnDefaultValue() $table->addColumn('col_decimal', 'decimal', array('default' => -1.1)); $table->addColumn('col_string', 'string', array('default' => '(-1)')); - $this->_sm->dropAndCreateTable($table); + $this->sm->dropAndCreateTable($table); - $columns = $this->_sm->listTableColumns('test_default_negative'); + $columns = $this->sm->listTableColumns('test_default_negative'); self::assertEquals(-1, $columns['col_smallint']->getDefault()); self::assertEquals(-1, $columns['col_integer']->getDefault()); @@ -442,9 +442,9 @@ public function testAutoIncrementCreatesSerialDataTypesWithoutADefaultValue(stri $table = new Schema\Table($tableName); $table->addColumn('id', $type, ['autoincrement' => true, 'notnull' => false]); - $this->_sm->dropAndCreateTable($table); + $this->sm->dropAndCreateTable($table); - $columns = $this->_sm->listTableColumns($tableName); + $columns = $this->sm->listTableColumns($tableName); self::assertNull($columns['id']->getDefault()); } @@ -460,9 +460,9 @@ public function testAutoIncrementCreatesSerialDataTypesWithoutADefaultValueEvenW $table = new Schema\Table($tableName); $table->addColumn('id', $type, ['autoincrement' => true, 'notnull' => false, 'default' => 1]); - $this->_sm->dropAndCreateTable($table); + $this->sm->dropAndCreateTable($table); - $columns = $this->_sm->listTableColumns($tableName); + $columns = $this->sm->listTableColumns($tableName); self::assertNull($columns['id']->getDefault()); } @@ -477,8 +477,8 @@ public function testAlterTableAutoIncrementIntToBigInt(string $from, string $to, $tableFrom = new Table('autoinc_type_modification'); $column = $tableFrom->addColumn('id', $from); $column->setAutoincrement(true); - $this->_sm->dropAndCreateTable($tableFrom); - $tableFrom = $this->_sm->listTableDetails('autoinc_type_modification'); + $this->sm->dropAndCreateTable($tableFrom); + $tableFrom = $this->sm->listTableDetails('autoinc_type_modification'); self::assertTrue($tableFrom->getColumn('id')->getAutoincrement()); $tableTo = new Table('autoinc_type_modification'); @@ -488,10 +488,10 @@ public function testAlterTableAutoIncrementIntToBigInt(string $from, string $to, $c = new Comparator(); $diff = $c->diffTable($tableFrom, $tableTo); self::assertInstanceOf(TableDiff::class, $diff, "There should be a difference and not false being returned from the table comparison"); - self::assertSame(['ALTER TABLE autoinc_type_modification ALTER id TYPE ' . $expected], $this->_conn->getDatabasePlatform()->getAlterTableSQL($diff)); + self::assertSame(['ALTER TABLE autoinc_type_modification ALTER id TYPE ' . $expected], $this->conn->getDatabasePlatform()->getAlterTableSQL($diff)); - $this->_sm->alterTable($diff); - $tableFinal = $this->_sm->listTableDetails('autoinc_type_modification'); + $this->sm->alterTable($diff); + $tableFinal = $this->sm->listTableDetails('autoinc_type_modification'); self::assertTrue($tableFinal->getColumn('id')->getAutoincrement()); } diff --git a/tests/Doctrine/Tests/DBAL/Functional/Schema/SQLAnywhereSchemaManagerTest.php b/tests/Doctrine/Tests/DBAL/Functional/Schema/SQLAnywhereSchemaManagerTest.php index 996e91699bb..f3c9dbefeb6 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/Schema/SQLAnywhereSchemaManagerTest.php +++ b/tests/Doctrine/Tests/DBAL/Functional/Schema/SQLAnywhereSchemaManagerTest.php @@ -17,9 +17,9 @@ public function testCreateAndListViews() $view = new View($name, $sql); - $this->_sm->dropAndCreateView($view); + $this->sm->dropAndCreateView($view); - $views = $this->_sm->listViews(); + $views = $this->sm->listViews(); self::assertCount(1, $views, "Database has to have one view."); self::assertInstanceOf('Doctrine\DBAL\Schema\View', $views[$name]); @@ -30,13 +30,13 @@ public function testCreateAndListViews() public function testDropAndCreateAdvancedIndex() { $table = $this->getTestTable('test_create_advanced_index'); - $this->_sm->dropAndCreateTable($table); - $this->_sm->dropAndCreateIndex( + $this->sm->dropAndCreateTable($table); + $this->sm->dropAndCreateIndex( new Index('test', array('test'), true, false, array('clustered', 'with_nulls_not_distinct', 'for_olap_workload')), $table->getName() ); - $tableIndexes = $this->_sm->listTableIndexes('test_create_advanced_index'); + $tableIndexes = $this->sm->listTableIndexes('test_create_advanced_index'); self::assertInternalType('array', $tableIndexes); self::assertEquals('test', $tableIndexes['test']->getName()); self::assertEquals(array('test'), $tableIndexes['test']->getColumns()); @@ -54,9 +54,9 @@ public function testListTableColumnsWithFixedStringTypeColumn() $table->addColumn('test', 'string', array('fixed' => true)); $table->setPrimaryKey(array('id')); - $this->_sm->dropAndCreateTable($table); + $this->sm->dropAndCreateTable($table); - $columns = $this->_sm->listTableColumns('list_table_columns_char'); + $columns = $this->sm->listTableColumns('list_table_columns_char'); self::assertArrayHasKey('test', $columns); self::assertTrue($columns['test']->getFixed()); diff --git a/tests/Doctrine/Tests/DBAL/Functional/Schema/SQLServerSchemaManagerTest.php b/tests/Doctrine/Tests/DBAL/Functional/Schema/SQLServerSchemaManagerTest.php index 5dd22bd74cf..aebd3339eb9 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/Schema/SQLServerSchemaManagerTest.php +++ b/tests/Doctrine/Tests/DBAL/Functional/Schema/SQLServerSchemaManagerTest.php @@ -24,14 +24,14 @@ public function testDropColumnConstraints() $table->addColumn('id', 'integer'); $table->addColumn('todrop', 'decimal', array('default' => 10.2)); - $this->_sm->createTable($table); + $this->sm->createTable($table); $diff = new TableDiff('sqlsrv_drop_column', array(), array(), array( new Column('todrop', Type::getType('decimal')) )); - $this->_sm->alterTable($diff); + $this->sm->alterTable($diff); - $columns = $this->_sm->listTableColumns('sqlsrv_drop_column'); + $columns = $this->sm->listTableColumns('sqlsrv_drop_column'); self::assertCount(1, $columns); } @@ -40,22 +40,22 @@ public function testColumnCollation() $table = new \Doctrine\DBAL\Schema\Table($tableName = 'test_collation'); $column = $table->addColumn($columnName = 'test', 'string'); - $this->_sm->dropAndCreateTable($table); - $columns = $this->_sm->listTableColumns($tableName); + $this->sm->dropAndCreateTable($table); + $columns = $this->sm->listTableColumns($tableName); self::assertTrue($columns[$columnName]->hasPlatformOption('collation')); // SQL Server should report a default collation on the column $column->setPlatformOption('collation', $collation = 'Icelandic_CS_AS'); - $this->_sm->dropAndCreateTable($table); - $columns = $this->_sm->listTableColumns($tableName); + $this->sm->dropAndCreateTable($table); + $columns = $this->sm->listTableColumns($tableName); self::assertEquals($collation, $columns[$columnName]->getPlatformOption('collation')); } public function testDefaultConstraints() { - $platform = $this->_sm->getDatabasePlatform(); + $platform = $this->sm->getDatabasePlatform(); $table = new Table('sqlsrv_default_constraints'); $table->addColumn('no_default', 'string'); $table->addColumn('df_integer', 'integer', array('default' => 666)); @@ -67,8 +67,8 @@ public function testDefaultConstraints() $table->addColumn('df_current_date', 'date', array('default' => $platform->getCurrentDateSQL())); $table->addColumn('df_current_time', 'time', array('default' => $platform->getCurrentTimeSQL())); - $this->_sm->createTable($table); - $columns = $this->_sm->listTableColumns('sqlsrv_default_constraints'); + $this->sm->createTable($table); + $columns = $this->sm->listTableColumns('sqlsrv_default_constraints'); self::assertNull($columns['no_default']->getDefault()); self::assertEquals(666, $columns['df_integer']->getDefault()); @@ -125,8 +125,8 @@ public function testDefaultConstraints() array('default' => 'column to rename') ); - $this->_sm->alterTable($diff); - $columns = $this->_sm->listTableColumns('sqlsrv_default_constraints'); + $this->sm->alterTable($diff); + $columns = $this->sm->listTableColumns('sqlsrv_default_constraints'); self::assertNull($columns['no_default']->getDefault()); self::assertEquals('CURRENT_TIMESTAMP', $columns['df_current_timestamp']->getDefault()); @@ -163,8 +163,8 @@ public function testDefaultConstraints() $table ); - $this->_sm->alterTable($diff); - $columns = $this->_sm->listTableColumns('sqlsrv_default_constraints'); + $this->sm->alterTable($diff); + $columns = $this->sm->listTableColumns('sqlsrv_default_constraints'); self::assertNull($columns['df_current_timestamp']->getDefault()); self::assertEquals(666, $columns['df_integer']->getDefault()); @@ -190,9 +190,9 @@ public function testColumnComments() $table->addColumn('commented_type_with_comment', 'array', array('comment' => 'Doctrine array type.')); $table->setPrimaryKey(array('id')); - $this->_sm->createTable($table); + $this->sm->createTable($table); - $columns = $this->_sm->listTableColumns("sqlsrv_column_comment"); + $columns = $this->sm->listTableColumns("sqlsrv_column_comment"); self::assertCount(12, $columns); self::assertNull($columns['id']->getComment()); self::assertNull($columns['comment_null']->getComment()); @@ -306,9 +306,9 @@ public function testColumnComments() $tableDiff->removedColumns['comment_integer_0'] = new Column('comment_integer_0', Type::getType('integer'), array('comment' => 0)); - $this->_sm->alterTable($tableDiff); + $this->sm->alterTable($tableDiff); - $columns = $this->_sm->listTableColumns("sqlsrv_column_comment"); + $columns = $this->sm->listTableColumns("sqlsrv_column_comment"); self::assertCount(23, $columns); self::assertEquals('primary', $columns['id']->getComment()); self::assertNull($columns['comment_null']->getComment()); @@ -348,9 +348,9 @@ public function testPkOrdering() $table->addColumn('colA', 'integer', array('notnull' => true)); $table->addColumn('colB', 'integer', array('notnull' => true)); $table->setPrimaryKey(array('colB', 'colA')); - $this->_sm->createTable($table); + $this->sm->createTable($table); - $indexes = $this->_sm->listTableIndexes('sqlsrv_pk_ordering'); + $indexes = $this->sm->listTableIndexes('sqlsrv_pk_ordering'); self::assertCount(1, $indexes); diff --git a/tests/Doctrine/Tests/DBAL/Functional/Schema/SchemaManagerFunctionalTestCase.php b/tests/Doctrine/Tests/DBAL/Functional/Schema/SchemaManagerFunctionalTestCase.php index 4f838f9634d..4d1f96dbe31 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/Schema/SchemaManagerFunctionalTestCase.php +++ b/tests/Doctrine/Tests/DBAL/Functional/Schema/SchemaManagerFunctionalTestCase.php @@ -18,7 +18,7 @@ class SchemaManagerFunctionalTestCase extends \Doctrine\Tests\DbalFunctionalTest /** * @var \Doctrine\DBAL\Schema\AbstractSchemaManager */ - protected $_sm; + protected $sm; protected function getPlatformName() { @@ -35,11 +35,11 @@ protected function setUp() $dbms = $this->getPlatformName(); - if ($this->_conn->getDatabasePlatform()->getName() !== $dbms) { + if ($this->conn->getDatabasePlatform()->getName() !== $dbms) { $this->markTestSkipped(get_class($this) . ' requires the use of ' . $dbms); } - $this->_sm = $this->_conn->getSchemaManager(); + $this->sm = $this->conn->getSchemaManager(); } /** @@ -47,21 +47,21 @@ protected function setUp() */ public function testDropsDatabaseWithActiveConnections() { - if (! $this->_sm->getDatabasePlatform()->supportsCreateDropDatabase()) { + if (! $this->sm->getDatabasePlatform()->supportsCreateDropDatabase()) { $this->markTestSkipped('Cannot drop Database client side with this Driver.'); } - $this->_sm->dropAndCreateDatabase('test_drop_database'); + $this->sm->dropAndCreateDatabase('test_drop_database'); - $knownDatabases = $this->_sm->listDatabases(); - if ($this->_conn->getDatabasePlatform() instanceof OraclePlatform) { + $knownDatabases = $this->sm->listDatabases(); + if ($this->conn->getDatabasePlatform() instanceof OraclePlatform) { self::assertContains('TEST_DROP_DATABASE', $knownDatabases); } else { self::assertContains('test_drop_database', $knownDatabases); } - $params = $this->_conn->getParams(); - if ($this->_conn->getDatabasePlatform() instanceof OraclePlatform) { + $params = $this->conn->getParams(); + if ($this->conn->getDatabasePlatform() instanceof OraclePlatform) { $params['user'] = 'test_drop_database'; } else { $params['dbname'] = 'test_drop_database'; @@ -70,13 +70,13 @@ public function testDropsDatabaseWithActiveConnections() $user = $params['user'] ?? null; $password = $params['password'] ?? null; - $connection = $this->_conn->getDriver()->connect($params, $user, $password); + $connection = $this->conn->getDriver()->connect($params, $user, $password); self::assertInstanceOf('Doctrine\DBAL\Driver\Connection', $connection); - $this->_sm->dropDatabase('test_drop_database'); + $this->sm->dropDatabase('test_drop_database'); - self::assertNotContains('test_drop_database', $this->_sm->listDatabases()); + self::assertNotContains('test_drop_database', $this->sm->listDatabases()); } /** @@ -84,15 +84,15 @@ public function testDropsDatabaseWithActiveConnections() */ public function testDropAndCreateSequence() { - if ( ! $this->_conn->getDatabasePlatform()->supportsSequences()) { - $this->markTestSkipped($this->_conn->getDriver()->getName().' does not support sequences.'); + if ( ! $this->conn->getDatabasePlatform()->supportsSequences()) { + $this->markTestSkipped($this->conn->getDriver()->getName().' does not support sequences.'); } $name = 'dropcreate_sequences_test_seq'; - $this->_sm->dropAndCreateSequence(new \Doctrine\DBAL\Schema\Sequence($name, 20, 10)); + $this->sm->dropAndCreateSequence(new \Doctrine\DBAL\Schema\Sequence($name, 20, 10)); - self::assertTrue($this->hasElementWithName($this->_sm->listSequences(), $name)); + self::assertTrue($this->hasElementWithName($this->sm->listSequences(), $name)); } private function hasElementWithName(array $items, string $name) : bool @@ -109,14 +109,14 @@ function (\Doctrine\DBAL\Schema\AbstractAsset $item) use ($name) : bool { public function testListSequences() { - if(!$this->_conn->getDatabasePlatform()->supportsSequences()) { - $this->markTestSkipped($this->_conn->getDriver()->getName().' does not support sequences.'); + if(!$this->conn->getDatabasePlatform()->supportsSequences()) { + $this->markTestSkipped($this->conn->getDriver()->getName().' does not support sequences.'); } $sequence = new \Doctrine\DBAL\Schema\Sequence('list_sequences_test_seq', 20, 10); - $this->_sm->createSequence($sequence); + $this->sm->createSequence($sequence); - $sequences = $this->_sm->listSequences(); + $sequences = $this->sm->listSequences(); self::assertInternalType('array', $sequences, 'listSequences() should return an array.'); @@ -135,12 +135,12 @@ public function testListSequences() public function testListDatabases() { - if (!$this->_sm->getDatabasePlatform()->supportsCreateDropDatabase()) { + if (!$this->sm->getDatabasePlatform()->supportsCreateDropDatabase()) { $this->markTestSkipped('Cannot drop Database client side with this Driver.'); } - $this->_sm->dropAndCreateDatabase('test_create_database'); - $databases = $this->_sm->listDatabases(); + $this->sm->dropAndCreateDatabase('test_create_database'); + $databases = $this->sm->listDatabases(); $databases = array_map('strtolower', $databases); @@ -152,18 +152,18 @@ public function testListDatabases() */ public function testListNamespaceNames() { - if (!$this->_sm->getDatabasePlatform()->supportsSchemas()) { + if (!$this->sm->getDatabasePlatform()->supportsSchemas()) { $this->markTestSkipped('Platform does not support schemas.'); } // Currently dropping schemas is not supported, so we have to workaround here. - $namespaces = $this->_sm->listNamespaceNames(); + $namespaces = $this->sm->listNamespaceNames(); $namespaces = array_map('strtolower', $namespaces); if (!in_array('test_create_schema', $namespaces)) { - $this->_conn->executeUpdate($this->_sm->getDatabasePlatform()->getCreateSchemaSQL('test_create_schema')); + $this->conn->executeUpdate($this->sm->getDatabasePlatform()->getCreateSchemaSQL('test_create_schema')); - $namespaces = $this->_sm->listNamespaceNames(); + $namespaces = $this->sm->listNamespaceNames(); $namespaces = array_map('strtolower', $namespaces); } @@ -173,7 +173,7 @@ public function testListNamespaceNames() public function testListTables() { $this->createTestTable('list_tables_test'); - $tables = $this->_sm->listTables(); + $tables = $this->sm->listTables(); self::assertInternalType('array', $tables); self::assertTrue(count($tables) > 0, "List Tables has to find at least one table named 'list_tables_test'."); @@ -212,9 +212,9 @@ public function testListTableColumns() { $table = $this->createListTableColumns(); - $this->_sm->dropAndCreateTable($table); + $this->sm->dropAndCreateTable($table); - $columns = $this->_sm->listTableColumns('list_table_columns'); + $columns = $this->sm->listTableColumns('list_table_columns'); $columnsKeys = array_keys($columns); self::assertArrayHasKey('id', $columns); @@ -289,9 +289,9 @@ public function testListTableColumnsWithFixedStringColumn() $table = new Table($tableName); $table->addColumn('column_char', 'string', array('fixed' => true, 'length' => 2)); - $this->_sm->createTable($table); + $this->sm->createTable($table); - $columns = $this->_sm->listTableColumns($tableName); + $columns = $this->sm->listTableColumns($tableName); self::assertArrayHasKey('column_char', $columns); self::assertInstanceOf('Doctrine\DBAL\Types\StringType', $columns['column_char']->getType()); @@ -303,7 +303,7 @@ public function testListTableColumnsDispatchEvent() { $table = $this->createListTableColumns(); - $this->_sm->dropAndCreateTable($table); + $this->sm->dropAndCreateTable($table); $listenerMock = $this ->getMockBuilder('ListTableColumnsDispatchEventListener') @@ -313,16 +313,16 @@ public function testListTableColumnsDispatchEvent() ->expects($this->exactly(7)) ->method('onSchemaColumnDefinition'); - $oldEventManager = $this->_sm->getDatabasePlatform()->getEventManager(); + $oldEventManager = $this->sm->getDatabasePlatform()->getEventManager(); $eventManager = new EventManager(); $eventManager->addEventListener(array(Events::onSchemaColumnDefinition), $listenerMock); - $this->_sm->getDatabasePlatform()->setEventManager($eventManager); + $this->sm->getDatabasePlatform()->setEventManager($eventManager); - $this->_sm->listTableColumns('list_table_columns'); + $this->sm->listTableColumns('list_table_columns'); - $this->_sm->getDatabasePlatform()->setEventManager($oldEventManager); + $this->sm->getDatabasePlatform()->setEventManager($oldEventManager); } public function testListTableIndexesDispatchEvent() @@ -331,7 +331,7 @@ public function testListTableIndexesDispatchEvent() $table->addUniqueIndex(array('test'), 'test_index_name'); $table->addIndex(array('id', 'test'), 'test_composite_idx'); - $this->_sm->dropAndCreateTable($table); + $this->sm->dropAndCreateTable($table); $listenerMock = $this ->getMockBuilder('ListTableIndexesDispatchEventListener') @@ -341,27 +341,27 @@ public function testListTableIndexesDispatchEvent() ->expects($this->exactly(3)) ->method('onSchemaIndexDefinition'); - $oldEventManager = $this->_sm->getDatabasePlatform()->getEventManager(); + $oldEventManager = $this->sm->getDatabasePlatform()->getEventManager(); $eventManager = new EventManager(); $eventManager->addEventListener(array(Events::onSchemaIndexDefinition), $listenerMock); - $this->_sm->getDatabasePlatform()->setEventManager($eventManager); + $this->sm->getDatabasePlatform()->setEventManager($eventManager); - $this->_sm->listTableIndexes('list_table_indexes_test'); + $this->sm->listTableIndexes('list_table_indexes_test'); - $this->_sm->getDatabasePlatform()->setEventManager($oldEventManager); + $this->sm->getDatabasePlatform()->setEventManager($oldEventManager); } public function testDiffListTableColumns() { - if ($this->_sm->getDatabasePlatform()->getName() == 'oracle') { + if ($this->sm->getDatabasePlatform()->getName() == 'oracle') { $this->markTestSkipped('Does not work with Oracle, since it cannot detect DateTime, Date and Time differenecs (at the moment).'); } $offlineTable = $this->createListTableColumns(); - $this->_sm->dropAndCreateTable($offlineTable); - $onlineTable = $this->_sm->listTableDetails('list_table_columns'); + $this->sm->dropAndCreateTable($offlineTable); + $onlineTable = $this->sm->listTableDetails('list_table_columns'); $comparator = new \Doctrine\DBAL\Schema\Comparator(); $diff = $comparator->diffTable($offlineTable, $onlineTable); @@ -375,9 +375,9 @@ public function testListTableIndexes() $table->addUniqueIndex(array('test'), 'test_index_name'); $table->addIndex(array('id', 'test'), 'test_composite_idx'); - $this->_sm->dropAndCreateTable($table); + $this->sm->dropAndCreateTable($table); - $tableIndexes = $this->_sm->listTableIndexes('list_table_indexes_test'); + $tableIndexes = $this->sm->listTableIndexes('list_table_indexes_test'); self::assertEquals(3, count($tableIndexes)); @@ -401,10 +401,10 @@ public function testDropAndCreateIndex() { $table = $this->getTestTable('test_create_index'); $table->addUniqueIndex(array('test'), 'test'); - $this->_sm->dropAndCreateTable($table); + $this->sm->dropAndCreateTable($table); - $this->_sm->dropAndCreateIndex($table->getIndex('test'), $table); - $tableIndexes = $this->_sm->listTableIndexes('test_create_index'); + $this->sm->dropAndCreateIndex($table->getIndex('test'), $table); + $tableIndexes = $this->sm->listTableIndexes('test_create_index'); self::assertInternalType('array', $tableIndexes); self::assertEquals('test', strtolower($tableIndexes['test']->getName())); @@ -415,20 +415,20 @@ public function testDropAndCreateIndex() public function testCreateTableWithForeignKeys() { - if(!$this->_sm->getDatabasePlatform()->supportsForeignKeyConstraints()) { + if(!$this->sm->getDatabasePlatform()->supportsForeignKeyConstraints()) { $this->markTestSkipped('Platform does not support foreign keys.'); } $tableB = $this->getTestTable('test_foreign'); - $this->_sm->dropAndCreateTable($tableB); + $this->sm->dropAndCreateTable($tableB); $tableA = $this->getTestTable('test_create_fk'); $tableA->addForeignKeyConstraint('test_foreign', array('foreign_key_test'), array('id')); - $this->_sm->dropAndCreateTable($tableA); + $this->sm->dropAndCreateTable($tableA); - $fkTable = $this->_sm->listTableDetails('test_create_fk'); + $fkTable = $this->sm->listTableDetails('test_create_fk'); $fkConstraints = $fkTable->getForeignKeys(); self::assertEquals(1, count($fkConstraints), "Table 'test_create_fk1' has to have one foreign key."); @@ -443,7 +443,7 @@ public function testCreateTableWithForeignKeys() public function testListForeignKeys() { - if(!$this->_conn->getDatabasePlatform()->supportsForeignKeyConstraints()) { + if(!$this->conn->getDatabasePlatform()->supportsForeignKeyConstraints()) { $this->markTestSkipped('Does not support foreign key constraints.'); } @@ -454,9 +454,9 @@ public function testListForeignKeys() array('foreign_key_test'), 'test_create_fk2', array('id'), 'foreign_key_test_fk', array('onDelete' => 'CASCADE') ); - $this->_sm->createForeignKey($foreignKey, 'test_create_fk1'); + $this->sm->createForeignKey($foreignKey, 'test_create_fk1'); - $fkeys = $this->_sm->listTableForeignKeys('test_create_fk1'); + $fkeys = $this->sm->listTableForeignKeys('test_create_fk1'); self::assertEquals(1, count($fkeys), "Table 'test_create_fk1' has to have one foreign key."); @@ -479,20 +479,20 @@ public function testCreateSchema() { $this->createTestTable('test_table'); - $schema = $this->_sm->createSchema(); + $schema = $this->sm->createSchema(); self::assertTrue($schema->hasTable('test_table')); } public function testAlterTableScenario() { - if(!$this->_sm->getDatabasePlatform()->supportsAlterTable()) { + if(!$this->sm->getDatabasePlatform()->supportsAlterTable()) { $this->markTestSkipped('Alter Table is not supported by this platform.'); } $alterTable = $this->createTestTable('alter_table'); $this->createTestTable('alter_table_foreign'); - $table = $this->_sm->listTableDetails('alter_table'); + $table = $this->sm->listTableDetails('alter_table'); self::assertTrue($table->hasColumn('id')); self::assertTrue($table->hasColumn('test')); self::assertTrue($table->hasColumn('foreign_key_test')); @@ -504,9 +504,9 @@ public function testAlterTableScenario() $tableDiff->addedColumns['foo'] = new \Doctrine\DBAL\Schema\Column('foo', Type::getType('integer')); $tableDiff->removedColumns['test'] = $table->getColumn('test'); - $this->_sm->alterTable($tableDiff); + $this->sm->alterTable($tableDiff); - $table = $this->_sm->listTableDetails('alter_table'); + $table = $this->sm->listTableDetails('alter_table'); self::assertFalse($table->hasColumn('test')); self::assertTrue($table->hasColumn('foo')); @@ -514,9 +514,9 @@ public function testAlterTableScenario() $tableDiff->fromTable = $table; $tableDiff->addedIndexes[] = new \Doctrine\DBAL\Schema\Index('foo_idx', array('foo')); - $this->_sm->alterTable($tableDiff); + $this->sm->alterTable($tableDiff); - $table = $this->_sm->listTableDetails('alter_table'); + $table = $this->sm->listTableDetails('alter_table'); self::assertEquals(2, count($table->getIndexes())); self::assertTrue($table->hasIndex('foo_idx')); self::assertEquals(array('foo'), array_map('strtolower', $table->getIndex('foo_idx')->getColumns())); @@ -527,9 +527,9 @@ public function testAlterTableScenario() $tableDiff->fromTable = $table; $tableDiff->changedIndexes[] = new \Doctrine\DBAL\Schema\Index('foo_idx', array('foo', 'foreign_key_test')); - $this->_sm->alterTable($tableDiff); + $this->sm->alterTable($tableDiff); - $table = $this->_sm->listTableDetails('alter_table'); + $table = $this->sm->listTableDetails('alter_table'); self::assertEquals(2, count($table->getIndexes())); self::assertTrue($table->hasIndex('foo_idx')); self::assertEquals(array('foo', 'foreign_key_test'), array_map('strtolower', $table->getIndex('foo_idx')->getColumns())); @@ -538,9 +538,9 @@ public function testAlterTableScenario() $tableDiff->fromTable = $table; $tableDiff->renamedIndexes['foo_idx'] = new \Doctrine\DBAL\Schema\Index('bar_idx', array('foo', 'foreign_key_test')); - $this->_sm->alterTable($tableDiff); + $this->sm->alterTable($tableDiff); - $table = $this->_sm->listTableDetails('alter_table'); + $table = $this->sm->listTableDetails('alter_table'); self::assertEquals(2, count($table->getIndexes())); self::assertTrue($table->hasIndex('bar_idx')); self::assertFalse($table->hasIndex('foo_idx')); @@ -554,13 +554,13 @@ public function testAlterTableScenario() $fk = new \Doctrine\DBAL\Schema\ForeignKeyConstraint(array('foreign_key_test'), 'alter_table_foreign', array('id')); $tableDiff->addedForeignKeys[] = $fk; - $this->_sm->alterTable($tableDiff); - $table = $this->_sm->listTableDetails('alter_table'); + $this->sm->alterTable($tableDiff); + $table = $this->sm->listTableDetails('alter_table'); // dont check for index size here, some platforms automatically add indexes for foreign keys. self::assertFalse($table->hasIndex('bar_idx')); - if ($this->_sm->getDatabasePlatform()->supportsForeignKeyConstraints()) { + if ($this->sm->getDatabasePlatform()->supportsForeignKeyConstraints()) { $fks = $table->getForeignKeys(); self::assertCount(1, $fks); $foreignKey = current($fks); @@ -572,7 +572,7 @@ public function testAlterTableScenario() public function testCreateAndListViews() { - if (!$this->_sm->getDatabasePlatform()->supportsViews()) { + if (!$this->sm->getDatabasePlatform()->supportsViews()) { $this->markTestSkipped('Views is not supported by this platform.'); } @@ -583,25 +583,25 @@ public function testCreateAndListViews() $view = new \Doctrine\DBAL\Schema\View($name, $sql); - $this->_sm->dropAndCreateView($view); + $this->sm->dropAndCreateView($view); - self::assertTrue($this->hasElementWithName($this->_sm->listViews(), $name)); + self::assertTrue($this->hasElementWithName($this->sm->listViews(), $name)); } public function testAutoincrementDetection() { - if (!$this->_sm->getDatabasePlatform()->supportsIdentityColumns()) { + if (!$this->sm->getDatabasePlatform()->supportsIdentityColumns()) { $this->markTestSkipped('This test is only supported on platforms that have autoincrement'); } $table = new Table('test_autoincrement'); - $table->setSchemaConfig($this->_sm->createSchemaConfig()); + $table->setSchemaConfig($this->sm->createSchemaConfig()); $table->addColumn('id', 'integer', array('autoincrement' => true)); $table->setPrimaryKey(array('id')); - $this->_sm->createTable($table); + $this->sm->createTable($table); - $inferredTable = $this->_sm->listTableDetails('test_autoincrement'); + $inferredTable = $this->sm->listTableDetails('test_autoincrement'); self::assertTrue($inferredTable->hasColumn('id')); self::assertTrue($inferredTable->getColumn('id')->getAutoincrement()); } @@ -611,19 +611,19 @@ public function testAutoincrementDetection() */ public function testAutoincrementDetectionMulticolumns() { - if (!$this->_sm->getDatabasePlatform()->supportsIdentityColumns()) { + if (!$this->sm->getDatabasePlatform()->supportsIdentityColumns()) { $this->markTestSkipped('This test is only supported on platforms that have autoincrement'); } $table = new Table('test_not_autoincrement'); - $table->setSchemaConfig($this->_sm->createSchemaConfig()); + $table->setSchemaConfig($this->sm->createSchemaConfig()); $table->addColumn('id', 'integer'); $table->addColumn('other_id', 'integer'); $table->setPrimaryKey(array('id', 'other_id')); - $this->_sm->createTable($table); + $this->sm->createTable($table); - $inferredTable = $this->_sm->listTableDetails('test_not_autoincrement'); + $inferredTable = $this->sm->listTableDetails('test_not_autoincrement'); self::assertTrue($inferredTable->hasColumn('id')); self::assertFalse($inferredTable->getColumn('id')->getAutoincrement()); } @@ -633,7 +633,7 @@ public function testAutoincrementDetectionMulticolumns() */ public function testUpdateSchemaWithForeignKeyRenaming() { - if (!$this->_sm->getDatabasePlatform()->supportsForeignKeyConstraints()) { + if (!$this->sm->getDatabasePlatform()->supportsForeignKeyConstraints()) { $this->markTestSkipped('This test is only supported on platforms that have foreign keys.'); } @@ -642,18 +642,18 @@ public function testUpdateSchemaWithForeignKeyRenaming() $table->setPrimaryKey(array('id')); $tableFK = new Table('test_fk_rename'); - $tableFK->setSchemaConfig($this->_sm->createSchemaConfig()); + $tableFK->setSchemaConfig($this->sm->createSchemaConfig()); $tableFK->addColumn('id', 'integer'); $tableFK->addColumn('fk_id', 'integer'); $tableFK->setPrimaryKey(array('id')); $tableFK->addIndex(array('fk_id'), 'fk_idx'); $tableFK->addForeignKeyConstraint('test_fk_base', array('fk_id'), array('id')); - $this->_sm->createTable($table); - $this->_sm->createTable($tableFK); + $this->sm->createTable($table); + $this->sm->createTable($tableFK); $tableFKNew = new Table('test_fk_rename'); - $tableFKNew->setSchemaConfig($this->_sm->createSchemaConfig()); + $tableFKNew->setSchemaConfig($this->sm->createSchemaConfig()); $tableFKNew->addColumn('id', 'integer'); $tableFKNew->addColumn('rename_fk_id', 'integer'); $tableFKNew->setPrimaryKey(array('id')); @@ -663,9 +663,9 @@ public function testUpdateSchemaWithForeignKeyRenaming() $c = new \Doctrine\DBAL\Schema\Comparator(); $tableDiff = $c->diffTable($tableFK, $tableFKNew); - $this->_sm->alterTable($tableDiff); + $this->sm->alterTable($tableDiff); - $table = $this->_sm->listTableDetails('test_fk_rename'); + $table = $this->sm->listTableDetails('test_fk_rename'); $foreignKeys = $table->getForeignKeys(); self::assertTrue($table->hasColumn('rename_fk_id')); @@ -678,7 +678,7 @@ public function testUpdateSchemaWithForeignKeyRenaming() */ public function testRenameIndexUsedInForeignKeyConstraint() { - if (! $this->_sm->getDatabasePlatform()->supportsForeignKeyConstraints()) { + if (! $this->sm->getDatabasePlatform()->supportsForeignKeyConstraints()) { $this->markTestSkipped('This test is only supported on platforms that have foreign keys.'); } @@ -697,17 +697,17 @@ public function testRenameIndexUsedInForeignKeyConstraint() 'fk_constraint' ); - $this->_sm->dropAndCreateTable($primaryTable); - $this->_sm->dropAndCreateTable($foreignTable); + $this->sm->dropAndCreateTable($primaryTable); + $this->sm->dropAndCreateTable($foreignTable); $foreignTable2 = clone $foreignTable; $foreignTable2->renameIndex('rename_index_fk_idx', 'renamed_index_fk_idx'); $comparator = new Comparator(); - $this->_sm->alterTable($comparator->diffTable($foreignTable, $foreignTable2)); + $this->sm->alterTable($comparator->diffTable($foreignTable, $foreignTable2)); - $foreignTable = $this->_sm->listTableDetails('test_rename_index_foreign'); + $foreignTable = $this->sm->listTableDetails('test_rename_index_foreign'); self::assertFalse($foreignTable->hasIndex('rename_index_fk_idx')); self::assertTrue($foreignTable->hasIndex('renamed_index_fk_idx')); @@ -719,9 +719,9 @@ public function testRenameIndexUsedInForeignKeyConstraint() */ public function testGetColumnComment() { - if ( ! $this->_conn->getDatabasePlatform()->supportsInlineColumnComments() && - ! $this->_conn->getDatabasePlatform()->supportsCommentOnStatement() && - $this->_conn->getDatabasePlatform()->getName() != 'mssql') { + if ( ! $this->conn->getDatabasePlatform()->supportsInlineColumnComments() && + ! $this->conn->getDatabasePlatform()->supportsCommentOnStatement() && + $this->conn->getDatabasePlatform()->getName() != 'mssql') { $this->markTestSkipped('Database does not support column comments.'); } @@ -729,9 +729,9 @@ public function testGetColumnComment() $table->addColumn('id', 'integer', array('comment' => 'This is a comment')); $table->setPrimaryKey(array('id')); - $this->_sm->createTable($table); + $this->sm->createTable($table); - $columns = $this->_sm->listTableColumns("column_comment_test"); + $columns = $this->sm->listTableColumns("column_comment_test"); self::assertEquals(1, count($columns)); self::assertEquals('This is a comment', $columns['id']->getComment()); @@ -747,9 +747,9 @@ public function testGetColumnComment() ) ); - $this->_sm->alterTable($tableDiff); + $this->sm->alterTable($tableDiff); - $columns = $this->_sm->listTableColumns("column_comment_test"); + $columns = $this->sm->listTableColumns("column_comment_test"); self::assertEquals(1, count($columns)); self::assertEmpty($columns['id']->getComment()); } @@ -759,9 +759,9 @@ public function testGetColumnComment() */ public function testAutomaticallyAppendCommentOnMarkedColumns() { - if ( ! $this->_conn->getDatabasePlatform()->supportsInlineColumnComments() && - ! $this->_conn->getDatabasePlatform()->supportsCommentOnStatement() && - $this->_conn->getDatabasePlatform()->getName() != 'mssql') { + if ( ! $this->conn->getDatabasePlatform()->supportsInlineColumnComments() && + ! $this->conn->getDatabasePlatform()->supportsCommentOnStatement() && + $this->conn->getDatabasePlatform()->getName() != 'mssql') { $this->markTestSkipped('Database does not support column comments.'); } @@ -771,9 +771,9 @@ public function testAutomaticallyAppendCommentOnMarkedColumns() $table->addColumn('arr', 'array', array('comment' => 'This is a comment')); $table->setPrimaryKey(array('id')); - $this->_sm->createTable($table); + $this->sm->createTable($table); - $columns = $this->_sm->listTableColumns("column_comment_test2"); + $columns = $this->sm->listTableColumns("column_comment_test2"); self::assertEquals(3, count($columns)); self::assertEquals('This is a comment', $columns['id']->getComment()); self::assertEquals('This is a comment', $columns['obj']->getComment(), "The Doctrine2 Typehint should be stripped from comment."); @@ -787,9 +787,9 @@ public function testAutomaticallyAppendCommentOnMarkedColumns() */ public function testCommentHintOnDateIntervalTypeColumn() { - if ( ! $this->_conn->getDatabasePlatform()->supportsInlineColumnComments() && - ! $this->_conn->getDatabasePlatform()->supportsCommentOnStatement() && - $this->_conn->getDatabasePlatform()->getName() != 'mssql') { + if ( ! $this->conn->getDatabasePlatform()->supportsInlineColumnComments() && + ! $this->conn->getDatabasePlatform()->supportsCommentOnStatement() && + $this->conn->getDatabasePlatform()->getName() != 'mssql') { $this->markTestSkipped('Database does not support column comments.'); } @@ -798,9 +798,9 @@ public function testCommentHintOnDateIntervalTypeColumn() $table->addColumn('date_interval', 'dateinterval', array('comment' => 'This is a comment')); $table->setPrimaryKey(array('id')); - $this->_sm->createTable($table); + $this->sm->createTable($table); - $columns = $this->_sm->listTableColumns("column_dateinterval_comment"); + $columns = $this->sm->listTableColumns("column_dateinterval_comment"); self::assertEquals(2, count($columns)); self::assertEquals('This is a comment', $columns['id']->getComment()); self::assertEquals('This is a comment', $columns['date_interval']->getComment(), "The Doctrine2 Typehint should be stripped from comment."); @@ -818,7 +818,7 @@ public function testChangeColumnsTypeWithDefaultValue() $table->addColumn('col_int', 'smallint', array('default' => 666)); $table->addColumn('col_string', 'string', array('default' => 'foo')); - $this->_sm->dropAndCreateTable($table); + $this->sm->dropAndCreateTable($table); $tableDiff = new TableDiff($tableName); $tableDiff->fromTable = $table; @@ -836,9 +836,9 @@ public function testChangeColumnsTypeWithDefaultValue() new Column('col_string', Type::getType('string'), array('default' => 'foo')) ); - $this->_sm->alterTable($tableDiff); + $this->sm->alterTable($tableDiff); - $columns = $this->_sm->listTableColumns($tableName); + $columns = $this->sm->listTableColumns($tableName); self::assertInstanceOf('Doctrine\DBAL\Types\IntegerType', $columns['col_int']->getType()); self::assertEquals(666, $columns['col_int']->getDefault()); @@ -857,9 +857,9 @@ public function testListTableWithBlob() $table->addColumn('binarydata', 'blob', []); $table->setPrimaryKey(['id']); - $this->_sm->createTable($table); + $this->sm->createTable($table); - $created = $this->_sm->listTableDetails('test_blob_table'); + $created = $this->sm->listTableDetails('test_blob_table'); self::assertTrue($created->hasColumn('id')); self::assertTrue($created->hasColumn('binarydata')); @@ -877,7 +877,7 @@ protected function createTestTable($name = 'test_table', $data = array()) $table = $this->getTestTable($name, $options); - $this->_sm->dropAndCreateTable($table); + $this->sm->dropAndCreateTable($table); return $table; } @@ -885,7 +885,7 @@ protected function createTestTable($name = 'test_table', $data = array()) protected function getTestTable($name, $options=array()) { $table = new Table($name, array(), array(), array(), array(), $options); - $table->setSchemaConfig($this->_sm->createSchemaConfig()); + $table->setSchemaConfig($this->sm->createSchemaConfig()); $table->addColumn('id', 'integer', array('notnull' => true)); $table->setPrimaryKey(array('id')); $table->addColumn('test', 'string', array('length' => 255)); @@ -896,7 +896,7 @@ protected function getTestTable($name, $options=array()) protected function getTestCompositeTable($name) { $table = new Table($name, array(), array(), array(), array(), array()); - $table->setSchemaConfig($this->_sm->createSchemaConfig()); + $table->setSchemaConfig($this->sm->createSchemaConfig()); $table->addColumn('id', 'integer', array('notnull' => true)); $table->addColumn('other_id', 'integer', array('notnull' => true)); $table->setPrimaryKey(array('id', 'other_id')); @@ -921,20 +921,20 @@ protected function assertHasTable($tables, $tableName) public function testListForeignKeysComposite() { - if(!$this->_conn->getDatabasePlatform()->supportsForeignKeyConstraints()) { + if(!$this->conn->getDatabasePlatform()->supportsForeignKeyConstraints()) { $this->markTestSkipped('Does not support foreign key constraints.'); } - $this->_sm->createTable($this->getTestTable('test_create_fk3')); - $this->_sm->createTable($this->getTestCompositeTable('test_create_fk4')); + $this->sm->createTable($this->getTestTable('test_create_fk3')); + $this->sm->createTable($this->getTestCompositeTable('test_create_fk4')); $foreignKey = new \Doctrine\DBAL\Schema\ForeignKeyConstraint( array('id', 'foreign_key_test'), 'test_create_fk4', array('id', 'other_id'), 'foreign_key_test_fk2' ); - $this->_sm->createForeignKey($foreignKey, 'test_create_fk3'); + $this->sm->createForeignKey($foreignKey, 'test_create_fk3'); - $fkeys = $this->_sm->listTableForeignKeys('test_create_fk3'); + $fkeys = $this->sm->listTableForeignKeys('test_create_fk3'); self::assertEquals(1, count($fkeys), "Table 'test_create_fk3' has to have one foreign key."); @@ -959,9 +959,9 @@ public function testColumnDefaultLifecycle() $table->addColumn('column7', 'integer', array('default' => 0)); $table->setPrimaryKey(array('id')); - $this->_sm->dropAndCreateTable($table); + $this->sm->dropAndCreateTable($table); - $columns = $this->_sm->listTableColumns('col_def_lifecycle'); + $columns = $this->sm->listTableColumns('col_def_lifecycle'); self::assertNull($columns['id']->getDefault()); self::assertNull($columns['column1']->getDefault()); @@ -984,9 +984,9 @@ public function testColumnDefaultLifecycle() $comparator = new Comparator(); - $this->_sm->alterTable($comparator->diffTable($table, $diffTable)); + $this->sm->alterTable($comparator->diffTable($table, $diffTable)); - $columns = $this->_sm->listTableColumns('col_def_lifecycle'); + $columns = $this->sm->listTableColumns('col_def_lifecycle'); self::assertSame('', $columns['column1']->getDefault()); self::assertNull($columns['column2']->getDefault()); @@ -1007,9 +1007,9 @@ public function testListTableWithBinary() $table->addColumn('column_binary', 'binary', array('fixed' => true)); $table->setPrimaryKey(array('id')); - $this->_sm->createTable($table); + $this->sm->createTable($table); - $table = $this->_sm->listTableDetails($tableName); + $table = $this->sm->listTableDetails($tableName); self::assertInstanceOf('Doctrine\DBAL\Types\BinaryType', $table->getColumn('column_varbinary')->getType()); self::assertFalse($table->getColumn('column_varbinary')->getFixed()); @@ -1020,11 +1020,11 @@ public function testListTableWithBinary() public function testListTableDetailsWithFullQualifiedTableName() { - if ( ! $this->_sm->getDatabasePlatform()->supportsSchemas()) { + if ( ! $this->sm->getDatabasePlatform()->supportsSchemas()) { $this->markTestSkipped('Test only works on platforms that support schemas.'); } - $defaultSchemaName = $this->_sm->getDatabasePlatform()->getDefaultSchemaName(); + $defaultSchemaName = $this->sm->getDatabasePlatform()->getDefaultSchemaName(); $primaryTableName = 'primary_table'; $foreignTableName = 'foreign_table'; @@ -1032,7 +1032,7 @@ public function testListTableDetailsWithFullQualifiedTableName() $table->addColumn('id', 'integer', array('autoincrement' => true)); $table->setPrimaryKey(array('id')); - $this->_sm->dropAndCreateTable($table); + $this->sm->dropAndCreateTable($table); $table = new Table($primaryTableName); $table->addColumn('id', 'integer', array('autoincrement' => true)); @@ -1042,27 +1042,27 @@ public function testListTableDetailsWithFullQualifiedTableName() $table->addIndex(array('bar')); $table->setPrimaryKey(array('id')); - $this->_sm->dropAndCreateTable($table); + $this->sm->dropAndCreateTable($table); self::assertEquals( - $this->_sm->listTableColumns($primaryTableName), - $this->_sm->listTableColumns($defaultSchemaName . '.' . $primaryTableName) + $this->sm->listTableColumns($primaryTableName), + $this->sm->listTableColumns($defaultSchemaName . '.' . $primaryTableName) ); self::assertEquals( - $this->_sm->listTableIndexes($primaryTableName), - $this->_sm->listTableIndexes($defaultSchemaName . '.' . $primaryTableName) + $this->sm->listTableIndexes($primaryTableName), + $this->sm->listTableIndexes($defaultSchemaName . '.' . $primaryTableName) ); self::assertEquals( - $this->_sm->listTableForeignKeys($primaryTableName), - $this->_sm->listTableForeignKeys($defaultSchemaName . '.' . $primaryTableName) + $this->sm->listTableForeignKeys($primaryTableName), + $this->sm->listTableForeignKeys($defaultSchemaName . '.' . $primaryTableName) ); } public function testCommentStringsAreQuoted() { - if ( ! $this->_conn->getDatabasePlatform()->supportsInlineColumnComments() && - ! $this->_conn->getDatabasePlatform()->supportsCommentOnStatement() && - $this->_conn->getDatabasePlatform()->getName() != 'mssql') { + if ( ! $this->conn->getDatabasePlatform()->supportsInlineColumnComments() && + ! $this->conn->getDatabasePlatform()->supportsCommentOnStatement() && + $this->conn->getDatabasePlatform()->getName() != 'mssql') { $this->markTestSkipped('Database does not support column comments.'); } @@ -1070,15 +1070,15 @@ public function testCommentStringsAreQuoted() $table->addColumn('id', 'integer', array('comment' => "It's a comment with a quote")); $table->setPrimaryKey(array('id')); - $this->_sm->createTable($table); + $this->sm->createTable($table); - $columns = $this->_sm->listTableColumns("my_table"); + $columns = $this->sm->listTableColumns("my_table"); self::assertEquals("It's a comment with a quote", $columns['id']->getComment()); } public function testCommentNotDuplicated() { - if ( ! $this->_conn->getDatabasePlatform()->supportsInlineColumnComments()) { + if ( ! $this->conn->getDatabasePlatform()->supportsInlineColumnComments()) { $this->markTestSkipped('Database does not support column comments.'); } @@ -1088,11 +1088,11 @@ public function testCommentNotDuplicated() 'notnull' => true, 'comment' => 'expected+column+comment', ); - $columnDefinition = substr($this->_conn->getDatabasePlatform()->getColumnDeclarationSQL('id', $options), strlen('id') + 1); + $columnDefinition = substr($this->conn->getDatabasePlatform()->getColumnDeclarationSQL('id', $options), strlen('id') + 1); $table = new Table('my_table'); $table->addColumn('id', 'integer', array('columnDefinition' => $columnDefinition, 'comment' => 'unexpected_column_comment')); - $sql = $this->_conn->getDatabasePlatform()->getCreateTableSQL($table); + $sql = $this->conn->getDatabasePlatform()->getCreateTableSQL($table); self::assertContains('expected+column+comment', $sql[0]); self::assertNotContains('unexpected_column_comment', $sql[0]); @@ -1105,9 +1105,9 @@ public function testCommentNotDuplicated() */ public function testAlterColumnComment($comment1, $expectedComment1, $comment2, $expectedComment2) { - if ( ! $this->_conn->getDatabasePlatform()->supportsInlineColumnComments() && - ! $this->_conn->getDatabasePlatform()->supportsCommentOnStatement() && - $this->_conn->getDatabasePlatform()->getName() != 'mssql') { + if ( ! $this->conn->getDatabasePlatform()->supportsInlineColumnComments() && + ! $this->conn->getDatabasePlatform()->supportsCommentOnStatement() && + $this->conn->getDatabasePlatform()->getName() != 'mssql') { $this->markTestSkipped('Database does not support column comments.'); } @@ -1116,9 +1116,9 @@ public function testAlterColumnComment($comment1, $expectedComment1, $comment2, $offlineTable->addColumn('comment2', 'integer', array('comment' => $comment2)); $offlineTable->addColumn('no_comment1', 'integer'); $offlineTable->addColumn('no_comment2', 'integer'); - $this->_sm->dropAndCreateTable($offlineTable); + $this->sm->dropAndCreateTable($offlineTable); - $onlineTable = $this->_sm->listTableDetails("alter_column_comment_test"); + $onlineTable = $this->sm->listTableDetails("alter_column_comment_test"); self::assertSame($expectedComment1, $onlineTable->getColumn('comment1')->getComment()); self::assertSame($expectedComment2, $onlineTable->getColumn('comment2')->getComment()); @@ -1136,9 +1136,9 @@ public function testAlterColumnComment($comment1, $expectedComment1, $comment2, self::assertInstanceOf('Doctrine\DBAL\Schema\TableDiff', $tableDiff); - $this->_sm->alterTable($tableDiff); + $this->sm->alterTable($tableDiff); - $onlineTable = $this->_sm->listTableDetails("alter_column_comment_test"); + $onlineTable = $this->sm->listTableDetails("alter_column_comment_test"); self::assertSame($expectedComment2, $onlineTable->getColumn('comment1')->getComment()); self::assertSame($expectedComment1, $onlineTable->getColumn('comment2')->getComment()); @@ -1169,7 +1169,7 @@ public function getAlterColumnComment() */ public function testDoesNotListIndexesImplicitlyCreatedByForeignKeys() { - if (! $this->_sm->getDatabasePlatform()->supportsForeignKeyConstraints()) { + if (! $this->sm->getDatabasePlatform()->supportsForeignKeyConstraints()) { $this->markTestSkipped('This test is only supported on platforms that have foreign keys.'); } @@ -1184,10 +1184,10 @@ public function testDoesNotListIndexesImplicitlyCreatedByForeignKeys() $foreignTable->addForeignKeyConstraint('test_list_index_impl_primary', array('fk1'), array('id')); $foreignTable->addForeignKeyConstraint('test_list_index_impl_primary', array('fk2'), array('id')); - $this->_sm->dropAndCreateTable($primaryTable); - $this->_sm->dropAndCreateTable($foreignTable); + $this->sm->dropAndCreateTable($primaryTable); + $this->sm->dropAndCreateTable($foreignTable); - $indexes = $this->_sm->listTableIndexes('test_list_index_impl_foreign'); + $indexes = $this->sm->listTableIndexes('test_list_index_impl_foreign'); self::assertCount(2, $indexes); self::assertArrayHasKey('explicit_fk1_idx', $indexes); @@ -1199,8 +1199,8 @@ public function testDoesNotListIndexesImplicitlyCreatedByForeignKeys() */ public function removeJsonArrayTable() : void { - if ($this->_sm->tablesExist(['json_array_test'])) { - $this->_sm->dropTable('json_array_test'); + if ($this->sm->tablesExist(['json_array_test'])) { + $this->sm->dropTable('json_array_test'); } } @@ -1213,10 +1213,10 @@ public function testComparatorShouldReturnFalseWhenLegacyJsonArrayColumnHasComme $table = new Table('json_array_test'); $table->addColumn('parameters', 'json_array'); - $this->_sm->createTable($table); + $this->sm->createTable($table); $comparator = new Comparator(); - $tableDiff = $comparator->diffTable($this->_sm->listTableDetails('json_array_test'), $table); + $tableDiff = $comparator->diffTable($this->sm->listTableDetails('json_array_test'), $table); self::assertFalse($tableDiff); } @@ -1227,20 +1227,20 @@ public function testComparatorShouldReturnFalseWhenLegacyJsonArrayColumnHasComme */ public function testComparatorShouldModifyOnlyTheCommentWhenUpdatingFromJsonArrayTypeOnLegacyPlatforms() : void { - if ($this->_sm->getDatabasePlatform()->hasNativeJsonType()) { + if ($this->sm->getDatabasePlatform()->hasNativeJsonType()) { $this->markTestSkipped('This test is only supported on platforms that do not have native JSON type.'); } $table = new Table('json_array_test'); $table->addColumn('parameters', 'json_array'); - $this->_sm->createTable($table); + $this->sm->createTable($table); $table = new Table('json_array_test'); $table->addColumn('parameters', 'json'); $comparator = new Comparator(); - $tableDiff = $comparator->diffTable($this->_sm->listTableDetails('json_array_test'), $table); + $tableDiff = $comparator->diffTable($this->sm->listTableDetails('json_array_test'), $table); self::assertInstanceOf(TableDiff::class, $tableDiff); @@ -1255,17 +1255,17 @@ public function testComparatorShouldModifyOnlyTheCommentWhenUpdatingFromJsonArra */ public function testComparatorShouldAddCommentToLegacyJsonArrayTypeThatDoesNotHaveIt() : void { - if ( ! $this->_sm->getDatabasePlatform()->hasNativeJsonType()) { + if ( ! $this->sm->getDatabasePlatform()->hasNativeJsonType()) { $this->markTestSkipped('This test is only supported on platforms that have native JSON type.'); } - $this->_conn->executeQuery('CREATE TABLE json_array_test (parameters JSON NOT NULL)'); + $this->conn->executeQuery('CREATE TABLE json_array_test (parameters JSON NOT NULL)'); $table = new Table('json_array_test'); $table->addColumn('parameters', 'json_array'); $comparator = new Comparator(); - $tableDiff = $comparator->diffTable($this->_sm->listTableDetails('json_array_test'), $table); + $tableDiff = $comparator->diffTable($this->sm->listTableDetails('json_array_test'), $table); self::assertInstanceOf(TableDiff::class, $tableDiff); self::assertSame(['comment'], $tableDiff->changedColumns['parameters']->changedProperties); @@ -1277,17 +1277,17 @@ public function testComparatorShouldAddCommentToLegacyJsonArrayTypeThatDoesNotHa */ public function testComparatorShouldReturnAllChangesWhenUsingLegacyJsonArrayType() : void { - if ( ! $this->_sm->getDatabasePlatform()->hasNativeJsonType()) { + if ( ! $this->sm->getDatabasePlatform()->hasNativeJsonType()) { $this->markTestSkipped('This test is only supported on platforms that have native JSON type.'); } - $this->_conn->executeQuery('CREATE TABLE json_array_test (parameters JSON DEFAULT NULL)'); + $this->conn->executeQuery('CREATE TABLE json_array_test (parameters JSON DEFAULT NULL)'); $table = new Table('json_array_test'); $table->addColumn('parameters', 'json_array'); $comparator = new Comparator(); - $tableDiff = $comparator->diffTable($this->_sm->listTableDetails('json_array_test'), $table); + $tableDiff = $comparator->diffTable($this->sm->listTableDetails('json_array_test'), $table); self::assertInstanceOf(TableDiff::class, $tableDiff); self::assertSame(['notnull', 'comment'], $tableDiff->changedColumns['parameters']->changedProperties); @@ -1299,17 +1299,17 @@ public function testComparatorShouldReturnAllChangesWhenUsingLegacyJsonArrayType */ public function testComparatorShouldReturnAllChangesWhenUsingLegacyJsonArrayTypeEvenWhenPlatformHasJsonSupport() : void { - if ( ! $this->_sm->getDatabasePlatform()->hasNativeJsonType()) { + if ( ! $this->sm->getDatabasePlatform()->hasNativeJsonType()) { $this->markTestSkipped('This test is only supported on platforms that have native JSON type.'); } - $this->_conn->executeQuery('CREATE TABLE json_array_test (parameters JSON DEFAULT NULL)'); + $this->conn->executeQuery('CREATE TABLE json_array_test (parameters JSON DEFAULT NULL)'); $table = new Table('json_array_test'); $table->addColumn('parameters', 'json_array'); $comparator = new Comparator(); - $tableDiff = $comparator->diffTable($this->_sm->listTableDetails('json_array_test'), $table); + $tableDiff = $comparator->diffTable($this->sm->listTableDetails('json_array_test'), $table); self::assertInstanceOf(TableDiff::class, $tableDiff); self::assertSame(['notnull', 'comment'], $tableDiff->changedColumns['parameters']->changedProperties); @@ -1321,17 +1321,17 @@ public function testComparatorShouldReturnAllChangesWhenUsingLegacyJsonArrayType */ public function testComparatorShouldNotAddCommentToJsonTypeSinceItIsTheDefaultNow() : void { - if ( ! $this->_sm->getDatabasePlatform()->hasNativeJsonType()) { + if ( ! $this->sm->getDatabasePlatform()->hasNativeJsonType()) { $this->markTestSkipped('This test is only supported on platforms that have native JSON type.'); } - $this->_conn->executeQuery('CREATE TABLE json_test (parameters JSON NOT NULL)'); + $this->conn->executeQuery('CREATE TABLE json_test (parameters JSON NOT NULL)'); $table = new Table('json_test'); $table->addColumn('parameters', 'json'); $comparator = new Comparator(); - $tableDiff = $comparator->diffTable($this->_sm->listTableDetails('json_test'), $table); + $tableDiff = $comparator->diffTable($this->sm->listTableDetails('json_test'), $table); self::assertFalse($tableDiff); } @@ -1343,7 +1343,7 @@ public function testComparatorShouldNotAddCommentToJsonTypeSinceItIsTheDefaultNo */ public function testExtractDoctrineTypeFromComment(string $comment, string $expected, string $currentType) : void { - $result = $this->_sm->extractDoctrineTypeFromComment($comment, $currentType); + $result = $this->sm->extractDoctrineTypeFromComment($comment, $currentType); self::assertSame($expected, $result); } @@ -1364,7 +1364,7 @@ public function commentsProvider() : array public function testCreateAndListSequences() : void { - if ( ! $this->_sm->getDatabasePlatform()->supportsSequences()) { + if ( ! $this->sm->getDatabasePlatform()->supportsSequences()) { self::markTestSkipped('This test is only supported on platforms that support sequences.'); } @@ -1377,12 +1377,12 @@ public function testCreateAndListSequences() : void $sequence1 = new Sequence($sequence1Name, $sequence1AllocationSize, $sequence1InitialValue); $sequence2 = new Sequence($sequence2Name, $sequence2AllocationSize, $sequence2InitialValue); - $this->_sm->createSequence($sequence1); - $this->_sm->createSequence($sequence2); + $this->sm->createSequence($sequence1); + $this->sm->createSequence($sequence2); /** @var Sequence[] $actualSequences */ $actualSequences = []; - foreach ($this->_sm->listSequences() as $sequence) { + foreach ($this->sm->listSequences() as $sequence) { $actualSequences[$sequence->getName()] = $sequence; } diff --git a/tests/Doctrine/Tests/DBAL/Functional/Schema/SqliteSchemaManagerTest.php b/tests/Doctrine/Tests/DBAL/Functional/Schema/SqliteSchemaManagerTest.php index 5692bd7f796..a2c5beae0be 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/Schema/SqliteSchemaManagerTest.php +++ b/tests/Doctrine/Tests/DBAL/Functional/Schema/SqliteSchemaManagerTest.php @@ -14,16 +14,16 @@ class SqliteSchemaManagerTest extends SchemaManagerFunctionalTestCase */ public function testListDatabases() { - $this->_sm->listDatabases(); + $this->sm->listDatabases(); } public function testCreateAndDropDatabase() { $path = dirname(__FILE__).'/test_create_and_drop_sqlite_database.sqlite'; - $this->_sm->createDatabase($path); + $this->sm->createDatabase($path); self::assertFileExists($path); - $this->_sm->dropDatabase($path); + $this->sm->dropDatabase($path); self::assertFileNotExists($path); } @@ -32,21 +32,21 @@ public function testCreateAndDropDatabase() */ public function testDropsDatabaseWithActiveConnections() { - $this->_sm->dropAndCreateDatabase('test_drop_database'); + $this->sm->dropAndCreateDatabase('test_drop_database'); self::assertFileExists('test_drop_database'); - $params = $this->_conn->getParams(); + $params = $this->conn->getParams(); $params['dbname'] = 'test_drop_database'; $user = $params['user'] ?? null; $password = $params['password'] ?? null; - $connection = $this->_conn->getDriver()->connect($params, $user, $password); + $connection = $this->conn->getDriver()->connect($params, $user, $password); self::assertInstanceOf('Doctrine\DBAL\Driver\Connection', $connection); - $this->_sm->dropDatabase('test_drop_database'); + $this->sm->dropDatabase('test_drop_database'); self::assertFileNotExists('test_drop_database'); @@ -56,9 +56,9 @@ public function testDropsDatabaseWithActiveConnections() public function testRenameTable() { $this->createTestTable('oldname'); - $this->_sm->renameTable('oldname', 'newname'); + $this->sm->renameTable('oldname', 'newname'); - $tables = $this->_sm->listTableNames(); + $tables = $this->sm->listTableNames(); self::assertContains('newname', $tables); self::assertNotContains('oldname', $tables); } @@ -73,7 +73,7 @@ public function createListTableColumns() public function testListForeignKeysFromExistingDatabase() { - $this->_conn->exec(<<conn->exec(<< 'NO ACTION', 'onDelete' => 'NO ACTION', 'deferrable' => true, 'deferred' => true)), ); - self::assertEquals($expected, $this->_sm->listTableForeignKeys('user')); + self::assertEquals($expected, $this->sm->listTableForeignKeys('user')); } public function testColumnCollation() @@ -103,9 +103,9 @@ public function testColumnCollation() $table->addColumn('text', 'text'); $table->addColumn('foo', 'text')->setPlatformOption('collation', 'BINARY'); $table->addColumn('bar', 'text')->setPlatformOption('collation', 'NOCASE'); - $this->_sm->dropAndCreateTable($table); + $this->sm->dropAndCreateTable($table); - $columns = $this->_sm->listTableColumns('test_collation'); + $columns = $this->sm->listTableColumns('test_collation'); self::assertArrayNotHasKey('collation', $columns['id']->getPlatformOptions()); self::assertEquals('BINARY', $columns['text']->getPlatformOption('collation')); @@ -123,9 +123,9 @@ public function testListTableWithBinary() $table->addColumn('column_binary', 'binary', array('fixed' => true)); $table->setPrimaryKey(array('id')); - $this->_sm->createTable($table); + $this->sm->createTable($table); - $table = $this->_sm->listTableDetails($tableName); + $table = $this->sm->listTableDetails($tableName); self::assertInstanceOf('Doctrine\DBAL\Types\BlobType', $table->getColumn('column_varbinary')->getType()); self::assertFalse($table->getColumn('column_varbinary')->getFixed()); @@ -144,7 +144,7 @@ public function testNonDefaultPKOrder() if(version_compare($version['versionString'], '3.7.16', '<')) { $this->markTestSkipped('This version of sqlite doesn\'t return the order of the Primary Key.'); } - $this->_conn->exec(<<conn->exec(<<_sm->listTableIndexes('non_default_pk_order'); + $tableIndexes = $this->sm->listTableIndexes('non_default_pk_order'); self::assertCount(1, $tableIndexes); @@ -173,9 +173,9 @@ public function testListTableColumnsWithWhitespacesInTypeDeclarations() ) SQL; - $this->_conn->exec($sql); + $this->conn->exec($sql); - $columns = $this->_sm->listTableColumns('dbal_1779'); + $columns = $this->sm->listTableColumns('dbal_1779'); self::assertCount(2, $columns); @@ -201,14 +201,14 @@ public function testDiffListIntegerAutoincrementTableColumns($integerType, $unsi $offlineTable->addColumn('id', $integerType, array('autoincrement' => true, 'unsigned' => $unsigned)); $offlineTable->setPrimaryKey(array('id')); - $this->_sm->dropAndCreateTable($offlineTable); + $this->sm->dropAndCreateTable($offlineTable); - $onlineTable = $this->_sm->listTableDetails($tableName); + $onlineTable = $this->sm->listTableDetails($tableName); $comparator = new Schema\Comparator(); $diff = $comparator->diffTable($offlineTable, $onlineTable); if ($expectedComparatorDiff) { - self::assertEmpty($this->_sm->getDatabasePlatform()->getAlterTableSQL($diff)); + self::assertEmpty($this->sm->getDatabasePlatform()->getAlterTableSQL($diff)); } else { self::assertFalse($diff); } diff --git a/tests/Doctrine/Tests/DBAL/Functional/StatementTest.php b/tests/Doctrine/Tests/DBAL/Functional/StatementTest.php index e6f9d4473b1..4a55b8d33d7 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/StatementTest.php +++ b/tests/Doctrine/Tests/DBAL/Functional/StatementTest.php @@ -17,15 +17,15 @@ protected function setUp() $table = new Table('stmt_test'); $table->addColumn('id', 'integer'); $table->addColumn('name', 'text', array('notnull' => false)); - $this->_conn->getSchemaManager()->dropAndCreateTable($table); + $this->conn->getSchemaManager()->dropAndCreateTable($table); } public function testStatementIsReusableAfterClosingCursor() { - $this->_conn->insert('stmt_test', array('id' => 1)); - $this->_conn->insert('stmt_test', array('id' => 2)); + $this->conn->insert('stmt_test', array('id' => 1)); + $this->conn->insert('stmt_test', array('id' => 2)); - $stmt = $this->_conn->prepare('SELECT id FROM stmt_test ORDER BY id'); + $stmt = $this->conn->prepare('SELECT id FROM stmt_test ORDER BY id'); $stmt->execute(); @@ -43,7 +43,7 @@ public function testStatementIsReusableAfterClosingCursor() public function testReuseStatementWithLongerResults() { - $sm = $this->_conn->getSchemaManager(); + $sm = $this->conn->getSchemaManager(); $table = new Table('stmt_longer_results'); $table->addColumn('param', 'string'); $table->addColumn('val', 'text'); @@ -53,9 +53,9 @@ public function testReuseStatementWithLongerResults() 'param' => 'param1', 'val' => 'X', ); - $this->_conn->insert('stmt_longer_results', $row1); + $this->conn->insert('stmt_longer_results', $row1); - $stmt = $this->_conn->prepare('SELECT param, val FROM stmt_longer_results ORDER BY param'); + $stmt = $this->conn->prepare('SELECT param, val FROM stmt_longer_results ORDER BY param'); $stmt->execute(); self::assertArraySubset(array( array('param1', 'X'), @@ -65,7 +65,7 @@ public function testReuseStatementWithLongerResults() 'param' => 'param2', 'val' => 'A bit longer value', ); - $this->_conn->insert('stmt_longer_results', $row2); + $this->conn->insert('stmt_longer_results', $row2); $stmt->execute(); self::assertArraySubset(array( @@ -80,7 +80,7 @@ public function testFetchLongBlob() // but is still not enough to store a LONGBLOB of the max possible size $this->iniSet('memory_limit', '4G'); - $sm = $this->_conn->getSchemaManager(); + $sm = $this->conn->getSchemaManager(); $table = new Table('stmt_long_blob'); $table->addColumn('contents', 'blob', array( 'length' => 0xFFFFFFFF, @@ -104,17 +104,17 @@ public function testFetchLongBlob() EOF ); - $this->_conn->insert('stmt_long_blob', array( + $this->conn->insert('stmt_long_blob', array( 'contents' => $contents, ), array(ParameterType::LARGE_OBJECT)); - $stmt = $this->_conn->prepare('SELECT contents FROM stmt_long_blob'); + $stmt = $this->conn->prepare('SELECT contents FROM stmt_long_blob'); $stmt->execute(); $stream = Type::getType('blob') ->convertToPHPValue( $stmt->fetchColumn(), - $this->_conn->getDatabasePlatform() + $this->conn->getDatabasePlatform() ); self::assertSame($contents, stream_get_contents($stream)); @@ -122,27 +122,27 @@ public function testFetchLongBlob() public function testIncompletelyFetchedStatementDoesNotBlockConnection() { - $this->_conn->insert('stmt_test', array('id' => 1)); - $this->_conn->insert('stmt_test', array('id' => 2)); + $this->conn->insert('stmt_test', array('id' => 1)); + $this->conn->insert('stmt_test', array('id' => 2)); - $stmt1 = $this->_conn->prepare('SELECT id FROM stmt_test'); + $stmt1 = $this->conn->prepare('SELECT id FROM stmt_test'); $stmt1->execute(); $stmt1->fetch(); $stmt1->execute(); // fetching only one record out of two $stmt1->fetch(); - $stmt2 = $this->_conn->prepare('SELECT id FROM stmt_test WHERE id = ?'); + $stmt2 = $this->conn->prepare('SELECT id FROM stmt_test WHERE id = ?'); $stmt2->execute(array(1)); self::assertEquals(1, $stmt2->fetchColumn()); } public function testReuseStatementAfterClosingCursor() { - $this->_conn->insert('stmt_test', array('id' => 1)); - $this->_conn->insert('stmt_test', array('id' => 2)); + $this->conn->insert('stmt_test', array('id' => 1)); + $this->conn->insert('stmt_test', array('id' => 2)); - $stmt = $this->_conn->prepare('SELECT id FROM stmt_test WHERE id = ?'); + $stmt = $this->conn->prepare('SELECT id FROM stmt_test WHERE id = ?'); $stmt->execute(array(1)); $id = $stmt->fetchColumn(); @@ -157,10 +157,10 @@ public function testReuseStatementAfterClosingCursor() public function testReuseStatementWithParameterBoundByReference() { - $this->_conn->insert('stmt_test', array('id' => 1)); - $this->_conn->insert('stmt_test', array('id' => 2)); + $this->conn->insert('stmt_test', array('id' => 1)); + $this->conn->insert('stmt_test', array('id' => 2)); - $stmt = $this->_conn->prepare('SELECT id FROM stmt_test WHERE id = ?'); + $stmt = $this->conn->prepare('SELECT id FROM stmt_test WHERE id = ?'); $stmt->bindParam(1, $id); $id = 1; @@ -174,10 +174,10 @@ public function testReuseStatementWithParameterBoundByReference() public function testReuseStatementWithReboundValue() { - $this->_conn->insert('stmt_test', array('id' => 1)); - $this->_conn->insert('stmt_test', array('id' => 2)); + $this->conn->insert('stmt_test', array('id' => 1)); + $this->conn->insert('stmt_test', array('id' => 2)); - $stmt = $this->_conn->prepare('SELECT id FROM stmt_test WHERE id = ?'); + $stmt = $this->conn->prepare('SELECT id FROM stmt_test WHERE id = ?'); $stmt->bindValue(1, 1); $stmt->execute(); @@ -190,10 +190,10 @@ public function testReuseStatementWithReboundValue() public function testReuseStatementWithReboundParam() { - $this->_conn->insert('stmt_test', array('id' => 1)); - $this->_conn->insert('stmt_test', array('id' => 2)); + $this->conn->insert('stmt_test', array('id' => 1)); + $this->conn->insert('stmt_test', array('id' => 2)); - $stmt = $this->_conn->prepare('SELECT id FROM stmt_test WHERE id = ?'); + $stmt = $this->conn->prepare('SELECT id FROM stmt_test WHERE id = ?'); $x = 1; $stmt->bindParam(1, $x); @@ -211,14 +211,14 @@ public function testReuseStatementWithReboundParam() */ public function testFetchFromNonExecutedStatement(callable $fetch, $expected) { - $stmt = $this->_conn->prepare('SELECT id FROM stmt_test'); + $stmt = $this->conn->prepare('SELECT id FROM stmt_test'); self::assertSame($expected, $fetch($stmt)); } public function testCloseCursorOnNonExecutedStatement() { - $stmt = $this->_conn->prepare('SELECT id FROM stmt_test'); + $stmt = $this->conn->prepare('SELECT id FROM stmt_test'); self::assertTrue($stmt->closeCursor()); } @@ -228,7 +228,7 @@ public function testCloseCursorOnNonExecutedStatement() */ public function testCloseCursorAfterCursorEnd() { - $stmt = $this->_conn->prepare('SELECT name FROM stmt_test'); + $stmt = $this->conn->prepare('SELECT name FROM stmt_test'); $stmt->execute(); $stmt->fetch(); @@ -241,7 +241,7 @@ public function testCloseCursorAfterCursorEnd() */ public function testFetchFromNonExecutedStatementWithClosedCursor(callable $fetch, $expected) { - $stmt = $this->_conn->prepare('SELECT id FROM stmt_test'); + $stmt = $this->conn->prepare('SELECT id FROM stmt_test'); $stmt->closeCursor(); self::assertSame($expected, $fetch($stmt)); @@ -252,9 +252,9 @@ public function testFetchFromNonExecutedStatementWithClosedCursor(callable $fetc */ public function testFetchFromExecutedStatementWithClosedCursor(callable $fetch, $expected) { - $this->_conn->insert('stmt_test', array('id' => 1)); + $this->conn->insert('stmt_test', array('id' => 1)); - $stmt = $this->_conn->prepare('SELECT id FROM stmt_test'); + $stmt = $this->conn->prepare('SELECT id FROM stmt_test'); $stmt->execute(); $stmt->closeCursor(); @@ -287,9 +287,9 @@ function (Statement $stmt) { public function testFetchInColumnMode() : void { - $platform = $this->_conn->getDatabasePlatform(); + $platform = $this->conn->getDatabasePlatform(); $query = $platform->getDummySelectSQL(); - $result = $this->_conn->executeQuery($query)->fetch(FetchMode::COLUMN); + $result = $this->conn->executeQuery($query)->fetch(FetchMode::COLUMN); self::assertEquals(1, $result); } diff --git a/tests/Doctrine/Tests/DBAL/Functional/TableGeneratorTest.php b/tests/Doctrine/Tests/DBAL/Functional/TableGeneratorTest.php index fba243319eb..2376da6923f 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/TableGeneratorTest.php +++ b/tests/Doctrine/Tests/DBAL/Functional/TableGeneratorTest.php @@ -15,7 +15,7 @@ protected function setUp() { parent::setUp(); - $platform = $this->_conn->getDatabasePlatform(); + $platform = $this->conn->getDatabasePlatform(); if ($platform->getName() == "sqlite") { $this->markTestSkipped('TableGenerator does not work with SQLite'); } @@ -26,12 +26,12 @@ protected function setUp() $schema->visit($visitor); foreach ($schema->toSql($platform) as $sql) { - $this->_conn->exec($sql); + $this->conn->exec($sql); } } catch(\Exception $e) { } - $this->generator = new TableGenerator($this->_conn); + $this->generator = new TableGenerator($this->conn); } public function testNextVal() @@ -47,9 +47,9 @@ public function testNextVal() public function testNextValNotAffectedByOuterTransactions() { - $this->_conn->beginTransaction(); + $this->conn->beginTransaction(); $id1 = $this->generator->nextValue("tbl1"); - $this->_conn->rollBack(); + $this->conn->rollBack(); $id2 = $this->generator->nextValue("tbl1"); self::assertGreaterThan(0, $id1, "First id has to be larger than 0"); diff --git a/tests/Doctrine/Tests/DBAL/Functional/TemporaryTableTest.php b/tests/Doctrine/Tests/DBAL/Functional/TemporaryTableTest.php index 3a1277267a9..322ef11fe23 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/TemporaryTableTest.php +++ b/tests/Doctrine/Tests/DBAL/Functional/TemporaryTableTest.php @@ -11,7 +11,7 @@ protected function setUp() { parent::setUp(); try { - $this->_conn->exec($this->_conn->getDatabasePlatform()->getDropTableSQL("nontemporary")); + $this->conn->exec($this->conn->getDatabasePlatform()->getDropTableSQL("nontemporary")); } catch(\Exception $e) { } @@ -19,10 +19,10 @@ protected function setUp() protected function tearDown() { - if ($this->_conn) { + if ($this->conn) { try { - $tempTable = $this->_conn->getDatabasePlatform()->getTemporaryTableName("my_temporary"); - $this->_conn->exec($this->_conn->getDatabasePlatform()->getDropTemporaryTableSQL($tempTable)); + $tempTable = $this->conn->getDatabasePlatform()->getTemporaryTableName("my_temporary"); + $this->conn->exec($this->conn->getDatabasePlatform()->getDropTemporaryTableSQL($tempTable)); } catch(\Exception $e) { } } @@ -35,33 +35,33 @@ protected function tearDown() */ public function testDropTemporaryTableNotAutoCommitTransaction() { - if ($this->_conn->getDatabasePlatform()->getName() == 'sqlanywhere' || - $this->_conn->getDatabasePlatform()->getName() == 'oracle') { + if ($this->conn->getDatabasePlatform()->getName() == 'sqlanywhere' || + $this->conn->getDatabasePlatform()->getName() == 'oracle') { $this->markTestSkipped("Test does not work on Oracle and SQL Anywhere."); } - $platform = $this->_conn->getDatabasePlatform(); + $platform = $this->conn->getDatabasePlatform(); $columnDefinitions = array("id" => array("type" => Type::getType("integer"), "notnull" => true)); $tempTable = $platform->getTemporaryTableName("my_temporary"); $createTempTableSQL = $platform->getCreateTemporaryTableSnippetSQL() . ' ' . $tempTable . ' (' . $platform->getColumnDeclarationListSQL($columnDefinitions) . ')'; - $this->_conn->executeUpdate($createTempTableSQL); + $this->conn->executeUpdate($createTempTableSQL); $table = new Table("nontemporary"); $table->addColumn("id", "integer"); $table->setPrimaryKey(array('id')); - $this->_conn->getSchemaManager()->createTable($table); + $this->conn->getSchemaManager()->createTable($table); - $this->_conn->beginTransaction(); - $this->_conn->insert("nontemporary", array("id" => 1)); - $this->_conn->exec($platform->getDropTemporaryTableSQL($tempTable)); - $this->_conn->insert("nontemporary", array("id" => 2)); + $this->conn->beginTransaction(); + $this->conn->insert("nontemporary", array("id" => 1)); + $this->conn->exec($platform->getDropTemporaryTableSQL($tempTable)); + $this->conn->insert("nontemporary", array("id" => 2)); - $this->_conn->rollBack(); + $this->conn->rollBack(); - $rows = $this->_conn->fetchAll('SELECT * FROM nontemporary'); + $rows = $this->conn->fetchAll('SELECT * FROM nontemporary'); self::assertEquals(array(), $rows, "In an event of an error this result has one row, because of an implicit commit."); } @@ -71,12 +71,12 @@ public function testDropTemporaryTableNotAutoCommitTransaction() */ public function testCreateTemporaryTableNotAutoCommitTransaction() { - if ($this->_conn->getDatabasePlatform()->getName() == 'sqlanywhere' || - $this->_conn->getDatabasePlatform()->getName() == 'oracle') { + if ($this->conn->getDatabasePlatform()->getName() == 'sqlanywhere' || + $this->conn->getDatabasePlatform()->getName() == 'oracle') { $this->markTestSkipped("Test does not work on Oracle and SQL Anywhere."); } - $platform = $this->_conn->getDatabasePlatform(); + $platform = $this->conn->getDatabasePlatform(); $columnDefinitions = array("id" => array("type" => Type::getType("integer"), "notnull" => true)); $tempTable = $platform->getTemporaryTableName("my_temporary"); @@ -87,23 +87,23 @@ public function testCreateTemporaryTableNotAutoCommitTransaction() $table->addColumn("id", "integer"); $table->setPrimaryKey(array('id')); - $this->_conn->getSchemaManager()->createTable($table); + $this->conn->getSchemaManager()->createTable($table); - $this->_conn->beginTransaction(); - $this->_conn->insert("nontemporary", array("id" => 1)); + $this->conn->beginTransaction(); + $this->conn->insert("nontemporary", array("id" => 1)); - $this->_conn->exec($createTempTableSQL); - $this->_conn->insert("nontemporary", array("id" => 2)); + $this->conn->exec($createTempTableSQL); + $this->conn->insert("nontemporary", array("id" => 2)); - $this->_conn->rollBack(); + $this->conn->rollBack(); try { - $this->_conn->exec($platform->getDropTemporaryTableSQL($tempTable)); + $this->conn->exec($platform->getDropTemporaryTableSQL($tempTable)); } catch(\Exception $e) { } - $rows = $this->_conn->fetchAll('SELECT * FROM nontemporary'); + $rows = $this->conn->fetchAll('SELECT * FROM nontemporary'); self::assertEquals(array(), $rows, "In an event of an error this result has one row, because of an implicit commit."); } } diff --git a/tests/Doctrine/Tests/DBAL/Functional/Ticket/DBAL168Test.php b/tests/Doctrine/Tests/DBAL/Functional/Ticket/DBAL168Test.php index 47b1e5eab4a..b09ddba8bd8 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/Ticket/DBAL168Test.php +++ b/tests/Doctrine/Tests/DBAL/Functional/Ticket/DBAL168Test.php @@ -9,7 +9,7 @@ class DBAL168Test extends \Doctrine\Tests\DbalFunctionalTestCase { public function testDomainsTable() { - if ($this->_conn->getDatabasePlatform()->getName() != "postgresql") { + if ($this->conn->getDatabasePlatform()->getName() != "postgresql") { $this->markTestSkipped('PostgreSQL only test'); } @@ -19,8 +19,8 @@ public function testDomainsTable() $table->setPrimaryKey(array('id')); $table->addForeignKeyConstraint('domains', array('parent_id'), array('id')); - $this->_conn->getSchemaManager()->createTable($table); - $table = $this->_conn->getSchemaManager()->listTableDetails('domains'); + $this->conn->getSchemaManager()->createTable($table); + $table = $this->conn->getSchemaManager()->listTableDetails('domains'); self::assertEquals('domains', $table->getName()); } diff --git a/tests/Doctrine/Tests/DBAL/Functional/Ticket/DBAL202Test.php b/tests/Doctrine/Tests/DBAL/Functional/Ticket/DBAL202Test.php index cbb7674f893..f38a59518ee 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/Ticket/DBAL202Test.php +++ b/tests/Doctrine/Tests/DBAL/Functional/Ticket/DBAL202Test.php @@ -11,38 +11,38 @@ protected function setUp() { parent::setUp(); - if ($this->_conn->getDatabasePlatform()->getName() != 'oracle') { + if ($this->conn->getDatabasePlatform()->getName() != 'oracle') { $this->markTestSkipped('OCI8 only test'); } - if ($this->_conn->getSchemaManager()->tablesExist('DBAL202')) { - $this->_conn->exec('DELETE FROM DBAL202'); + if ($this->conn->getSchemaManager()->tablesExist('DBAL202')) { + $this->conn->exec('DELETE FROM DBAL202'); } else { $table = new \Doctrine\DBAL\Schema\Table('DBAL202'); $table->addColumn('id', 'integer'); $table->setPrimaryKey(array('id')); - $this->_conn->getSchemaManager()->createTable($table); + $this->conn->getSchemaManager()->createTable($table); } } public function testStatementRollback() { - $stmt = $this->_conn->prepare('INSERT INTO DBAL202 VALUES (8)'); - $this->_conn->beginTransaction(); + $stmt = $this->conn->prepare('INSERT INTO DBAL202 VALUES (8)'); + $this->conn->beginTransaction(); $stmt->execute(); - $this->_conn->rollBack(); + $this->conn->rollBack(); - self::assertEquals(0, $this->_conn->query('SELECT COUNT(1) FROM DBAL202')->fetchColumn()); + self::assertEquals(0, $this->conn->query('SELECT COUNT(1) FROM DBAL202')->fetchColumn()); } public function testStatementCommit() { - $stmt = $this->_conn->prepare('INSERT INTO DBAL202 VALUES (8)'); - $this->_conn->beginTransaction(); + $stmt = $this->conn->prepare('INSERT INTO DBAL202 VALUES (8)'); + $this->conn->beginTransaction(); $stmt->execute(); - $this->_conn->commit(); + $this->conn->commit(); - self::assertEquals(1, $this->_conn->query('SELECT COUNT(1) FROM DBAL202')->fetchColumn()); + self::assertEquals(1, $this->conn->query('SELECT COUNT(1) FROM DBAL202')->fetchColumn()); } } diff --git a/tests/Doctrine/Tests/DBAL/Functional/Ticket/DBAL421Test.php b/tests/Doctrine/Tests/DBAL/Functional/Ticket/DBAL421Test.php index f1b282b996b..1c3eff2f72d 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/Ticket/DBAL421Test.php +++ b/tests/Doctrine/Tests/DBAL/Functional/Ticket/DBAL421Test.php @@ -11,7 +11,7 @@ protected function setUp() { parent::setUp(); - $platform = $this->_conn->getDatabasePlatform()->getName(); + $platform = $this->conn->getDatabasePlatform()->getName(); if (!in_array($platform, array('mysql', 'sqlite'))) { $this->markTestSkipped('Currently restricted to MySQL and SQLite.'); } @@ -19,7 +19,7 @@ protected function setUp() public function testGuidShouldMatchPattern() { - $guid = $this->_conn->query($this->getSelectGuidSql())->fetchColumn(); + $guid = $this->conn->query($this->getSelectGuidSql())->fetchColumn(); $pattern = '/[0-9A-F]{8}\-[0-9A-F]{4}\-[0-9A-F]{4}\-[8-9A-B][0-9A-F]{3}\-[0-9A-F]{12}/i'; self::assertEquals(1, preg_match($pattern, $guid), "GUID does not match pattern"); } @@ -30,7 +30,7 @@ public function testGuidShouldMatchPattern() */ public function testGuidShouldBeRandom() { - $statement = $this->_conn->prepare($this->getSelectGuidSql()); + $statement = $this->conn->prepare($this->getSelectGuidSql()); $guids = array(); for ($i = 0; $i < 99; $i++) { @@ -45,6 +45,6 @@ public function testGuidShouldBeRandom() private function getSelectGuidSql() { - return "SELECT " . $this->_conn->getDatabasePlatform()->getGuidExpression(); + return "SELECT " . $this->conn->getDatabasePlatform()->getGuidExpression(); } } diff --git a/tests/Doctrine/Tests/DBAL/Functional/Ticket/DBAL461Test.php b/tests/Doctrine/Tests/DBAL/Functional/Ticket/DBAL461Test.php index 1f40837daa7..08cade4f732 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/Ticket/DBAL461Test.php +++ b/tests/Doctrine/Tests/DBAL/Functional/Ticket/DBAL461Test.php @@ -18,7 +18,7 @@ public function testIssue() $schemaManager = new SQLServerSchemaManager($conn, $platform); - $reflectionMethod = new \ReflectionMethod($schemaManager, '_getPortableTableColumnDefinition'); + $reflectionMethod = new \ReflectionMethod($schemaManager, 'getPortableTableColumnDefinition'); $reflectionMethod->setAccessible(true); $column = $reflectionMethod->invoke($schemaManager, array( 'type' => 'numeric(18,0)', diff --git a/tests/Doctrine/Tests/DBAL/Functional/Ticket/DBAL510Test.php b/tests/Doctrine/Tests/DBAL/Functional/Ticket/DBAL510Test.php index 4780e6f5c7d..5c95cde7037 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/Ticket/DBAL510Test.php +++ b/tests/Doctrine/Tests/DBAL/Functional/Ticket/DBAL510Test.php @@ -14,7 +14,7 @@ protected function setUp() { parent::setUp(); - if ($this->_conn->getDatabasePlatform()->getName() !== "postgresql") { + if ($this->conn->getDatabasePlatform()->getName() !== "postgresql") { $this->markTestSkipped('PostgreSQL Only test'); } } @@ -25,9 +25,9 @@ public function testSearchPathSchemaChanges() $table->addColumn('id', 'integer'); $table->setPrimaryKey(array('id')); - $this->_conn->getSchemaManager()->createTable($table); + $this->conn->getSchemaManager()->createTable($table); - $onlineTable = $this->_conn->getSchemaManager()->listTableDetails('dbal510tbl'); + $onlineTable = $this->conn->getSchemaManager()->listTableDetails('dbal510tbl'); $comparator = new Comparator(); $diff = $comparator->diffTable($onlineTable, $table); diff --git a/tests/Doctrine/Tests/DBAL/Functional/Ticket/DBAL630Test.php b/tests/Doctrine/Tests/DBAL/Functional/Ticket/DBAL630Test.php index 9a96ad2fb96..f037b1ae822 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/Ticket/DBAL630Test.php +++ b/tests/Doctrine/Tests/DBAL/Functional/Ticket/DBAL630Test.php @@ -17,15 +17,15 @@ protected function setUp() { parent::setUp(); - $platform = $this->_conn->getDatabasePlatform()->getName(); + $platform = $this->conn->getDatabasePlatform()->getName(); if (!in_array($platform, array('postgresql'))) { $this->markTestSkipped('Currently restricted to PostgreSQL'); } try { - $this->_conn->exec('CREATE TABLE dbal630 (id SERIAL, bool_col BOOLEAN NOT NULL);'); - $this->_conn->exec('CREATE TABLE dbal630_allow_nulls (id SERIAL, bool_col BOOLEAN);'); + $this->conn->exec('CREATE TABLE dbal630 (id SERIAL, bool_col BOOLEAN NOT NULL);'); + $this->conn->exec('CREATE TABLE dbal630_allow_nulls (id SERIAL, bool_col BOOLEAN);'); } catch (DBALException $e) { } $this->running = true; @@ -34,7 +34,7 @@ protected function setUp() protected function tearDown() { if ($this->running) { - $this->_conn->getWrappedConnection()->setAttribute(PDO::ATTR_EMULATE_PREPARES, false); + $this->conn->getWrappedConnection()->setAttribute(PDO::ATTR_EMULATE_PREPARES, false); } parent::tearDown(); @@ -42,45 +42,45 @@ protected function tearDown() public function testBooleanConversionSqlLiteral() { - $this->_conn->executeUpdate('INSERT INTO dbal630 (bool_col) VALUES(false)'); - $id = $this->_conn->lastInsertId('dbal630_id_seq'); + $this->conn->executeUpdate('INSERT INTO dbal630 (bool_col) VALUES(false)'); + $id = $this->conn->lastInsertId('dbal630_id_seq'); self::assertNotEmpty($id); - $row = $this->_conn->fetchAssoc('SELECT bool_col FROM dbal630 WHERE id = ?', array($id)); + $row = $this->conn->fetchAssoc('SELECT bool_col FROM dbal630 WHERE id = ?', array($id)); self::assertFalse($row['bool_col']); } public function testBooleanConversionBoolParamRealPrepares() { - $this->_conn->executeUpdate( + $this->conn->executeUpdate( 'INSERT INTO dbal630 (bool_col) VALUES(?)', array('false'), array(ParameterType::BOOLEAN) ); - $id = $this->_conn->lastInsertId('dbal630_id_seq'); + $id = $this->conn->lastInsertId('dbal630_id_seq'); self::assertNotEmpty($id); - $row = $this->_conn->fetchAssoc('SELECT bool_col FROM dbal630 WHERE id = ?', array($id)); + $row = $this->conn->fetchAssoc('SELECT bool_col FROM dbal630 WHERE id = ?', array($id)); self::assertFalse($row['bool_col']); } public function testBooleanConversionBoolParamEmulatedPrepares() { - $this->_conn->getWrappedConnection()->setAttribute(PDO::ATTR_EMULATE_PREPARES, true); + $this->conn->getWrappedConnection()->setAttribute(PDO::ATTR_EMULATE_PREPARES, true); - $platform = $this->_conn->getDatabasePlatform(); + $platform = $this->conn->getDatabasePlatform(); - $stmt = $this->_conn->prepare('INSERT INTO dbal630 (bool_col) VALUES(?)'); + $stmt = $this->conn->prepare('INSERT INTO dbal630 (bool_col) VALUES(?)'); $stmt->bindValue(1, $platform->convertBooleansToDatabaseValue('false'), ParameterType::BOOLEAN); $stmt->execute(); - $id = $this->_conn->lastInsertId('dbal630_id_seq'); + $id = $this->conn->lastInsertId('dbal630_id_seq'); self::assertNotEmpty($id); - $row = $this->_conn->fetchAssoc('SELECT bool_col FROM dbal630 WHERE id = ?', array($id)); + $row = $this->conn->fetchAssoc('SELECT bool_col FROM dbal630 WHERE id = ?', array($id)); self::assertFalse($row['bool_col']); } @@ -92,19 +92,19 @@ public function testBooleanConversionNullParamEmulatedPrepares( $statementValue, $databaseConvertedValue ) { - $this->_conn->getWrappedConnection()->setAttribute(PDO::ATTR_EMULATE_PREPARES, true); + $this->conn->getWrappedConnection()->setAttribute(PDO::ATTR_EMULATE_PREPARES, true); - $platform = $this->_conn->getDatabasePlatform(); + $platform = $this->conn->getDatabasePlatform(); - $stmt = $this->_conn->prepare('INSERT INTO dbal630_allow_nulls (bool_col) VALUES(?)'); + $stmt = $this->conn->prepare('INSERT INTO dbal630_allow_nulls (bool_col) VALUES(?)'); $stmt->bindValue(1, $platform->convertBooleansToDatabaseValue($statementValue)); $stmt->execute(); - $id = $this->_conn->lastInsertId('dbal630_allow_nulls_id_seq'); + $id = $this->conn->lastInsertId('dbal630_allow_nulls_id_seq'); self::assertNotEmpty($id); - $row = $this->_conn->fetchAssoc('SELECT bool_col FROM dbal630_allow_nulls WHERE id = ?', array($id)); + $row = $this->conn->fetchAssoc('SELECT bool_col FROM dbal630_allow_nulls WHERE id = ?', array($id)); self::assertSame($databaseConvertedValue, $row['bool_col']); } @@ -116,11 +116,11 @@ public function testBooleanConversionNullParamEmulatedPreparesWithBooleanTypeInB $statementValue, $databaseConvertedValue ) { - $this->_conn->getWrappedConnection()->setAttribute(PDO::ATTR_EMULATE_PREPARES, true); + $this->conn->getWrappedConnection()->setAttribute(PDO::ATTR_EMULATE_PREPARES, true); - $platform = $this->_conn->getDatabasePlatform(); + $platform = $this->conn->getDatabasePlatform(); - $stmt = $this->_conn->prepare('INSERT INTO dbal630_allow_nulls (bool_col) VALUES(?)'); + $stmt = $this->conn->prepare('INSERT INTO dbal630_allow_nulls (bool_col) VALUES(?)'); $stmt->bindValue( 1, $platform->convertBooleansToDatabaseValue($statementValue), @@ -128,11 +128,11 @@ public function testBooleanConversionNullParamEmulatedPreparesWithBooleanTypeInB ); $stmt->execute(); - $id = $this->_conn->lastInsertId('dbal630_allow_nulls_id_seq'); + $id = $this->conn->lastInsertId('dbal630_allow_nulls_id_seq'); self::assertNotEmpty($id); - $row = $this->_conn->fetchAssoc('SELECT bool_col FROM dbal630_allow_nulls WHERE id = ?', array($id)); + $row = $this->conn->fetchAssoc('SELECT bool_col FROM dbal630_allow_nulls WHERE id = ?', array($id)); self::assertSame($databaseConvertedValue, $row['bool_col']); } diff --git a/tests/Doctrine/Tests/DBAL/Functional/Ticket/DBAL752Test.php b/tests/Doctrine/Tests/DBAL/Functional/Ticket/DBAL752Test.php index 40f8fbe8815..6ba1fcfb5fd 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/Ticket/DBAL752Test.php +++ b/tests/Doctrine/Tests/DBAL/Functional/Ticket/DBAL752Test.php @@ -11,7 +11,7 @@ protected function setUp() { parent::setUp(); - $platform = $this->_conn->getDatabasePlatform()->getName(); + $platform = $this->conn->getDatabasePlatform()->getName(); if (!in_array($platform, array('sqlite'))) { $this->markTestSkipped('Related to SQLite only'); @@ -20,7 +20,7 @@ protected function setUp() public function testUnsignedIntegerDetection() { - $this->_conn->exec(<<conn->exec(<<_conn->getSchemaManager(); + $schemaManager = $this->conn->getSchemaManager(); $fetchedTable = $schemaManager->listTableDetails('dbal752_unsigneds'); diff --git a/tests/Doctrine/Tests/DBAL/Functional/TypeConversionTest.php b/tests/Doctrine/Tests/DBAL/Functional/TypeConversionTest.php index 9b9ef0b6342..5bb02f0966e 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/TypeConversionTest.php +++ b/tests/Doctrine/Tests/DBAL/Functional/TypeConversionTest.php @@ -13,7 +13,7 @@ protected function setUp() parent::setUp(); /* @var $sm \Doctrine\DBAL\Schema\AbstractSchemaManager */ - $sm = $this->_conn->getSchemaManager(); + $sm = $this->conn->getSchemaManager(); $table = new \Doctrine\DBAL\Schema\Table("type_conversion"); $table->addColumn('id', 'integer', array('notnull' => false)); @@ -34,7 +34,7 @@ protected function setUp() $table->setPrimaryKey(array('id')); try { - $this->_conn->getSchemaManager()->createTable($table); + $this->conn->getSchemaManager()->createTable($table); } catch(\Exception $e) { } @@ -75,12 +75,12 @@ public function testIdempotentDataConversion($type, $originalValue, $expectedPhp { $columnName = "test_" . $type; $typeInstance = Type::getType($type); - $insertionValue = $typeInstance->convertToDatabaseValue($originalValue, $this->_conn->getDatabasePlatform()); + $insertionValue = $typeInstance->convertToDatabaseValue($originalValue, $this->conn->getDatabasePlatform()); - $this->_conn->insert('type_conversion', array('id' => ++self::$typeCounter, $columnName => $insertionValue)); + $this->conn->insert('type_conversion', array('id' => ++self::$typeCounter, $columnName => $insertionValue)); $sql = "SELECT " . $columnName . " FROM type_conversion WHERE id = " . self::$typeCounter; - $actualDbValue = $typeInstance->convertToPHPValue($this->_conn->fetchColumn($sql), $this->_conn->getDatabasePlatform()); + $actualDbValue = $typeInstance->convertToPHPValue($this->conn->fetchColumn($sql), $this->conn->getDatabasePlatform()); if ($originalValue instanceof \DateTime) { self::assertInstanceOf($expectedPhpType, $actualDbValue, "The expected type from the conversion to and back from the database should be " . $expectedPhpType); diff --git a/tests/Doctrine/Tests/DBAL/Functional/WriteTest.php b/tests/Doctrine/Tests/DBAL/Functional/WriteTest.php index 54f4b6a9837..257fdd69457 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/WriteTest.php +++ b/tests/Doctrine/Tests/DBAL/Functional/WriteTest.php @@ -19,11 +19,11 @@ protected function setUp() $table->addColumn('test_string', 'string', array('notnull' => false)); $table->setPrimaryKey(array('id')); - $this->_conn->getSchemaManager()->createTable($table); + $this->conn->getSchemaManager()->createTable($table); } catch(\Exception $e) { } - $this->_conn->executeUpdate('DELETE FROM write_table'); + $this->conn->executeUpdate('DELETE FROM write_table'); } /** @@ -32,16 +32,16 @@ protected function setUp() public function testExecuteUpdateFirstTypeIsNull() { $sql = "INSERT INTO write_table (test_string, test_int) VALUES (?, ?)"; - $this->_conn->executeUpdate($sql, array("text", 1111), array(null, ParameterType::INTEGER)); + $this->conn->executeUpdate($sql, array("text", 1111), array(null, ParameterType::INTEGER)); $sql = "SELECT * FROM write_table WHERE test_string = ? AND test_int = ?"; - self::assertTrue((bool)$this->_conn->fetchColumn($sql, array("text", 1111))); + self::assertTrue((bool)$this->conn->fetchColumn($sql, array("text", 1111))); } public function testExecuteUpdate() { - $sql = "INSERT INTO write_table (test_int) VALUES ( " . $this->_conn->quote(1) . ")"; - $affected = $this->_conn->executeUpdate($sql); + $sql = "INSERT INTO write_table (test_int) VALUES ( " . $this->conn->quote(1) . ")"; + $affected = $this->conn->executeUpdate($sql); self::assertEquals(1, $affected, "executeUpdate() should return the number of affected rows!"); } @@ -49,7 +49,7 @@ public function testExecuteUpdate() public function testExecuteUpdateWithTypes() { $sql = "INSERT INTO write_table (test_int, test_string) VALUES (?, ?)"; - $affected = $this->_conn->executeUpdate( + $affected = $this->conn->executeUpdate( $sql, array(1, 'foo'), array(ParameterType::INTEGER, ParameterType::STRING) @@ -61,7 +61,7 @@ public function testExecuteUpdateWithTypes() public function testPrepareRowCountReturnsAffectedRows() { $sql = "INSERT INTO write_table (test_int, test_string) VALUES (?, ?)"; - $stmt = $this->_conn->prepare($sql); + $stmt = $this->conn->prepare($sql); $stmt->bindValue(1, 1); $stmt->bindValue(2, "foo"); @@ -73,7 +73,7 @@ public function testPrepareRowCountReturnsAffectedRows() public function testPrepareWithPdoTypes() { $sql = "INSERT INTO write_table (test_int, test_string) VALUES (?, ?)"; - $stmt = $this->_conn->prepare($sql); + $stmt = $this->conn->prepare($sql); $stmt->bindValue(1, 1, ParameterType::INTEGER); $stmt->bindValue(2, "foo", ParameterType::STRING); @@ -85,7 +85,7 @@ public function testPrepareWithPdoTypes() public function testPrepareWithDbalTypes() { $sql = "INSERT INTO write_table (test_int, test_string) VALUES (?, ?)"; - $stmt = $this->_conn->prepare($sql); + $stmt = $this->conn->prepare($sql); $stmt->bindValue(1, 1, Type::getType('integer')); $stmt->bindValue(2, "foo", Type::getType('string')); @@ -97,7 +97,7 @@ public function testPrepareWithDbalTypes() public function testPrepareWithDbalTypeNames() { $sql = "INSERT INTO write_table (test_int, test_string) VALUES (?, ?)"; - $stmt = $this->_conn->prepare($sql); + $stmt = $this->conn->prepare($sql); $stmt->bindValue(1, 1, 'integer'); $stmt->bindValue(2, "foo", 'string'); @@ -108,8 +108,8 @@ public function testPrepareWithDbalTypeNames() public function insertRows() { - self::assertEquals(1, $this->_conn->insert('write_table', array('test_int' => 1, 'test_string' => 'foo'))); - self::assertEquals(1, $this->_conn->insert('write_table', array('test_int' => 2, 'test_string' => 'bar'))); + self::assertEquals(1, $this->conn->insert('write_table', array('test_int' => 1, 'test_string' => 'foo'))); + self::assertEquals(1, $this->conn->insert('write_table', array('test_int' => 2, 'test_string' => 'bar'))); } public function testInsert() @@ -121,30 +121,30 @@ public function testDelete() { $this->insertRows(); - self::assertEquals(1, $this->_conn->delete('write_table', array('test_int' => 2))); - self::assertCount(1, $this->_conn->fetchAll('SELECT * FROM write_table')); + self::assertEquals(1, $this->conn->delete('write_table', array('test_int' => 2))); + self::assertCount(1, $this->conn->fetchAll('SELECT * FROM write_table')); - self::assertEquals(1, $this->_conn->delete('write_table', array('test_int' => 1))); - self::assertCount(0, $this->_conn->fetchAll('SELECT * FROM write_table')); + self::assertEquals(1, $this->conn->delete('write_table', array('test_int' => 1))); + self::assertCount(0, $this->conn->fetchAll('SELECT * FROM write_table')); } public function testUpdate() { $this->insertRows(); - self::assertEquals(1, $this->_conn->update('write_table', array('test_string' => 'bar'), array('test_string' => 'foo'))); - self::assertEquals(2, $this->_conn->update('write_table', array('test_string' => 'baz'), array('test_string' => 'bar'))); - self::assertEquals(0, $this->_conn->update('write_table', array('test_string' => 'baz'), array('test_string' => 'bar'))); + self::assertEquals(1, $this->conn->update('write_table', array('test_string' => 'bar'), array('test_string' => 'foo'))); + self::assertEquals(2, $this->conn->update('write_table', array('test_string' => 'baz'), array('test_string' => 'bar'))); + self::assertEquals(0, $this->conn->update('write_table', array('test_string' => 'baz'), array('test_string' => 'bar'))); } public function testLastInsertId() { - if ( ! $this->_conn->getDatabasePlatform()->prefersIdentityColumns()) { + if ( ! $this->conn->getDatabasePlatform()->prefersIdentityColumns()) { $this->markTestSkipped('Test only works on platforms with identity columns.'); } - self::assertEquals(1, $this->_conn->insert('write_table', array('test_int' => 2, 'test_string' => 'bar'))); - $num = $this->_conn->lastInsertId(); + self::assertEquals(1, $this->conn->insert('write_table', array('test_int' => 2, 'test_string' => 'bar'))); + $num = $this->conn->lastInsertId(); self::assertNotNull($num, "LastInsertId() should not be null."); self::assertGreaterThan(0, $num, "LastInsertId() should be non-negative number."); @@ -152,25 +152,25 @@ public function testLastInsertId() public function testLastInsertIdSequence() { - if ( ! $this->_conn->getDatabasePlatform()->supportsSequences()) { + if ( ! $this->conn->getDatabasePlatform()->supportsSequences()) { $this->markTestSkipped('Test only works on platforms with sequences.'); } $sequence = new \Doctrine\DBAL\Schema\Sequence('write_table_id_seq'); try { - $this->_conn->getSchemaManager()->createSequence($sequence); + $this->conn->getSchemaManager()->createSequence($sequence); } catch(\Exception $e) { } - $sequences = $this->_conn->getSchemaManager()->listSequences(); + $sequences = $this->conn->getSchemaManager()->listSequences(); self::assertCount(1, array_filter($sequences, function($sequence) { return strtolower($sequence->getName()) === 'write_table_id_seq'; })); - $stmt = $this->_conn->query($this->_conn->getDatabasePlatform()->getSequenceNextValSQL('write_table_id_seq')); + $stmt = $this->conn->query($this->conn->getDatabasePlatform()->getSequenceNextValSQL('write_table_id_seq')); $nextSequenceVal = $stmt->fetchColumn(); - $lastInsertId = $this->_conn->lastInsertId('write_table_id_seq'); + $lastInsertId = $this->conn->lastInsertId('write_table_id_seq'); self::assertGreaterThan(0, $lastInsertId); self::assertEquals($nextSequenceVal, $lastInsertId); @@ -178,11 +178,11 @@ public function testLastInsertIdSequence() public function testLastInsertIdNoSequenceGiven() { - if ( ! $this->_conn->getDatabasePlatform()->supportsSequences() || $this->_conn->getDatabasePlatform()->supportsIdentityColumns()) { + if ( ! $this->conn->getDatabasePlatform()->supportsSequences() || $this->conn->getDatabasePlatform()->supportsIdentityColumns()) { $this->markTestSkipped("Test only works consistently on platforms that support sequences and don't support identity columns."); } - self::assertFalse($this->_conn->lastInsertId( null )); + self::assertFalse($this->conn->lastInsertId( null )); } @@ -193,15 +193,15 @@ public function testInsertWithKeyValueTypes() { $testString = new \DateTime('2013-04-14 10:10:10'); - $this->_conn->insert( + $this->conn->insert( 'write_table', array('test_int' => '30', 'test_string' => $testString), array('test_string' => 'datetime', 'test_int' => 'integer') ); - $data = $this->_conn->fetchColumn('SELECT test_string FROM write_table WHERE test_int = 30'); + $data = $this->conn->fetchColumn('SELECT test_string FROM write_table WHERE test_int = 30'); - self::assertEquals($testString->format($this->_conn->getDatabasePlatform()->getDateTimeFormatString()), $data); + self::assertEquals($testString->format($this->conn->getDatabasePlatform()->getDateTimeFormatString()), $data); } /** @@ -211,7 +211,7 @@ public function testUpdateWithKeyValueTypes() { $testString = new \DateTime('2013-04-14 10:10:10'); - $this->_conn->insert( + $this->conn->insert( 'write_table', array('test_int' => '30', 'test_string' => $testString), array('test_string' => 'datetime', 'test_int' => 'integer') @@ -219,16 +219,16 @@ public function testUpdateWithKeyValueTypes() $testString = new \DateTime('2013-04-15 10:10:10'); - $this->_conn->update( + $this->conn->update( 'write_table', array('test_string' => $testString), array('test_int' => '30'), array('test_string' => 'datetime', 'test_int' => 'integer') ); - $data = $this->_conn->fetchColumn('SELECT test_string FROM write_table WHERE test_int = 30'); + $data = $this->conn->fetchColumn('SELECT test_string FROM write_table WHERE test_int = 30'); - self::assertEquals($testString->format($this->_conn->getDatabasePlatform()->getDateTimeFormatString()), $data); + self::assertEquals($testString->format($this->conn->getDatabasePlatform()->getDateTimeFormatString()), $data); } /** @@ -237,22 +237,22 @@ public function testUpdateWithKeyValueTypes() public function testDeleteWithKeyValueTypes() { $val = new \DateTime('2013-04-14 10:10:10'); - $this->_conn->insert( + $this->conn->insert( 'write_table', array('test_int' => '30', 'test_string' => $val), array('test_string' => 'datetime', 'test_int' => 'integer') ); - $this->_conn->delete('write_table', array('test_int' => 30, 'test_string' => $val), array('test_string' => 'datetime', 'test_int' => 'integer')); + $this->conn->delete('write_table', array('test_int' => 30, 'test_string' => $val), array('test_string' => 'datetime', 'test_int' => 'integer')); - $data = $this->_conn->fetchColumn('SELECT test_string FROM write_table WHERE test_int = 30'); + $data = $this->conn->fetchColumn('SELECT test_string FROM write_table WHERE test_int = 30'); self::assertFalse($data); } public function testEmptyIdentityInsert() { - $platform = $this->_conn->getDatabasePlatform(); + $platform = $this->conn->getDatabasePlatform(); if ( ! ($platform->supportsIdentityColumns() || $platform->usesSequenceEmulatedIdentityColumns()) ) { $this->markTestSkipped( @@ -265,11 +265,11 @@ public function testEmptyIdentityInsert() $table->setPrimaryKey(array('id')); try { - $this->_conn->getSchemaManager()->dropTable($table->getQuotedName($platform)); + $this->conn->getSchemaManager()->dropTable($table->getQuotedName($platform)); } catch(\Exception $e) { } foreach ($platform->getCreateTableSQL($table) as $sql) { - $this->_conn->exec($sql); + $this->conn->exec($sql); } $seqName = $platform->usesSequenceEmulatedIdentityColumns() @@ -278,13 +278,13 @@ public function testEmptyIdentityInsert() $sql = $platform->getEmptyIdentityInsertSQL('test_empty_identity', 'id'); - $this->_conn->exec($sql); + $this->conn->exec($sql); - $firstId = $this->_conn->lastInsertId($seqName); + $firstId = $this->conn->lastInsertId($seqName); - $this->_conn->exec($sql); + $this->conn->exec($sql); - $secondId = $this->_conn->lastInsertId($seqName); + $secondId = $this->conn->lastInsertId($seqName); self::assertGreaterThan($firstId, $secondId); @@ -295,38 +295,38 @@ public function testEmptyIdentityInsert() */ public function testUpdateWhereIsNull() { - $this->_conn->insert( + $this->conn->insert( 'write_table', ['test_int' => '30', 'test_string' => null], ['test_string' => 'string', 'test_int' => 'integer'] ); - $data = $this->_conn->fetchAll('SELECT * FROM write_table WHERE test_int = 30'); + $data = $this->conn->fetchAll('SELECT * FROM write_table WHERE test_int = 30'); self::assertCount(1, $data); - $this->_conn->update('write_table', ['test_int' => 10], ['test_string' => null], ['test_string' => 'string', 'test_int' => 'integer']); + $this->conn->update('write_table', ['test_int' => 10], ['test_string' => null], ['test_string' => 'string', 'test_int' => 'integer']); - $data = $this->_conn->fetchAll('SELECT * FROM write_table WHERE test_int = 30'); + $data = $this->conn->fetchAll('SELECT * FROM write_table WHERE test_int = 30'); self::assertCount(0, $data); } public function testDeleteWhereIsNull() { - $this->_conn->insert( + $this->conn->insert( 'write_table', ['test_int' => '30', 'test_string' => null], ['test_string' => 'string', 'test_int' => 'integer'] ); - $data = $this->_conn->fetchAll('SELECT * FROM write_table WHERE test_int = 30'); + $data = $this->conn->fetchAll('SELECT * FROM write_table WHERE test_int = 30'); self::assertCount(1, $data); - $this->_conn->delete('write_table', ['test_string' => null], ['test_string' => 'string']); + $this->conn->delete('write_table', ['test_string' => null], ['test_string' => 'string']); - $data = $this->_conn->fetchAll('SELECT * FROM write_table WHERE test_int = 30'); + $data = $this->conn->fetchAll('SELECT * FROM write_table WHERE test_int = 30'); self::assertCount(0, $data); } diff --git a/tests/Doctrine/Tests/DBAL/Mocks/MockPlatform.php b/tests/Doctrine/Tests/DBAL/Mocks/MockPlatform.php index 3f8f0477cc2..04aaa84434b 100644 --- a/tests/Doctrine/Tests/DBAL/Mocks/MockPlatform.php +++ b/tests/Doctrine/Tests/DBAL/Mocks/MockPlatform.php @@ -19,7 +19,7 @@ public function getBooleanTypeDeclarationSQL(array $columnDef) {} public function getIntegerTypeDeclarationSQL(array $columnDef) {} public function getBigIntTypeDeclarationSQL(array $columnDef) {} public function getSmallIntTypeDeclarationSQL(array $columnDef) {} - public function _getCommonIntegerTypeDeclarationSQL(array $columnDef) {} + public function getCommonIntegerTypeDeclarationSQL(array $columnDef) {} public function getVarcharTypeDeclarationSQL(array $field) { diff --git a/tests/Doctrine/Tests/DBAL/Performance/TypeConversionPerformanceTest.php b/tests/Doctrine/Tests/DBAL/Performance/TypeConversionPerformanceTest.php index 42c549aa399..34b881023c5 100644 --- a/tests/Doctrine/Tests/DBAL/Performance/TypeConversionPerformanceTest.php +++ b/tests/Doctrine/Tests/DBAL/Performance/TypeConversionPerformanceTest.php @@ -21,7 +21,7 @@ public function testDateTimeTypeConversionPerformance($count) { $value = new \DateTime; $type = Type::getType("datetime"); - $platform = $this->_conn->getDatabasePlatform(); + $platform = $this->conn->getDatabasePlatform(); $this->startTiming(); for ($i = 0; $i < $count; $i++) { $type->convertToDatabaseValue($value, $platform); diff --git a/tests/Doctrine/Tests/DBAL/Platforms/AbstractMySQLPlatformTestCase.php b/tests/Doctrine/Tests/DBAL/Platforms/AbstractMySQLPlatformTestCase.php index 54f49354c52..8f22f8999c1 100644 --- a/tests/Doctrine/Tests/DBAL/Platforms/AbstractMySQLPlatformTestCase.php +++ b/tests/Doctrine/Tests/DBAL/Platforms/AbstractMySQLPlatformTestCase.php @@ -13,7 +13,7 @@ abstract class AbstractMySQLPlatformTestCase extends AbstractPlatformTestCase { public function testModifyLimitQueryWitoutLimit() { - $sql = $this->_platform->modifyLimitQuery('SELECT n FROM Foo', null , 10); + $sql = $this->platform->modifyLimitQuery('SELECT n FROM Foo', null , 10); self::assertEquals('SELECT n FROM Foo LIMIT 18446744073709551615 OFFSET 10',$sql); } @@ -22,7 +22,7 @@ public function testGenerateMixedCaseTableCreate() $table = new Table("Foo"); $table->addColumn("Bar", "integer"); - $sql = $this->_platform->getCreateTableSQL($table); + $sql = $this->platform->getCreateTableSQL($table); self::assertEquals('CREATE TABLE Foo (Bar INT NOT NULL) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB', array_shift($sql)); } @@ -47,54 +47,54 @@ public function getGenerateAlterTableSql() public function testGeneratesSqlSnippets() { - self::assertEquals('RLIKE', $this->_platform->getRegexpExpression(), 'Regular expression operator is not correct'); - self::assertEquals('`', $this->_platform->getIdentifierQuoteCharacter(), 'Quote character is not correct'); - self::assertEquals('CONCAT(column1, column2, column3)', $this->_platform->getConcatExpression('column1', 'column2', 'column3'), 'Concatenation function is not correct'); + self::assertEquals('RLIKE', $this->platform->getRegexpExpression(), 'Regular expression operator is not correct'); + self::assertEquals('`', $this->platform->getIdentifierQuoteCharacter(), 'Quote character is not correct'); + self::assertEquals('CONCAT(column1, column2, column3)', $this->platform->getConcatExpression('column1', 'column2', 'column3'), 'Concatenation function is not correct'); } public function testGeneratesTransactionsCommands() { self::assertEquals( 'SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED', - $this->_platform->getSetTransactionIsolationSQL(\Doctrine\DBAL\Connection::TRANSACTION_READ_UNCOMMITTED), + $this->platform->getSetTransactionIsolationSQL(\Doctrine\DBAL\Connection::TRANSACTION_READ_UNCOMMITTED), '' ); self::assertEquals( 'SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED', - $this->_platform->getSetTransactionIsolationSQL(\Doctrine\DBAL\Connection::TRANSACTION_READ_COMMITTED) + $this->platform->getSetTransactionIsolationSQL(\Doctrine\DBAL\Connection::TRANSACTION_READ_COMMITTED) ); self::assertEquals( 'SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ', - $this->_platform->getSetTransactionIsolationSQL(\Doctrine\DBAL\Connection::TRANSACTION_REPEATABLE_READ) + $this->platform->getSetTransactionIsolationSQL(\Doctrine\DBAL\Connection::TRANSACTION_REPEATABLE_READ) ); self::assertEquals( 'SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE', - $this->_platform->getSetTransactionIsolationSQL(\Doctrine\DBAL\Connection::TRANSACTION_SERIALIZABLE) + $this->platform->getSetTransactionIsolationSQL(\Doctrine\DBAL\Connection::TRANSACTION_SERIALIZABLE) ); } public function testGeneratesDDLSnippets() { - self::assertEquals('SHOW DATABASES', $this->_platform->getListDatabasesSQL()); - self::assertEquals('CREATE DATABASE foobar', $this->_platform->getCreateDatabaseSQL('foobar')); - self::assertEquals('DROP DATABASE foobar', $this->_platform->getDropDatabaseSQL('foobar')); - self::assertEquals('DROP TABLE foobar', $this->_platform->getDropTableSQL('foobar')); + self::assertEquals('SHOW DATABASES', $this->platform->getListDatabasesSQL()); + self::assertEquals('CREATE DATABASE foobar', $this->platform->getCreateDatabaseSQL('foobar')); + self::assertEquals('DROP DATABASE foobar', $this->platform->getDropDatabaseSQL('foobar')); + self::assertEquals('DROP TABLE foobar', $this->platform->getDropTableSQL('foobar')); } public function testGeneratesTypeDeclarationForIntegers() { self::assertEquals( 'INT', - $this->_platform->getIntegerTypeDeclarationSQL(array()) + $this->platform->getIntegerTypeDeclarationSQL(array()) ); self::assertEquals( 'INT AUTO_INCREMENT', - $this->_platform->getIntegerTypeDeclarationSQL(array('autoincrement' => true) + $this->platform->getIntegerTypeDeclarationSQL(array('autoincrement' => true) )); self::assertEquals( 'INT AUTO_INCREMENT', - $this->_platform->getIntegerTypeDeclarationSQL( + $this->platform->getIntegerTypeDeclarationSQL( array('autoincrement' => true, 'primary' => true) )); } @@ -103,34 +103,34 @@ public function testGeneratesTypeDeclarationForStrings() { self::assertEquals( 'CHAR(10)', - $this->_platform->getVarcharTypeDeclarationSQL( + $this->platform->getVarcharTypeDeclarationSQL( array('length' => 10, 'fixed' => true) )); self::assertEquals( 'VARCHAR(50)', - $this->_platform->getVarcharTypeDeclarationSQL(array('length' => 50)), + $this->platform->getVarcharTypeDeclarationSQL(array('length' => 50)), 'Variable string declaration is not correct' ); self::assertEquals( 'VARCHAR(255)', - $this->_platform->getVarcharTypeDeclarationSQL(array()), + $this->platform->getVarcharTypeDeclarationSQL(array()), 'Long string declaration is not correct' ); } public function testPrefersIdentityColumns() { - self::assertTrue($this->_platform->prefersIdentityColumns()); + self::assertTrue($this->platform->prefersIdentityColumns()); } public function testSupportsIdentityColumns() { - self::assertTrue($this->_platform->supportsIdentityColumns()); + self::assertTrue($this->platform->supportsIdentityColumns()); } public function testDoesSupportSavePoints() { - self::assertTrue($this->_platform->supportsSavepoints()); + self::assertTrue($this->platform->supportsSavepoints()); } public function getGenerateIndexSql() @@ -166,7 +166,7 @@ public function testUniquePrimaryKey() $c = new \Doctrine\DBAL\Schema\Comparator; $diff = $c->diffTable($oldTable, $keyTable); - $sql = $this->_platform->getAlterTableSQL($diff); + $sql = $this->platform->getAlterTableSQL($diff); self::assertEquals(array( "ALTER TABLE foo ADD PRIMARY KEY (bar)", @@ -176,13 +176,13 @@ public function testUniquePrimaryKey() public function testModifyLimitQuery() { - $sql = $this->_platform->modifyLimitQuery('SELECT * FROM user', 10, 0); + $sql = $this->platform->modifyLimitQuery('SELECT * FROM user', 10, 0); self::assertEquals('SELECT * FROM user LIMIT 10 OFFSET 0', $sql); } public function testModifyLimitQueryWithEmptyOffset() { - $sql = $this->_platform->modifyLimitQuery('SELECT * FROM user', 10); + $sql = $this->platform->modifyLimitQuery('SELECT * FROM user', 10); self::assertEquals('SELECT * FROM user LIMIT 10', $sql); } @@ -191,9 +191,9 @@ public function testModifyLimitQueryWithEmptyOffset() */ public function testGetDateTimeTypeDeclarationSql() { - self::assertEquals("DATETIME", $this->_platform->getDateTimeTypeDeclarationSQL(array('version' => false))); - self::assertEquals("TIMESTAMP", $this->_platform->getDateTimeTypeDeclarationSQL(array('version' => true))); - self::assertEquals("DATETIME", $this->_platform->getDateTimeTypeDeclarationSQL(array())); + self::assertEquals("DATETIME", $this->platform->getDateTimeTypeDeclarationSQL(array('version' => false))); + self::assertEquals("TIMESTAMP", $this->platform->getDateTimeTypeDeclarationSQL(array('version' => true))); + self::assertEquals("DATETIME", $this->platform->getDateTimeTypeDeclarationSQL(array())); } public function getCreateTableColumnCommentsSQL() @@ -220,11 +220,11 @@ public function testChangeIndexWithForeignKeys() $unique = new Index("uniq", array("col"), true); $diff = new TableDiff("test", array(), array(), array(), array($unique), array(), array($index)); - $sql = $this->_platform->getAlterTableSQL($diff); + $sql = $this->platform->getAlterTableSQL($diff); self::assertEquals(array("ALTER TABLE test DROP INDEX idx, ADD UNIQUE INDEX uniq (col)"), $sql); $diff = new TableDiff("test", array(), array(), array(), array($index), array(), array($unique)); - $sql = $this->_platform->getAlterTableSQL($diff); + $sql = $this->platform->getAlterTableSQL($diff); self::assertEquals(array("ALTER TABLE test DROP INDEX uniq, ADD INDEX idx (col)"), $sql); } @@ -269,7 +269,7 @@ public function testCreateTableWithFulltextIndex() $index = $table->getIndex('fulltext_text'); $index->addFlag('fulltext'); - $sql = $this->_platform->getCreateTableSQL($table); + $sql = $this->platform->getCreateTableSQL($table); self::assertEquals(array('CREATE TABLE fulltext_table (text LONGTEXT NOT NULL, FULLTEXT INDEX fulltext_text (text)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = MyISAM'), $sql); } @@ -283,32 +283,32 @@ public function testCreateTableWithSpatialIndex() $index = $table->getIndex('spatial_text'); $index->addFlag('spatial'); - $sql = $this->_platform->getCreateTableSQL($table); + $sql = $this->platform->getCreateTableSQL($table); self::assertEquals(array('CREATE TABLE spatial_table (point LONGTEXT NOT NULL, SPATIAL INDEX spatial_text (point)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = MyISAM'), $sql); } public function testClobTypeDeclarationSQL() { - self::assertEquals('TINYTEXT', $this->_platform->getClobTypeDeclarationSQL(array('length' => 1))); - self::assertEquals('TINYTEXT', $this->_platform->getClobTypeDeclarationSQL(array('length' => 255))); - self::assertEquals('TEXT', $this->_platform->getClobTypeDeclarationSQL(array('length' => 256))); - self::assertEquals('TEXT', $this->_platform->getClobTypeDeclarationSQL(array('length' => 65535))); - self::assertEquals('MEDIUMTEXT', $this->_platform->getClobTypeDeclarationSQL(array('length' => 65536))); - self::assertEquals('MEDIUMTEXT', $this->_platform->getClobTypeDeclarationSQL(array('length' => 16777215))); - self::assertEquals('LONGTEXT', $this->_platform->getClobTypeDeclarationSQL(array('length' => 16777216))); - self::assertEquals('LONGTEXT', $this->_platform->getClobTypeDeclarationSQL(array())); + self::assertEquals('TINYTEXT', $this->platform->getClobTypeDeclarationSQL(array('length' => 1))); + self::assertEquals('TINYTEXT', $this->platform->getClobTypeDeclarationSQL(array('length' => 255))); + self::assertEquals('TEXT', $this->platform->getClobTypeDeclarationSQL(array('length' => 256))); + self::assertEquals('TEXT', $this->platform->getClobTypeDeclarationSQL(array('length' => 65535))); + self::assertEquals('MEDIUMTEXT', $this->platform->getClobTypeDeclarationSQL(array('length' => 65536))); + self::assertEquals('MEDIUMTEXT', $this->platform->getClobTypeDeclarationSQL(array('length' => 16777215))); + self::assertEquals('LONGTEXT', $this->platform->getClobTypeDeclarationSQL(array('length' => 16777216))); + self::assertEquals('LONGTEXT', $this->platform->getClobTypeDeclarationSQL(array())); } public function testBlobTypeDeclarationSQL() { - self::assertEquals('TINYBLOB', $this->_platform->getBlobTypeDeclarationSQL(array('length' => 1))); - self::assertEquals('TINYBLOB', $this->_platform->getBlobTypeDeclarationSQL(array('length' => 255))); - self::assertEquals('BLOB', $this->_platform->getBlobTypeDeclarationSQL(array('length' => 256))); - self::assertEquals('BLOB', $this->_platform->getBlobTypeDeclarationSQL(array('length' => 65535))); - self::assertEquals('MEDIUMBLOB', $this->_platform->getBlobTypeDeclarationSQL(array('length' => 65536))); - self::assertEquals('MEDIUMBLOB', $this->_platform->getBlobTypeDeclarationSQL(array('length' => 16777215))); - self::assertEquals('LONGBLOB', $this->_platform->getBlobTypeDeclarationSQL(array('length' => 16777216))); - self::assertEquals('LONGBLOB', $this->_platform->getBlobTypeDeclarationSQL(array())); + self::assertEquals('TINYBLOB', $this->platform->getBlobTypeDeclarationSQL(array('length' => 1))); + self::assertEquals('TINYBLOB', $this->platform->getBlobTypeDeclarationSQL(array('length' => 255))); + self::assertEquals('BLOB', $this->platform->getBlobTypeDeclarationSQL(array('length' => 256))); + self::assertEquals('BLOB', $this->platform->getBlobTypeDeclarationSQL(array('length' => 65535))); + self::assertEquals('MEDIUMBLOB', $this->platform->getBlobTypeDeclarationSQL(array('length' => 65536))); + self::assertEquals('MEDIUMBLOB', $this->platform->getBlobTypeDeclarationSQL(array('length' => 16777215))); + self::assertEquals('LONGBLOB', $this->platform->getBlobTypeDeclarationSQL(array('length' => 16777216))); + self::assertEquals('LONGBLOB', $this->platform->getBlobTypeDeclarationSQL(array())); } /** @@ -329,7 +329,7 @@ public function testAlterTableAddPrimaryKey() self::assertEquals( array('DROP INDEX idx_id ON alter_table_add_pk', 'ALTER TABLE alter_table_add_pk ADD PRIMARY KEY (id)'), - $this->_platform->getAlterTableSQL($comparator->diffTable($table, $diffTable)) + $this->platform->getAlterTableSQL($comparator->diffTable($table, $diffTable)) ); } @@ -355,7 +355,7 @@ public function testAlterPrimaryKeyWithAutoincrementColumn() 'ALTER TABLE alter_primary_key DROP PRIMARY KEY', 'ALTER TABLE alter_primary_key ADD PRIMARY KEY (foo)' ), - $this->_platform->getAlterTableSQL($comparator->diffTable($table, $diffTable)) + $this->platform->getAlterTableSQL($comparator->diffTable($table, $diffTable)) ); } @@ -380,7 +380,7 @@ public function testDropPrimaryKeyWithAutoincrementColumn() 'ALTER TABLE drop_primary_key MODIFY id INT NOT NULL', 'ALTER TABLE drop_primary_key DROP PRIMARY KEY' ), - $this->_platform->getAlterTableSQL($comparator->diffTable($table, $diffTable)) + $this->platform->getAlterTableSQL($comparator->diffTable($table, $diffTable)) ); } @@ -407,7 +407,7 @@ public function testDropNonAutoincrementColumnFromCompositePrimaryKeyWithAutoinc 'ALTER TABLE tbl DROP PRIMARY KEY', 'ALTER TABLE tbl ADD PRIMARY KEY (id)', ), - $this->_platform->getAlterTableSQL($comparator->diffTable($table, $diffTable)) + $this->platform->getAlterTableSQL($comparator->diffTable($table, $diffTable)) ); } @@ -434,7 +434,7 @@ public function testAddNonAutoincrementColumnToPrimaryKeyWithAutoincrementColumn 'ALTER TABLE tbl DROP PRIMARY KEY', 'ALTER TABLE tbl ADD PRIMARY KEY (id, foo)', ), - $this->_platform->getAlterTableSQL($comparator->diffTable($table, $diffTable)) + $this->platform->getAlterTableSQL($comparator->diffTable($table, $diffTable)) ); } @@ -454,7 +454,7 @@ public function testAddAutoIncrementPrimaryKey() $c = new \Doctrine\DBAL\Schema\Comparator; $diff = $c->diffTable($oldTable, $keyTable); - $sql = $this->_platform->getAlterTableSQL($diff); + $sql = $this->platform->getAlterTableSQL($diff); self::assertEquals(array( "ALTER TABLE foo ADD id INT AUTO_INCREMENT NOT NULL, ADD PRIMARY KEY (id)", @@ -466,7 +466,7 @@ public function testNamedPrimaryKey() $diff = new TableDiff('mytable'); $diff->changedIndexes['foo_index'] = new Index('foo_index', array('foo'), true, true); - $sql = $this->_platform->getAlterTableSQL($diff); + $sql = $this->platform->getAlterTableSQL($diff); self::assertEquals(array( "ALTER TABLE mytable DROP PRIMARY KEY", @@ -494,17 +494,17 @@ public function testAlterPrimaryKeyWithNewColumn() 'ALTER TABLE yolo ADD pkc2 INT NOT NULL', 'ALTER TABLE yolo ADD PRIMARY KEY (pkc1, pkc2)', ), - $this->_platform->getAlterTableSQL($comparator->diffTable($table, $diffTable)) + $this->platform->getAlterTableSQL($comparator->diffTable($table, $diffTable)) ); } public function testInitializesDoctrineTypeMappings() { - self::assertTrue($this->_platform->hasDoctrineTypeMappingFor('binary')); - self::assertSame('binary', $this->_platform->getDoctrineTypeMapping('binary')); + self::assertTrue($this->platform->hasDoctrineTypeMappingFor('binary')); + self::assertSame('binary', $this->platform->getDoctrineTypeMapping('binary')); - self::assertTrue($this->_platform->hasDoctrineTypeMappingFor('varbinary')); - self::assertSame('binary', $this->_platform->getDoctrineTypeMapping('varbinary')); + self::assertTrue($this->platform->hasDoctrineTypeMappingFor('varbinary')); + self::assertSame('binary', $this->platform->getDoctrineTypeMapping('varbinary')); } protected function getBinaryMaxLength() @@ -514,19 +514,19 @@ protected function getBinaryMaxLength() public function testReturnsBinaryTypeDeclarationSQL() { - self::assertSame('VARBINARY(255)', $this->_platform->getBinaryTypeDeclarationSQL(array())); - self::assertSame('VARBINARY(255)', $this->_platform->getBinaryTypeDeclarationSQL(array('length' => 0))); - self::assertSame('VARBINARY(65535)', $this->_platform->getBinaryTypeDeclarationSQL(array('length' => 65535))); - self::assertSame('MEDIUMBLOB', $this->_platform->getBinaryTypeDeclarationSQL(array('length' => 65536))); - self::assertSame('MEDIUMBLOB', $this->_platform->getBinaryTypeDeclarationSQL(array('length' => 16777215))); - self::assertSame('LONGBLOB', $this->_platform->getBinaryTypeDeclarationSQL(array('length' => 16777216))); + self::assertSame('VARBINARY(255)', $this->platform->getBinaryTypeDeclarationSQL(array())); + self::assertSame('VARBINARY(255)', $this->platform->getBinaryTypeDeclarationSQL(array('length' => 0))); + self::assertSame('VARBINARY(65535)', $this->platform->getBinaryTypeDeclarationSQL(array('length' => 65535))); + self::assertSame('MEDIUMBLOB', $this->platform->getBinaryTypeDeclarationSQL(array('length' => 65536))); + self::assertSame('MEDIUMBLOB', $this->platform->getBinaryTypeDeclarationSQL(array('length' => 16777215))); + self::assertSame('LONGBLOB', $this->platform->getBinaryTypeDeclarationSQL(array('length' => 16777216))); - self::assertSame('BINARY(255)', $this->_platform->getBinaryTypeDeclarationSQL(array('fixed' => true))); - self::assertSame('BINARY(255)', $this->_platform->getBinaryTypeDeclarationSQL(array('fixed' => true, 'length' => 0))); - self::assertSame('BINARY(65535)', $this->_platform->getBinaryTypeDeclarationSQL(array('fixed' => true, 'length' => 65535))); - self::assertSame('MEDIUMBLOB', $this->_platform->getBinaryTypeDeclarationSQL(array('fixed' => true, 'length' => 65536))); - self::assertSame('MEDIUMBLOB', $this->_platform->getBinaryTypeDeclarationSQL(array('fixed' => true, 'length' => 16777215))); - self::assertSame('LONGBLOB', $this->_platform->getBinaryTypeDeclarationSQL(array('fixed' => true, 'length' => 16777216))); + self::assertSame('BINARY(255)', $this->platform->getBinaryTypeDeclarationSQL(array('fixed' => true))); + self::assertSame('BINARY(255)', $this->platform->getBinaryTypeDeclarationSQL(array('fixed' => true, 'length' => 0))); + self::assertSame('BINARY(65535)', $this->platform->getBinaryTypeDeclarationSQL(array('fixed' => true, 'length' => 65535))); + self::assertSame('MEDIUMBLOB', $this->platform->getBinaryTypeDeclarationSQL(array('fixed' => true, 'length' => 65536))); + self::assertSame('MEDIUMBLOB', $this->platform->getBinaryTypeDeclarationSQL(array('fixed' => true, 'length' => 16777215))); + self::assertSame('LONGBLOB', $this->platform->getBinaryTypeDeclarationSQL(array('fixed' => true, 'length' => 16777216))); } public function testDoesNotPropagateForeignKeyCreationForNonSupportingEngines() @@ -540,7 +540,7 @@ public function testDoesNotPropagateForeignKeyCreationForNonSupportingEngines() self::assertSame( array('CREATE TABLE foreign_table (id INT NOT NULL, fk_id INT NOT NULL, INDEX IDX_5690FFE2A57719D0 (fk_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = MyISAM'), - $this->_platform->getCreateTableSQL( + $this->platform->getCreateTableSQL( $table, AbstractPlatform::CREATE_INDEXES|AbstractPlatform::CREATE_FOREIGNKEYS ) @@ -554,7 +554,7 @@ public function testDoesNotPropagateForeignKeyCreationForNonSupportingEngines() 'CREATE TABLE foreign_table (id INT NOT NULL, fk_id INT NOT NULL, INDEX IDX_5690FFE2A57719D0 (fk_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB', 'ALTER TABLE foreign_table ADD CONSTRAINT FK_5690FFE2A57719D0 FOREIGN KEY (fk_id) REFERENCES foreign_table (id)' ), - $this->_platform->getCreateTableSQL( + $this->platform->getCreateTableSQL( $table, AbstractPlatform::CREATE_INDEXES|AbstractPlatform::CREATE_FOREIGNKEYS ) @@ -580,7 +580,7 @@ public function testDoesNotPropagateForeignKeyAlterationForNonSupportingEngines( $tableDiff->changedForeignKeys = $changedForeignKeys; $tableDiff->removedForeignKeys = $removedForeignKeys; - self::assertEmpty($this->_platform->getAlterTableSQL($tableDiff)); + self::assertEmpty($this->platform->getAlterTableSQL($tableDiff)); $table->addOption('engine', 'InnoDB'); @@ -597,7 +597,7 @@ public function testDoesNotPropagateForeignKeyAlterationForNonSupportingEngines( 'ALTER TABLE foreign_table ADD CONSTRAINT fk_add FOREIGN KEY (fk_id) REFERENCES foo (id)', 'ALTER TABLE foreign_table ADD CONSTRAINT fk_change FOREIGN KEY (fk_id) REFERENCES bar (id)', ), - $this->_platform->getAlterTableSQL($tableDiff) + $this->platform->getAlterTableSQL($tableDiff) ); } @@ -669,7 +669,7 @@ public function testDoesNotPropagateDefaultValuesForUnsupportedColumnTypes() self::assertSame( array('CREATE TABLE text_blob_default_value (def_text LONGTEXT NOT NULL, def_text_null LONGTEXT DEFAULT NULL, def_blob LONGBLOB NOT NULL, def_blob_null LONGBLOB DEFAULT NULL) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB'), - $this->_platform->getCreateTableSQL($table) + $this->platform->getCreateTableSQL($table) ); $diffTable = clone $table; @@ -680,7 +680,7 @@ public function testDoesNotPropagateDefaultValuesForUnsupportedColumnTypes() $comparator = new Comparator(); - self::assertEmpty($this->_platform->getAlterTableSQL($comparator->diffTable($table, $diffTable))); + self::assertEmpty($this->platform->getAlterTableSQL($comparator->diffTable($table, $diffTable))); } /** @@ -723,7 +723,7 @@ protected function getQuotedAlterTableChangeColumnLengthSQL() */ public function testReturnsGuidTypeDeclarationSQL() { - self::assertSame('CHAR(36)', $this->_platform->getGuidTypeDeclarationSQL(array())); + self::assertSame('CHAR(36)', $this->platform->getGuidTypeDeclarationSQL(array())); } /** @@ -845,7 +845,7 @@ public function getGeneratesFloatDeclarationSQL() */ public function testQuotesTableNameInListTableIndexesSQL() { - self::assertContains("'Foo''Bar\\\\'", $this->_platform->getListTableIndexesSQL("Foo'Bar\\", 'foo_db'), '', true); + self::assertContains("'Foo''Bar\\\\'", $this->platform->getListTableIndexesSQL("Foo'Bar\\", 'foo_db'), '', true); } /** @@ -853,7 +853,7 @@ public function testQuotesTableNameInListTableIndexesSQL() */ public function testQuotesDatabaseNameInListTableIndexesSQL() { - self::assertContains("'Foo''Bar\\\\'", $this->_platform->getListTableIndexesSQL('foo_table', "Foo'Bar\\"), '', true); + self::assertContains("'Foo''Bar\\\\'", $this->platform->getListTableIndexesSQL('foo_table', "Foo'Bar\\"), '', true); } /** @@ -861,7 +861,7 @@ public function testQuotesDatabaseNameInListTableIndexesSQL() */ public function testQuotesDatabaseNameInListViewsSQL() { - self::assertContains("'Foo''Bar\\\\'", $this->_platform->getListViewsSQL("Foo'Bar\\"), '', true); + self::assertContains("'Foo''Bar\\\\'", $this->platform->getListViewsSQL("Foo'Bar\\"), '', true); } /** @@ -869,7 +869,7 @@ public function testQuotesDatabaseNameInListViewsSQL() */ public function testQuotesTableNameInListTableForeignKeysSQL() { - self::assertContains("'Foo''Bar\\\\'", $this->_platform->getListTableForeignKeysSQL("Foo'Bar\\"), '', true); + self::assertContains("'Foo''Bar\\\\'", $this->platform->getListTableForeignKeysSQL("Foo'Bar\\"), '', true); } /** @@ -877,7 +877,7 @@ public function testQuotesTableNameInListTableForeignKeysSQL() */ public function testQuotesDatabaseNameInListTableForeignKeysSQL() { - self::assertContains("'Foo''Bar\\\\'", $this->_platform->getListTableForeignKeysSQL('foo_table', "Foo'Bar\\"), '', true); + self::assertContains("'Foo''Bar\\\\'", $this->platform->getListTableForeignKeysSQL('foo_table', "Foo'Bar\\"), '', true); } /** @@ -885,7 +885,7 @@ public function testQuotesDatabaseNameInListTableForeignKeysSQL() */ public function testQuotesTableNameInListTableColumnsSQL() { - self::assertContains("'Foo''Bar\\\\'", $this->_platform->getListTableColumnsSQL("Foo'Bar\\"), '', true); + self::assertContains("'Foo''Bar\\\\'", $this->platform->getListTableColumnsSQL("Foo'Bar\\"), '', true); } /** @@ -893,16 +893,16 @@ public function testQuotesTableNameInListTableColumnsSQL() */ public function testQuotesDatabaseNameInListTableColumnsSQL() { - self::assertContains("'Foo''Bar\\\\'", $this->_platform->getListTableColumnsSQL('foo_table', "Foo'Bar\\"), '', true); + self::assertContains("'Foo''Bar\\\\'", $this->platform->getListTableColumnsSQL('foo_table', "Foo'Bar\\"), '', true); } public function testListTableForeignKeysSQLEvaluatesDatabase() { - $sql = $this->_platform->getListTableForeignKeysSQL('foo'); + $sql = $this->platform->getListTableForeignKeysSQL('foo'); self::assertContains('DATABASE()', $sql); - $sql = $this->_platform->getListTableForeignKeysSQL('foo', 'bar'); + $sql = $this->platform->getListTableForeignKeysSQL('foo', 'bar'); self::assertContains('bar', $sql); self::assertNotContains('DATABASE()', $sql); diff --git a/tests/Doctrine/Tests/DBAL/Platforms/AbstractPlatformTestCase.php b/tests/Doctrine/Tests/DBAL/Platforms/AbstractPlatformTestCase.php index 163cbc93c32..c9b5308bc77 100644 --- a/tests/Doctrine/Tests/DBAL/Platforms/AbstractPlatformTestCase.php +++ b/tests/Doctrine/Tests/DBAL/Platforms/AbstractPlatformTestCase.php @@ -21,13 +21,13 @@ abstract class AbstractPlatformTestCase extends \Doctrine\Tests\DbalTestCase /** * @var \Doctrine\DBAL\Platforms\AbstractPlatform */ - protected $_platform; + protected $platform; abstract public function createPlatform(); protected function setUp() { - $this->_platform = $this->createPlatform(); + $this->platform = $this->createPlatform(); } /** @@ -35,14 +35,14 @@ protected function setUp() */ public function testQuoteIdentifier() { - if ($this->_platform->getName() == "mssql") { + if ($this->platform->getName() == "mssql") { $this->markTestSkipped('Not working this way on mssql.'); } - $c = $this->_platform->getIdentifierQuoteCharacter(); - self::assertEquals($c."test".$c, $this->_platform->quoteIdentifier("test")); - self::assertEquals($c."test".$c.".".$c."test".$c, $this->_platform->quoteIdentifier("test.test")); - self::assertEquals(str_repeat($c, 4), $this->_platform->quoteIdentifier($c)); + $c = $this->platform->getIdentifierQuoteCharacter(); + self::assertEquals($c."test".$c, $this->platform->quoteIdentifier("test")); + self::assertEquals($c."test".$c.".".$c."test".$c, $this->platform->quoteIdentifier("test.test")); + self::assertEquals(str_repeat($c, 4), $this->platform->quoteIdentifier($c)); } /** @@ -50,14 +50,14 @@ public function testQuoteIdentifier() */ public function testQuoteSingleIdentifier() { - if ($this->_platform->getName() == "mssql") { + if ($this->platform->getName() == "mssql") { $this->markTestSkipped('Not working this way on mssql.'); } - $c = $this->_platform->getIdentifierQuoteCharacter(); - self::assertEquals($c."test".$c, $this->_platform->quoteSingleIdentifier("test")); - self::assertEquals($c."test.test".$c, $this->_platform->quoteSingleIdentifier("test.test")); - self::assertEquals(str_repeat($c, 4), $this->_platform->quoteSingleIdentifier($c)); + $c = $this->platform->getIdentifierQuoteCharacter(); + self::assertEquals($c."test".$c, $this->platform->quoteSingleIdentifier("test")); + self::assertEquals($c."test.test".$c, $this->platform->quoteSingleIdentifier("test.test")); + self::assertEquals(str_repeat($c, 4), $this->platform->quoteSingleIdentifier($c)); } /** @@ -67,7 +67,7 @@ public function testQuoteSingleIdentifier() */ public function testReturnsForeignKeyReferentialActionSQL($action, $expectedSQL) { - self::assertSame($expectedSQL, $this->_platform->getForeignKeyReferentialActionSQL($action)); + self::assertSame($expectedSQL, $this->platform->getForeignKeyReferentialActionSQL($action)); } /** @@ -88,25 +88,25 @@ public function getReturnsForeignKeyReferentialActionSQL() public function testGetInvalidForeignKeyReferentialActionSQL() { $this->expectException('InvalidArgumentException'); - $this->_platform->getForeignKeyReferentialActionSQL('unknown'); + $this->platform->getForeignKeyReferentialActionSQL('unknown'); } public function testGetUnknownDoctrineMappingType() { $this->expectException('Doctrine\DBAL\DBALException'); - $this->_platform->getDoctrineTypeMapping('foobar'); + $this->platform->getDoctrineTypeMapping('foobar'); } public function testRegisterDoctrineMappingType() { - $this->_platform->registerDoctrineTypeMapping('foo', 'integer'); - self::assertEquals('integer', $this->_platform->getDoctrineTypeMapping('foo')); + $this->platform->registerDoctrineTypeMapping('foo', 'integer'); + self::assertEquals('integer', $this->platform->getDoctrineTypeMapping('foo')); } public function testRegisterUnknownDoctrineMappingType() { $this->expectException('Doctrine\DBAL\DBALException'); - $this->_platform->registerDoctrineTypeMapping('foo', 'bar'); + $this->platform->registerDoctrineTypeMapping('foo', 'bar'); } /** @@ -119,9 +119,9 @@ public function testRegistersCommentedDoctrineMappingTypeImplicitly() } $type = Type::getType('my_commented'); - $this->_platform->registerDoctrineTypeMapping('foo', 'my_commented'); + $this->platform->registerDoctrineTypeMapping('foo', 'my_commented'); - self::assertTrue($this->_platform->isCommentedDoctrineType($type)); + self::assertTrue($this->platform->isCommentedDoctrineType($type)); } /** @@ -131,7 +131,7 @@ public function testRegistersCommentedDoctrineMappingTypeImplicitly() */ public function testIsCommentedDoctrineType(Type $type, $commented) { - self::assertSame($commented, $this->_platform->isCommentedDoctrineType($type)); + self::assertSame($commented, $this->platform->isCommentedDoctrineType($type)); } public function getIsCommentedDoctrineType() @@ -145,7 +145,7 @@ public function getIsCommentedDoctrineType() $data[$typeName] = array( $type, - $type->requiresSQLCommentHint($this->_platform), + $type->requiresSQLCommentHint($this->platform), ); } @@ -157,7 +157,7 @@ public function testCreateWithNoColumns() $table = new Table('test'); $this->expectException('Doctrine\DBAL\DBALException'); - $sql = $this->_platform->getCreateTableSQL($table); + $sql = $this->platform->getCreateTableSQL($table); } public function testGeneratesTableCreationSql() @@ -167,7 +167,7 @@ public function testGeneratesTableCreationSql() $table->addColumn('test', 'string', array('notnull' => false, 'length' => 255)); $table->setPrimaryKey(array('id')); - $sql = $this->_platform->getCreateTableSQL($table); + $sql = $this->platform->getCreateTableSQL($table); self::assertEquals($this->getGenerateTableSql(), $sql[0]); } @@ -180,7 +180,7 @@ public function testGenerateTableWithMultiColumnUniqueIndex() $table->addColumn('bar', 'string', array('notnull' => false, 'length' => 255)); $table->addUniqueIndex(array("foo", "bar")); - $sql = $this->_platform->getCreateTableSQL($table); + $sql = $this->platform->getCreateTableSQL($table); self::assertEquals($this->getGenerateTableWithMultiColumnUniqueIndexSql(), $sql); } @@ -192,7 +192,7 @@ public function testGeneratesIndexCreationSql() self::assertEquals( $this->getGenerateIndexSql(), - $this->_platform->getCreateIndexSQL($indexDef, 'mytable') + $this->platform->getCreateIndexSQL($indexDef, 'mytable') ); } @@ -202,7 +202,7 @@ public function testGeneratesUniqueIndexCreationSql() { $indexDef = new Index('index_name', array('test', 'test2'), true); - $sql = $this->_platform->getCreateIndexSQL($indexDef, 'test'); + $sql = $this->platform->getCreateIndexSQL($indexDef, 'test'); self::assertEquals($this->getGenerateUniqueIndexSql(), $sql); } @@ -219,14 +219,14 @@ public function testGeneratesPartialIndexesSqlOnlyWhenSupportingPartialIndexes() $actuals = array(); if ($this->supportsInlineIndexDeclaration()) { - $actuals []= $this->_platform->getIndexDeclarationSQL('name', $indexDef); + $actuals []= $this->platform->getIndexDeclarationSQL('name', $indexDef); } - $uniqueConstraintSQL = $this->_platform->getUniqueConstraintDeclarationSQL('name', $uniqueConstraint); - $indexSQL = $this->_platform->getCreateIndexSQL($indexDef, 'table'); + $uniqueConstraintSQL = $this->platform->getUniqueConstraintDeclarationSQL('name', $uniqueConstraint); + $indexSQL = $this->platform->getCreateIndexSQL($indexDef, 'table'); $this->assertStringEndsNotWith($expected, $uniqueConstraintSQL, 'WHERE clause should NOT be present'); - if ($this->_platform->supportsPartialIndexes()) { + if ($this->platform->supportsPartialIndexes()) { self::assertStringEndsWith($expected, $indexSQL, 'WHERE clause should be present'); } else { self::assertStringEndsNotWith($expected, $indexSQL, 'WHERE clause should NOT be present'); @@ -238,7 +238,7 @@ public function testGeneratesForeignKeyCreationSql() { $fk = new ForeignKeyConstraint(array('fk_name_id'), 'other_table', array('id'), ''); - $sql = $this->_platform->getCreateForeignKeySQL($fk, 'test'); + $sql = $this->platform->getCreateForeignKeySQL($fk, 'test'); self::assertEquals($sql, $this->getGenerateForeignKeySql()); } @@ -247,15 +247,15 @@ abstract public function getGenerateForeignKeySql(); public function testGeneratesConstraintCreationSql() { $idx = new Index('constraint_name', array('test'), true, false); - $sql = $this->_platform->getCreateConstraintSQL($idx, 'test'); + $sql = $this->platform->getCreateConstraintSQL($idx, 'test'); self::assertEquals($this->getGenerateConstraintUniqueIndexSql(), $sql); $pk = new Index('constraint_name', array('test'), true, true); - $sql = $this->_platform->getCreateConstraintSQL($pk, 'test'); + $sql = $this->platform->getCreateConstraintSQL($pk, 'test'); self::assertEquals($this->getGenerateConstraintPrimaryIndexSql(), $sql); $fk = new ForeignKeyConstraint(array('fk_name'), 'foreign', array('id'), 'constraint_fk'); - $sql = $this->_platform->getCreateConstraintSQL($fk, 'test'); + $sql = $this->platform->getCreateConstraintSQL($fk, 'test'); self::assertEquals($this->getGenerateConstraintForeignKeySql($fk), $sql); } @@ -263,14 +263,14 @@ public function testGeneratesForeignKeySqlOnlyWhenSupportingForeignKeys() { $fk = new ForeignKeyConstraint(array('fk_name'), 'foreign', array('id'), 'constraint_fk'); - if ($this->_platform->supportsForeignKeyConstraints()) { + if ($this->platform->supportsForeignKeyConstraints()) { self::assertInternalType( 'string', - $this->_platform->getCreateForeignKeySQL($fk, 'test') + $this->platform->getCreateForeignKeySQL($fk, 'test') ); } else { $this->expectException('Doctrine\DBAL\DBALException'); - $this->_platform->getCreateForeignKeySQL($fk, 'test'); + $this->platform->getCreateForeignKeySQL($fk, 'test'); } } @@ -284,7 +284,7 @@ protected function getBitAndComparisonExpressionSql($value1, $value2) */ public function testGeneratesBitAndComparisonExpressionSql() { - $sql = $this->_platform->getBitAndComparisonExpression(2, 4); + $sql = $this->platform->getBitAndComparisonExpression(2, 4); self::assertEquals($this->getBitAndComparisonExpressionSql(2, 4), $sql); } @@ -298,7 +298,7 @@ protected function getBitOrComparisonExpressionSql($value1, $value2) */ public function testGeneratesBitOrComparisonExpressionSql() { - $sql = $this->_platform->getBitOrComparisonExpression(2, 4); + $sql = $this->platform->getBitOrComparisonExpression(2, 4); self::assertEquals($this->getBitOrComparisonExpressionSql(2, 4), $sql); } @@ -314,7 +314,7 @@ public function getGenerateConstraintPrimaryIndexSql() public function getGenerateConstraintForeignKeySql(ForeignKeyConstraint $fk) { - $quotedForeignTable = $fk->getQuotedForeignTableName($this->_platform); + $quotedForeignTable = $fk->getQuotedForeignTableName($this->platform); return "ALTER TABLE test ADD CONSTRAINT constraint_fk FOREIGN KEY (fk_name) REFERENCES $quotedForeignTable (id)"; } @@ -350,7 +350,7 @@ public function testGeneratesTableAlterationSql() array('type', 'notnull', 'default') ); - $sql = $this->_platform->getAlterTableSQL($tableDiff); + $sql = $this->platform->getAlterTableSQL($tableDiff); self::assertEquals($expectedSql, $sql); } @@ -358,7 +358,7 @@ public function testGeneratesTableAlterationSql() public function testGetCustomColumnDeclarationSql() { $field = array('columnDefinition' => 'MEDIUMINT(6) UNSIGNED'); - self::assertEquals('foo MEDIUMINT(6) UNSIGNED', $this->_platform->getColumnDeclarationSQL('foo', $field)); + self::assertEquals('foo MEDIUMINT(6) UNSIGNED', $this->platform->getColumnDeclarationSQL('foo', $field)); } public function testGetCreateTableSqlDispatchEvent() @@ -376,13 +376,13 @@ public function testGetCreateTableSqlDispatchEvent() $eventManager = new EventManager(); $eventManager->addEventListener(array(Events::onSchemaCreateTable, Events::onSchemaCreateTableColumn), $listenerMock); - $this->_platform->setEventManager($eventManager); + $this->platform->setEventManager($eventManager); $table = new Table('test'); $table->addColumn('foo', 'string', array('notnull' => false, 'length' => 255)); $table->addColumn('bar', 'string', array('notnull' => false, 'length' => 255)); - $this->_platform->getCreateTableSQL($table); + $this->platform->getCreateTableSQL($table); } public function testGetDropTableSqlDispatchEvent() @@ -397,9 +397,9 @@ public function testGetDropTableSqlDispatchEvent() $eventManager = new EventManager(); $eventManager->addEventListener(array(Events::onSchemaDropTable), $listenerMock); - $this->_platform->setEventManager($eventManager); + $this->platform->setEventManager($eventManager); - $this->_platform->getDropTableSQL('TABLE'); + $this->platform->getDropTableSQL('TABLE'); } public function testGetAlterTableSqlDispatchEvent() @@ -441,7 +441,7 @@ public function testGetAlterTableSqlDispatchEvent() ); $eventManager->addEventListener($events, $listenerMock); - $this->_platform->setEventManager($eventManager); + $this->platform->setEventManager($eventManager); $table = new Table('mytable'); $table->addColumn('removed', 'integer'); @@ -460,7 +460,7 @@ public function testGetAlterTableSqlDispatchEvent() ); $tableDiff->renamedColumns['renamed'] = new \Doctrine\DBAL\Schema\Column('renamed2', \Doctrine\DBAL\Types\Type::getType('integer'), array()); - $this->_platform->getAlterTableSQL($tableDiff); + $this->platform->getAlterTableSQL($tableDiff); } /** @@ -472,7 +472,7 @@ public function testCreateTableColumnComments() $table->addColumn('id', 'integer', array('comment' => 'This is a comment')); $table->setPrimaryKey(array('id')); - self::assertEquals($this->getCreateTableColumnCommentsSQL(), $this->_platform->getCreateTableSQL($table)); + self::assertEquals($this->getCreateTableColumnCommentsSQL(), $this->platform->getCreateTableSQL($table)); } /** @@ -495,7 +495,7 @@ public function testAlterTableColumnComments() array('comment') ); - self::assertEquals($this->getAlterTableColumnCommentsSQL(), $this->_platform->getAlterTableSQL($tableDiff)); + self::assertEquals($this->getAlterTableColumnCommentsSQL(), $this->platform->getAlterTableSQL($tableDiff)); } public function testCreateTableColumnTypeComments() @@ -505,7 +505,7 @@ public function testCreateTableColumnTypeComments() $table->addColumn('data', 'array'); $table->setPrimaryKey(array('id')); - self::assertEquals($this->getCreateTableColumnTypeCommentsSQL(), $this->_platform->getCreateTableSQL($table)); + self::assertEquals($this->getCreateTableColumnTypeCommentsSQL(), $this->platform->getCreateTableSQL($table)); } public function getCreateTableColumnCommentsSQL() @@ -531,7 +531,7 @@ public function testGetDefaultValueDeclarationSQL() 'default' => 'non_timestamp' ); - self::assertEquals(" DEFAULT 'non_timestamp'", $this->_platform->getDefaultValueDeclarationSQL($field)); + self::assertEquals(" DEFAULT 'non_timestamp'", $this->platform->getDefaultValueDeclarationSQL($field)); } /** @@ -543,12 +543,12 @@ public function testGetDefaultValueDeclarationSQLDateTime() : void foreach (['datetime', 'datetimetz', 'datetime_immutable', 'datetimetz_immutable'] as $type) { $field = [ 'type' => Type::getType($type), - 'default' => $this->_platform->getCurrentTimestampSQL(), + 'default' => $this->platform->getCurrentTimestampSQL(), ]; self::assertSame( - ' DEFAULT ' . $this->_platform->getCurrentTimestampSQL(), - $this->_platform->getDefaultValueDeclarationSQL($field) + ' DEFAULT ' . $this->platform->getCurrentTimestampSQL(), + $this->platform->getDefaultValueDeclarationSQL($field) ); } } @@ -563,7 +563,7 @@ public function testGetDefaultValueDeclarationSQLForIntegerTypes() self::assertEquals( ' DEFAULT 1', - $this->_platform->getDefaultValueDeclarationSQL($field) + $this->platform->getDefaultValueDeclarationSQL($field) ); } } @@ -573,7 +573,7 @@ public function testGetDefaultValueDeclarationSQLForIntegerTypes() */ public function testGetDefaultValueDeclarationSQLForDateType() : void { - $currentDateSql = $this->_platform->getCurrentDateSQL(); + $currentDateSql = $this->platform->getCurrentDateSQL(); foreach (['date', 'date_immutable'] as $type) { $field = [ 'type' => Type::getType($type), @@ -582,7 +582,7 @@ public function testGetDefaultValueDeclarationSQLForDateType() : void self::assertSame( ' DEFAULT ' . $currentDateSql, - $this->_platform->getDefaultValueDeclarationSQL($field) + $this->platform->getDefaultValueDeclarationSQL($field) ); } } @@ -592,7 +592,7 @@ public function testGetDefaultValueDeclarationSQLForDateType() : void */ public function testKeywordList() { - $keywordList = $this->_platform->getReservedKeywordsList(); + $keywordList = $this->platform->getReservedKeywordsList(); self::assertInstanceOf('Doctrine\DBAL\Platforms\Keywords\KeywordList', $keywordList); self::assertTrue($keywordList->isKeyword('table')); @@ -607,7 +607,7 @@ public function testQuotedColumnInPrimaryKeyPropagation() $table->addColumn('create', 'string'); $table->setPrimaryKey(array('create')); - $sql = $this->_platform->getCreateTableSQL($table); + $sql = $this->platform->getCreateTableSQL($table); self::assertEquals($this->getQuotedColumnInPrimaryKeySQL(), $sql); } @@ -625,7 +625,7 @@ public function testQuotedColumnInIndexPropagation() $table->addColumn('create', 'string'); $table->addIndex(array('create')); - $sql = $this->_platform->getCreateTableSQL($table); + $sql = $this->platform->getCreateTableSQL($table); self::assertEquals($this->getQuotedColumnInIndexSQL(), $sql); } @@ -635,7 +635,7 @@ public function testQuotedNameInIndexSQL() $table->addColumn('column1', 'string'); $table->addIndex(array('column1'), '`key`'); - $sql = $this->_platform->getCreateTableSQL($table); + $sql = $this->platform->getCreateTableSQL($table); self::assertEquals($this->getQuotedNameInIndexSQL(), $sql); } @@ -673,7 +673,7 @@ public function testQuotedColumnInForeignKeyPropagation() $table->addForeignKeyConstraint($foreignTable, array('create', 'foo', '`bar`'), array('create', 'bar', '`foo-bar`'), array(), 'FK_WITH_INTENDED_QUOTATION'); - $sql = $this->_platform->getCreateTableSQL($table, AbstractPlatform::CREATE_FOREIGNKEYS); + $sql = $this->platform->getCreateTableSQL($table, AbstractPlatform::CREATE_FOREIGNKEYS); self::assertEquals($this->getQuotedColumnInForeignKeySQL(), $sql); } @@ -686,7 +686,7 @@ public function testQuotesReservedKeywordInUniqueConstraintDeclarationSQL() self::assertSame( $this->getQuotesReservedKeywordInUniqueConstraintDeclarationSQL(), - $this->_platform->getUniqueConstraintDeclarationSQL('select', $constraint) + $this->platform->getUniqueConstraintDeclarationSQL('select', $constraint) ); } @@ -702,7 +702,7 @@ public function testQuotesReservedKeywordInTruncateTableSQL() { self::assertSame( $this->getQuotesReservedKeywordInTruncateTableSQL(), - $this->_platform->getTruncateTableSQL('select') + $this->platform->getTruncateTableSQL('select') ); } @@ -724,7 +724,7 @@ public function testQuotesReservedKeywordInIndexDeclarationSQL() self::assertSame( $this->getQuotesReservedKeywordInIndexDeclarationSQL(), - $this->_platform->getIndexDeclarationSQL('select', $index) + $this->platform->getIndexDeclarationSQL('select', $index) ); } @@ -743,7 +743,7 @@ protected function supportsInlineIndexDeclaration() public function testSupportsCommentOnStatement() { - self::assertSame($this->supportsCommentOnStatement(), $this->_platform->supportsCommentOnStatement()); + self::assertSame($this->supportsCommentOnStatement(), $this->platform->supportsCommentOnStatement()); } /** @@ -759,7 +759,7 @@ protected function supportsCommentOnStatement() */ public function testGetCreateSchemaSQL() { - $this->_platform->getCreateSchemaSQL('schema'); + $this->platform->getCreateSchemaSQL('schema'); } /** @@ -777,8 +777,8 @@ public function testAlterTableChangeQuotedColumn() ); self::assertContains( - $this->_platform->quoteIdentifier('select'), - implode(';', $this->_platform->getAlterTableSQL($tableDiff)) + $this->platform->quoteIdentifier('select'), + implode(';', $this->platform->getAlterTableSQL($tableDiff)) ); } @@ -787,7 +787,7 @@ public function testAlterTableChangeQuotedColumn() */ public function testUsesSequenceEmulatedIdentityColumns() { - self::assertFalse($this->_platform->usesSequenceEmulatedIdentityColumns()); + self::assertFalse($this->platform->usesSequenceEmulatedIdentityColumns()); } /** @@ -796,12 +796,12 @@ public function testUsesSequenceEmulatedIdentityColumns() */ public function testReturnsIdentitySequenceName() { - $this->_platform->getIdentitySequenceName('mytable', 'mycolumn'); + $this->platform->getIdentitySequenceName('mytable', 'mycolumn'); } public function testReturnsBinaryDefaultLength() { - self::assertSame($this->getBinaryDefaultLength(), $this->_platform->getBinaryDefaultLength()); + self::assertSame($this->getBinaryDefaultLength(), $this->platform->getBinaryDefaultLength()); } protected function getBinaryDefaultLength() @@ -811,7 +811,7 @@ protected function getBinaryDefaultLength() public function testReturnsBinaryMaxLength() { - self::assertSame($this->getBinaryMaxLength(), $this->_platform->getBinaryMaxLength()); + self::assertSame($this->getBinaryMaxLength(), $this->platform->getBinaryMaxLength()); } protected function getBinaryMaxLength() @@ -824,7 +824,7 @@ protected function getBinaryMaxLength() */ public function testReturnsBinaryTypeDeclarationSQL() { - $this->_platform->getBinaryTypeDeclarationSQL(array()); + $this->platform->getBinaryTypeDeclarationSQL(array()); } /** @@ -832,7 +832,7 @@ public function testReturnsBinaryTypeDeclarationSQL() */ public function hasNativeJsonType() { - self::assertFalse($this->_platform->hasNativeJsonType()); + self::assertFalse($this->platform->hasNativeJsonType()); } /** @@ -847,8 +847,8 @@ public function testReturnsJsonTypeDeclarationSQL() ); self::assertSame( - $this->_platform->getClobTypeDeclarationSQL($column), - $this->_platform->getJsonTypeDeclarationSQL($column) + $this->platform->getClobTypeDeclarationSQL($column), + $this->platform->getJsonTypeDeclarationSQL($column) ); } @@ -867,7 +867,7 @@ public function testAlterTableRenameIndex() self::assertSame( $this->getAlterTableRenameIndexSQL(), - $this->_platform->getAlterTableSQL($tableDiff) + $this->platform->getAlterTableSQL($tableDiff) ); } @@ -898,7 +898,7 @@ public function testQuotesAlterTableRenameIndex() self::assertSame( $this->getQuotedAlterTableRenameIndexSQL(), - $this->_platform->getAlterTableSQL($tableDiff) + $this->platform->getAlterTableSQL($tableDiff) ); } @@ -952,7 +952,7 @@ public function testQuotesAlterTableRenameColumn() self::assertEquals( $this->getQuotedAlterTableRenameColumnSQL(), - $this->_platform->getAlterTableSQL($comparator->diffTable($fromTable, $toTable)) + $this->platform->getAlterTableSQL($comparator->diffTable($fromTable, $toTable)) ); } @@ -994,7 +994,7 @@ public function testQuotesAlterTableChangeColumnLength() self::assertEquals( $this->getQuotedAlterTableChangeColumnLengthSQL(), - $this->_platform->getAlterTableSQL($comparator->diffTable($fromTable, $toTable)) + $this->platform->getAlterTableSQL($comparator->diffTable($fromTable, $toTable)) ); } @@ -1022,7 +1022,7 @@ public function testAlterTableRenameIndexInSchema() self::assertSame( $this->getAlterTableRenameIndexInSchemaSQL(), - $this->_platform->getAlterTableSQL($tableDiff) + $this->platform->getAlterTableSQL($tableDiff) ); } @@ -1053,7 +1053,7 @@ public function testQuotesAlterTableRenameIndexInSchema() self::assertSame( $this->getQuotedAlterTableRenameIndexInSchemaSQL(), - $this->_platform->getAlterTableSQL($tableDiff) + $this->platform->getAlterTableSQL($tableDiff) ); } @@ -1075,9 +1075,9 @@ protected function getQuotedAlterTableRenameIndexInSchemaSQL() */ public function testQuotesDropForeignKeySQL() { - if (! $this->_platform->supportsForeignKeyConstraints()) { + if (! $this->platform->supportsForeignKeyConstraints()) { $this->markTestSkipped( - sprintf('%s does not support foreign key constraints.', get_class($this->_platform)) + sprintf('%s does not support foreign key constraints.', get_class($this->platform)) ); } @@ -1087,8 +1087,8 @@ public function testQuotesDropForeignKeySQL() $foreignKey = new ForeignKeyConstraint(array(), 'foo', array(), 'select'); $expectedSql = $this->getQuotesDropForeignKeySQL(); - self::assertSame($expectedSql, $this->_platform->getDropForeignKeySQL($foreignKeyName, $tableName)); - self::assertSame($expectedSql, $this->_platform->getDropForeignKeySQL($foreignKey, $table)); + self::assertSame($expectedSql, $this->platform->getDropForeignKeySQL($foreignKeyName, $tableName)); + self::assertSame($expectedSql, $this->platform->getDropForeignKeySQL($foreignKey, $table)); } protected function getQuotesDropForeignKeySQL() @@ -1107,8 +1107,8 @@ public function testQuotesDropConstraintSQL() $constraint = new ForeignKeyConstraint(array(), 'foo', array(), 'select'); $expectedSql = $this->getQuotesDropConstraintSQL(); - self::assertSame($expectedSql, $this->_platform->getDropConstraintSQL($constraintName, $tableName)); - self::assertSame($expectedSql, $this->_platform->getDropConstraintSQL($constraint, $table)); + self::assertSame($expectedSql, $this->platform->getDropConstraintSQL($constraintName, $tableName)); + self::assertSame($expectedSql, $this->platform->getDropConstraintSQL($constraint, $table)); } protected function getQuotesDropConstraintSQL() @@ -1123,7 +1123,7 @@ protected function getStringLiteralQuoteCharacter() public function testGetStringLiteralQuoteCharacter() { - self::assertSame($this->getStringLiteralQuoteCharacter(), $this->_platform->getStringLiteralQuoteCharacter()); + self::assertSame($this->getStringLiteralQuoteCharacter(), $this->platform->getStringLiteralQuoteCharacter()); } protected function getQuotedCommentOnColumnSQLWithoutQuoteCharacter() @@ -1135,7 +1135,7 @@ public function testGetCommentOnColumnSQLWithoutQuoteCharacter() { self::assertEquals( $this->getQuotedCommentOnColumnSQLWithoutQuoteCharacter(), - $this->_platform->getCommentOnColumnSQL('mytable', 'id', 'This is a comment') + $this->platform->getCommentOnColumnSQL('mytable', 'id', 'This is a comment') ); } @@ -1150,7 +1150,7 @@ public function testGetCommentOnColumnSQLWithQuoteCharacter() self::assertEquals( $this->getQuotedCommentOnColumnSQLWithQuoteCharacter(), - $this->_platform->getCommentOnColumnSQL('mytable', 'id', "It" . $c . "s a quote !") + $this->platform->getCommentOnColumnSQL('mytable', 'id', "It" . $c . "s a quote !") ); } @@ -1169,9 +1169,9 @@ public function testGetCommentOnColumnSQL() self::assertSame( $this->getCommentOnColumnSQL(), array( - $this->_platform->getCommentOnColumnSQL('foo', 'bar', 'comment'), // regular identifiers - $this->_platform->getCommentOnColumnSQL('`Foo`', '`BAR`', 'comment'), // explicitly quoted identifiers - $this->_platform->getCommentOnColumnSQL('select', 'from', 'comment'), // reserved keyword identifiers + $this->platform->getCommentOnColumnSQL('foo', 'bar', 'comment'), // regular identifiers + $this->platform->getCommentOnColumnSQL('`Foo`', '`BAR`', 'comment'), // explicitly quoted identifiers + $this->platform->getCommentOnColumnSQL('select', 'from', 'comment'), // reserved keyword identifiers ) ); } @@ -1183,11 +1183,11 @@ public function testGetCommentOnColumnSQL() */ public function testGeneratesInlineColumnCommentSQL($comment, $expectedSql) { - if (! $this->_platform->supportsInlineColumnComments()) { - $this->markTestSkipped(sprintf('%s does not support inline column comments.', get_class($this->_platform))); + if (! $this->platform->supportsInlineColumnComments()) { + $this->markTestSkipped(sprintf('%s does not support inline column comments.', get_class($this->platform))); } - self::assertSame($expectedSql, $this->_platform->getInlineColumnCommentSQL($comment)); + self::assertSame($expectedSql, $this->platform->getInlineColumnCommentSQL($comment)); } public function getGeneratesInlineColumnCommentSQL() @@ -1245,8 +1245,8 @@ protected function getQuotedStringLiteralQuoteCharacter() */ public function testThrowsExceptionOnGeneratingInlineColumnCommentSQLIfUnsupported() { - if ($this->_platform->supportsInlineColumnComments()) { - $this->markTestSkipped(sprintf('%s supports inline column comments.', get_class($this->_platform))); + if ($this->platform->supportsInlineColumnComments()) { + $this->markTestSkipped(sprintf('%s supports inline column comments.', get_class($this->platform))); } $this->expectException( @@ -1255,7 +1255,7 @@ public function testThrowsExceptionOnGeneratingInlineColumnCommentSQLIfUnsupport 0 ); - $this->_platform->getInlineColumnCommentSQL('unsupported'); + $this->platform->getInlineColumnCommentSQL('unsupported'); } public function testQuoteStringLiteral() @@ -1264,15 +1264,15 @@ public function testQuoteStringLiteral() self::assertEquals( $this->getQuotedStringLiteralWithoutQuoteCharacter(), - $this->_platform->quoteStringLiteral('No quote') + $this->platform->quoteStringLiteral('No quote') ); self::assertEquals( $this->getQuotedStringLiteralWithQuoteCharacter(), - $this->_platform->quoteStringLiteral('It' . $c . 's a quote') + $this->platform->quoteStringLiteral('It' . $c . 's a quote') ); self::assertEquals( $this->getQuotedStringLiteralQuoteCharacter(), - $this->_platform->quoteStringLiteral($c) + $this->platform->quoteStringLiteral($c) ); } @@ -1283,7 +1283,7 @@ public function testQuoteStringLiteral() */ public function testReturnsGuidTypeDeclarationSQL() { - $this->_platform->getGuidTypeDeclarationSQL(array()); + $this->platform->getGuidTypeDeclarationSQL(array()); } /** @@ -1306,7 +1306,7 @@ public function testGeneratesAlterTableRenameColumnSQL() array('notnull' => true, 'default' => 666, 'comment' => 'rename test') ); - self::assertSame($this->getAlterTableRenameColumnSQL(), $this->_platform->getAlterTableSQL($tableDiff)); + self::assertSame($this->getAlterTableRenameColumnSQL(), $this->platform->getAlterTableSQL($tableDiff)); } /** @@ -1347,7 +1347,7 @@ public function testQuotesTableIdentifiersInAlterTableSQL() self::assertSame( $this->getQuotesTableIdentifiersInAlterTableSQL(), - $this->_platform->getAlterTableSQL($tableDiff) + $this->platform->getAlterTableSQL($tableDiff) ); } @@ -1375,7 +1375,7 @@ public function testAlterStringToFixedString() array('fixed') ); - $sql = $this->_platform->getAlterTableSQL($tableDiff); + $sql = $this->platform->getAlterTableSQL($tableDiff); $expectedSql = $this->getAlterStringToFixedStringSQL(); @@ -1411,7 +1411,7 @@ public function testGeneratesAlterTableRenameIndexUsedByForeignKeySQL() self::assertSame( $this->getGeneratesAlterTableRenameIndexUsedByForeignKeySQL(), - $this->_platform->getAlterTableSQL($tableDiff) + $this->platform->getAlterTableSQL($tableDiff) ); } @@ -1427,7 +1427,7 @@ abstract protected function getGeneratesAlterTableRenameIndexUsedByForeignKeySQL */ public function testGeneratesDecimalTypeDeclarationSQL(array $column, $expectedSql) { - self::assertSame($expectedSql, $this->_platform->getDecimalTypeDeclarationSQL($column)); + self::assertSame($expectedSql, $this->platform->getDecimalTypeDeclarationSQL($column)); } /** @@ -1452,7 +1452,7 @@ public function getGeneratesDecimalTypeDeclarationSQL() */ public function testGeneratesFloatDeclarationSQL(array $column, $expectedSql) { - self::assertSame($expectedSql, $this->_platform->getFloatDeclarationSQL($column)); + self::assertSame($expectedSql, $this->platform->getFloatDeclarationSQL($column)); } /** diff --git a/tests/Doctrine/Tests/DBAL/Platforms/AbstractPostgreSqlPlatformTestCase.php b/tests/Doctrine/Tests/DBAL/Platforms/AbstractPostgreSqlPlatformTestCase.php index c3809f438be..628f4a9ff54 100644 --- a/tests/Doctrine/Tests/DBAL/Platforms/AbstractPostgreSqlPlatformTestCase.php +++ b/tests/Doctrine/Tests/DBAL/Platforms/AbstractPostgreSqlPlatformTestCase.php @@ -55,7 +55,7 @@ public function testGeneratesForeignKeySqlForNonStandardOptions() ); self::assertEquals( "CONSTRAINT my_fk FOREIGN KEY (foreign_id) REFERENCES my_table (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE", - $this->_platform->getForeignKeyDeclarationSQL($foreignKey) + $this->platform->getForeignKeyDeclarationSQL($foreignKey) ); $foreignKey = new \Doctrine\DBAL\Schema\ForeignKeyConstraint( @@ -63,7 +63,7 @@ public function testGeneratesForeignKeySqlForNonStandardOptions() ); self::assertEquals( "CONSTRAINT my_fk FOREIGN KEY (foreign_id) REFERENCES my_table (id) MATCH full NOT DEFERRABLE INITIALLY IMMEDIATE", - $this->_platform->getForeignKeyDeclarationSQL($foreignKey) + $this->platform->getForeignKeyDeclarationSQL($foreignKey) ); $foreignKey = new \Doctrine\DBAL\Schema\ForeignKeyConstraint( @@ -71,7 +71,7 @@ public function testGeneratesForeignKeySqlForNonStandardOptions() ); self::assertEquals( "CONSTRAINT my_fk FOREIGN KEY (foreign_id) REFERENCES my_table (id) DEFERRABLE INITIALLY IMMEDIATE", - $this->_platform->getForeignKeyDeclarationSQL($foreignKey) + $this->platform->getForeignKeyDeclarationSQL($foreignKey) ); $foreignKey = new \Doctrine\DBAL\Schema\ForeignKeyConstraint( @@ -79,7 +79,7 @@ public function testGeneratesForeignKeySqlForNonStandardOptions() ); self::assertEquals( "CONSTRAINT my_fk FOREIGN KEY (foreign_id) REFERENCES my_table (id) NOT DEFERRABLE INITIALLY DEFERRED", - $this->_platform->getForeignKeyDeclarationSQL($foreignKey) + $this->platform->getForeignKeyDeclarationSQL($foreignKey) ); $foreignKey = new \Doctrine\DBAL\Schema\ForeignKeyConstraint( @@ -87,7 +87,7 @@ public function testGeneratesForeignKeySqlForNonStandardOptions() ); self::assertEquals( "CONSTRAINT my_fk FOREIGN KEY (foreign_id) REFERENCES my_table (id) NOT DEFERRABLE INITIALLY DEFERRED", - $this->_platform->getForeignKeyDeclarationSQL($foreignKey) + $this->platform->getForeignKeyDeclarationSQL($foreignKey) ); $foreignKey = new \Doctrine\DBAL\Schema\ForeignKeyConstraint( @@ -95,44 +95,44 @@ public function testGeneratesForeignKeySqlForNonStandardOptions() ); self::assertEquals( "CONSTRAINT my_fk FOREIGN KEY (foreign_id) REFERENCES my_table (id) MATCH full DEFERRABLE INITIALLY DEFERRED", - $this->_platform->getForeignKeyDeclarationSQL($foreignKey) + $this->platform->getForeignKeyDeclarationSQL($foreignKey) ); } public function testGeneratesSqlSnippets() { - self::assertEquals('SIMILAR TO', $this->_platform->getRegexpExpression(), 'Regular expression operator is not correct'); - self::assertEquals('"', $this->_platform->getIdentifierQuoteCharacter(), 'Identifier quote character is not correct'); - self::assertEquals('column1 || column2 || column3', $this->_platform->getConcatExpression('column1', 'column2', 'column3'), 'Concatenation expression is not correct'); - self::assertEquals('SUBSTRING(column FROM 5)', $this->_platform->getSubstringExpression('column', 5), 'Substring expression without length is not correct'); - self::assertEquals('SUBSTRING(column FROM 1 FOR 5)', $this->_platform->getSubstringExpression('column', 1, 5), 'Substring expression with length is not correct'); + self::assertEquals('SIMILAR TO', $this->platform->getRegexpExpression(), 'Regular expression operator is not correct'); + self::assertEquals('"', $this->platform->getIdentifierQuoteCharacter(), 'Identifier quote character is not correct'); + self::assertEquals('column1 || column2 || column3', $this->platform->getConcatExpression('column1', 'column2', 'column3'), 'Concatenation expression is not correct'); + self::assertEquals('SUBSTRING(column FROM 5)', $this->platform->getSubstringExpression('column', 5), 'Substring expression without length is not correct'); + self::assertEquals('SUBSTRING(column FROM 1 FOR 5)', $this->platform->getSubstringExpression('column', 1, 5), 'Substring expression with length is not correct'); } public function testGeneratesTransactionCommands() { self::assertEquals( 'SET SESSION CHARACTERISTICS AS TRANSACTION ISOLATION LEVEL READ UNCOMMITTED', - $this->_platform->getSetTransactionIsolationSQL(\Doctrine\DBAL\Connection::TRANSACTION_READ_UNCOMMITTED) + $this->platform->getSetTransactionIsolationSQL(\Doctrine\DBAL\Connection::TRANSACTION_READ_UNCOMMITTED) ); self::assertEquals( 'SET SESSION CHARACTERISTICS AS TRANSACTION ISOLATION LEVEL READ COMMITTED', - $this->_platform->getSetTransactionIsolationSQL(\Doctrine\DBAL\Connection::TRANSACTION_READ_COMMITTED) + $this->platform->getSetTransactionIsolationSQL(\Doctrine\DBAL\Connection::TRANSACTION_READ_COMMITTED) ); self::assertEquals( 'SET SESSION CHARACTERISTICS AS TRANSACTION ISOLATION LEVEL REPEATABLE READ', - $this->_platform->getSetTransactionIsolationSQL(\Doctrine\DBAL\Connection::TRANSACTION_REPEATABLE_READ) + $this->platform->getSetTransactionIsolationSQL(\Doctrine\DBAL\Connection::TRANSACTION_REPEATABLE_READ) ); self::assertEquals( 'SET SESSION CHARACTERISTICS AS TRANSACTION ISOLATION LEVEL SERIALIZABLE', - $this->_platform->getSetTransactionIsolationSQL(\Doctrine\DBAL\Connection::TRANSACTION_SERIALIZABLE) + $this->platform->getSetTransactionIsolationSQL(\Doctrine\DBAL\Connection::TRANSACTION_SERIALIZABLE) ); } public function testGeneratesDDLSnippets() { - self::assertEquals('CREATE DATABASE foobar', $this->_platform->getCreateDatabaseSQL('foobar')); - self::assertEquals('DROP DATABASE foobar', $this->_platform->getDropDatabaseSQL('foobar')); - self::assertEquals('DROP TABLE foobar', $this->_platform->getDropTableSQL('foobar')); + self::assertEquals('CREATE DATABASE foobar', $this->platform->getCreateDatabaseSQL('foobar')); + self::assertEquals('DROP DATABASE foobar', $this->platform->getDropDatabaseSQL('foobar')); + self::assertEquals('DROP TABLE foobar', $this->platform->getDropTableSQL('foobar')); } public function testGenerateTableWithAutoincrement() @@ -141,7 +141,7 @@ public function testGenerateTableWithAutoincrement() $column = $table->addColumn('id', 'integer'); $column->setAutoincrement(true); - self::assertEquals(array('CREATE TABLE autoinc_table (id SERIAL NOT NULL)'), $this->_platform->getCreateTableSQL($table)); + self::assertEquals(array('CREATE TABLE autoinc_table (id SERIAL NOT NULL)'), $this->platform->getCreateTableSQL($table)); } public static function serialTypes() : array @@ -163,7 +163,7 @@ public function testGenerateTableWithAutoincrementDoesNotSetDefault(string $type $column->setAutoIncrement(true); $column->setNotNull(false); - $sql = $this->_platform->getCreateTableSQL($table); + $sql = $this->platform->getCreateTableSQL($table); self::assertEquals(["CREATE TABLE autoinc_table_notnull (id $definition)"], $sql); } @@ -179,7 +179,7 @@ public function testCreateTableWithAutoincrementAndNotNullAddsConstraint(string $column->setAutoIncrement(true); $column->setNotNull(true); - $sql = $this->_platform->getCreateTableSQL($table); + $sql = $this->platform->getCreateTableSQL($table); self::assertEquals(["CREATE TABLE autoinc_table_notnull_enabled (id $definition NOT NULL)"], $sql); } @@ -190,7 +190,7 @@ public function testCreateTableWithAutoincrementAndNotNullAddsConstraint(string */ public function testGetDefaultValueDeclarationSQLIgnoresTheDefaultKeyWhenTheFieldIsSerial(string $type) : void { - $sql = $this->_platform->getDefaultValueDeclarationSQL( + $sql = $this->platform->getDefaultValueDeclarationSQL( [ 'autoincrement' => true, 'type' => Type::getType($type), @@ -205,15 +205,15 @@ public function testGeneratesTypeDeclarationForIntegers() { self::assertEquals( 'INT', - $this->_platform->getIntegerTypeDeclarationSQL(array()) + $this->platform->getIntegerTypeDeclarationSQL(array()) ); self::assertEquals( 'SERIAL', - $this->_platform->getIntegerTypeDeclarationSQL(array('autoincrement' => true) + $this->platform->getIntegerTypeDeclarationSQL(array('autoincrement' => true) )); self::assertEquals( 'SERIAL', - $this->_platform->getIntegerTypeDeclarationSQL( + $this->platform->getIntegerTypeDeclarationSQL( array('autoincrement' => true, 'primary' => true) )); } @@ -222,17 +222,17 @@ public function testGeneratesTypeDeclarationForStrings() { self::assertEquals( 'CHAR(10)', - $this->_platform->getVarcharTypeDeclarationSQL( + $this->platform->getVarcharTypeDeclarationSQL( array('length' => 10, 'fixed' => true)) ); self::assertEquals( 'VARCHAR(50)', - $this->_platform->getVarcharTypeDeclarationSQL(array('length' => 50)), + $this->platform->getVarcharTypeDeclarationSQL(array('length' => 50)), 'Variable string declaration is not correct' ); self::assertEquals( 'VARCHAR(255)', - $this->_platform->getVarcharTypeDeclarationSQL(array()), + $this->platform->getVarcharTypeDeclarationSQL(array()), 'Long string declaration is not correct' ); } @@ -247,41 +247,41 @@ public function testGeneratesSequenceSqlCommands() $sequence = new \Doctrine\DBAL\Schema\Sequence('myseq', 20, 1); self::assertEquals( 'CREATE SEQUENCE myseq INCREMENT BY 20 MINVALUE 1 START 1', - $this->_platform->getCreateSequenceSQL($sequence) + $this->platform->getCreateSequenceSQL($sequence) ); self::assertEquals( 'DROP SEQUENCE myseq CASCADE', - $this->_platform->getDropSequenceSQL('myseq') + $this->platform->getDropSequenceSQL('myseq') ); self::assertEquals( "SELECT NEXTVAL('myseq')", - $this->_platform->getSequenceNextValSQL('myseq') + $this->platform->getSequenceNextValSQL('myseq') ); } public function testDoesNotPreferIdentityColumns() { - self::assertFalse($this->_platform->prefersIdentityColumns()); + self::assertFalse($this->platform->prefersIdentityColumns()); } public function testPrefersSequences() { - self::assertTrue($this->_platform->prefersSequences()); + self::assertTrue($this->platform->prefersSequences()); } public function testSupportsIdentityColumns() { - self::assertTrue($this->_platform->supportsIdentityColumns()); + self::assertTrue($this->platform->supportsIdentityColumns()); } public function testSupportsSavePoints() { - self::assertTrue($this->_platform->supportsSavepoints()); + self::assertTrue($this->platform->supportsSavepoints()); } public function testSupportsSequences() { - self::assertTrue($this->_platform->supportsSequences()); + self::assertTrue($this->platform->supportsSequences()); } /** @@ -294,13 +294,13 @@ protected function supportsCommentOnStatement() public function testModifyLimitQuery() { - $sql = $this->_platform->modifyLimitQuery('SELECT * FROM user', 10, 0); + $sql = $this->platform->modifyLimitQuery('SELECT * FROM user', 10, 0); self::assertEquals('SELECT * FROM user LIMIT 10 OFFSET 0', $sql); } public function testModifyLimitQueryWithEmptyOffset() { - $sql = $this->_platform->modifyLimitQuery('SELECT * FROM user', 10); + $sql = $this->platform->modifyLimitQuery('SELECT * FROM user', 10); self::assertEquals('SELECT * FROM user LIMIT 10', $sql); } @@ -458,7 +458,7 @@ public function testThrowsExceptionWithInvalidBooleanLiteral() public function testGetCreateSchemaSQL() { $schemaName = 'schema'; - $sql = $this->_platform->getCreateSchemaSQL($schemaName); + $sql = $this->platform->getCreateSchemaSQL($schemaName); self::assertEquals('CREATE SCHEMA ' . $schemaName, $sql); } @@ -499,7 +499,7 @@ public function testAlterDecimalPrecisionScale() array('precision', 'scale') ); - $sql = $this->_platform->getAlterTableSQL($tableDiff); + $sql = $this->platform->getAlterTableSQL($tableDiff); $expectedSql = array( 'ALTER TABLE mytable ALTER dloo1 TYPE NUMERIC(16, 6)', @@ -526,7 +526,7 @@ public function testDroppingConstraintsBeforeColumns() $comparator = new \Doctrine\DBAL\Schema\Comparator(); $tableDiff = $comparator->diffTable($oldTable, $newTable); - $sql = $this->_platform->getAlterTableSQL($tableDiff); + $sql = $this->platform->getAlterTableSQL($tableDiff); $expectedSql = array( 'ALTER TABLE mytable DROP CONSTRAINT FK_6B2BD609727ACA70', @@ -542,7 +542,7 @@ public function testDroppingConstraintsBeforeColumns() */ public function testUsesSequenceEmulatedIdentityColumns() { - self::assertTrue($this->_platform->usesSequenceEmulatedIdentityColumns()); + self::assertTrue($this->platform->usesSequenceEmulatedIdentityColumns()); } /** @@ -550,7 +550,7 @@ public function testUsesSequenceEmulatedIdentityColumns() */ public function testReturnsIdentitySequenceName() { - self::assertSame('mytable_mycolumn_seq', $this->_platform->getIdentitySequenceName('mytable', 'mycolumn')); + self::assertSame('mytable_mycolumn_seq', $this->platform->getIdentitySequenceName('mytable', 'mycolumn')); } /** @@ -560,7 +560,7 @@ public function testReturnsIdentitySequenceName() public function testCreateSequenceWithCache($cacheSize, $expectedSql) { $sequence = new \Doctrine\DBAL\Schema\Sequence('foo', 1, 1, $cacheSize); - self::assertContains($expectedSql, $this->_platform->getCreateSequenceSQL($sequence)); + self::assertContains($expectedSql, $this->platform->getCreateSequenceSQL($sequence)); } public function dataCreateSequenceWithCache() @@ -582,13 +582,13 @@ protected function getBinaryMaxLength() public function testReturnsBinaryTypeDeclarationSQL() { - self::assertSame('BYTEA', $this->_platform->getBinaryTypeDeclarationSQL(array())); - self::assertSame('BYTEA', $this->_platform->getBinaryTypeDeclarationSQL(array('length' => 0))); - self::assertSame('BYTEA', $this->_platform->getBinaryTypeDeclarationSQL(array('length' => 9999999))); + self::assertSame('BYTEA', $this->platform->getBinaryTypeDeclarationSQL(array())); + self::assertSame('BYTEA', $this->platform->getBinaryTypeDeclarationSQL(array('length' => 0))); + self::assertSame('BYTEA', $this->platform->getBinaryTypeDeclarationSQL(array('length' => 9999999))); - self::assertSame('BYTEA', $this->_platform->getBinaryTypeDeclarationSQL(array('fixed' => true))); - self::assertSame('BYTEA', $this->_platform->getBinaryTypeDeclarationSQL(array('fixed' => true, 'length' => 0))); - self::assertSame('BYTEA', $this->_platform->getBinaryTypeDeclarationSQL(array('fixed' => true, 'length' => 9999999))); + self::assertSame('BYTEA', $this->platform->getBinaryTypeDeclarationSQL(array('fixed' => true))); + self::assertSame('BYTEA', $this->platform->getBinaryTypeDeclarationSQL(array('fixed' => true, 'length' => 0))); + self::assertSame('BYTEA', $this->platform->getBinaryTypeDeclarationSQL(array('fixed' => true, 'length' => 9999999))); } public function testDoesNotPropagateUnnecessaryTableAlterationOnBinaryType() @@ -608,7 +608,7 @@ public function testDoesNotPropagateUnnecessaryTableAlterationOnBinaryType() // VARBINARY -> BINARY // BINARY -> VARBINARY // BLOB -> VARBINARY - self::assertEmpty($this->_platform->getAlterTableSQL($comparator->diffTable($table1, $table2))); + self::assertEmpty($this->platform->getAlterTableSQL($comparator->diffTable($table1, $table2))); $table2 = new Table('mytable'); $table2->addColumn('column_varbinary', 'binary', array('length' => 42)); @@ -618,7 +618,7 @@ public function testDoesNotPropagateUnnecessaryTableAlterationOnBinaryType() // VARBINARY -> VARBINARY with changed length // BINARY -> BLOB // BLOB -> BINARY - self::assertEmpty($this->_platform->getAlterTableSQL($comparator->diffTable($table1, $table2))); + self::assertEmpty($this->platform->getAlterTableSQL($comparator->diffTable($table1, $table2))); $table2 = new Table('mytable'); $table2->addColumn('column_varbinary', 'blob'); @@ -628,7 +628,7 @@ public function testDoesNotPropagateUnnecessaryTableAlterationOnBinaryType() // VARBINARY -> BLOB // BINARY -> BINARY with changed length // BLOB -> BLOB - self::assertEmpty($this->_platform->getAlterTableSQL($comparator->diffTable($table1, $table2))); + self::assertEmpty($this->platform->getAlterTableSQL($comparator->diffTable($table1, $table2))); } /** @@ -743,7 +743,7 @@ public function testGetNullCommentOnColumnSQL() { self::assertEquals( "COMMENT ON COLUMN mytable.id IS NULL", - $this->_platform->getCommentOnColumnSQL('mytable', 'id', null) + $this->platform->getCommentOnColumnSQL('mytable', 'id', null) ); } @@ -752,7 +752,7 @@ public function testGetNullCommentOnColumnSQL() */ public function testReturnsGuidTypeDeclarationSQL() { - self::assertSame('UUID', $this->_platform->getGuidTypeDeclarationSQL(array())); + self::assertSame('UUID', $this->platform->getGuidTypeDeclarationSQL(array())); } /** @@ -814,7 +814,7 @@ public function testAltersTableColumnCommentWithExplicitlyQuotedIdentifiers() array( 'COMMENT ON COLUMN "foo"."bar" IS \'baz\'', ), - $this->_platform->getAlterTableSQL($tableDiff) + $this->platform->getAlterTableSQL($tableDiff) ); } @@ -867,8 +867,8 @@ protected function getGeneratesAlterTableRenameIndexUsedByForeignKeySQL() */ public function testInitializesTsvectorTypeMapping() { - self::assertTrue($this->_platform->hasDoctrineTypeMappingFor('tsvector')); - self::assertEquals('text', $this->_platform->getDoctrineTypeMapping('tsvector')); + self::assertTrue($this->platform->hasDoctrineTypeMappingFor('tsvector')); + self::assertEquals('text', $this->platform->getDoctrineTypeMapping('tsvector')); } /** @@ -878,7 +878,7 @@ public function testReturnsDisallowDatabaseConnectionsSQL() { self::assertSame( "UPDATE pg_database SET datallowconn = 'false' WHERE datname = 'foo'", - $this->_platform->getDisallowDatabaseConnectionsSQL('foo') + $this->platform->getDisallowDatabaseConnectionsSQL('foo') ); } @@ -889,7 +889,7 @@ public function testReturnsCloseActiveDatabaseConnectionsSQL() { self::assertSame( "SELECT pg_terminate_backend(procpid) FROM pg_stat_activity WHERE datname = 'foo'", - $this->_platform->getCloseActiveDatabaseConnectionsSQL('foo') + $this->platform->getCloseActiveDatabaseConnectionsSQL('foo') ); } @@ -898,7 +898,7 @@ public function testReturnsCloseActiveDatabaseConnectionsSQL() */ public function testQuotesTableNameInListTableForeignKeysSQL() { - self::assertContains("'Foo''Bar\\\\'", $this->_platform->getListTableForeignKeysSQL("Foo'Bar\\"), '', true); + self::assertContains("'Foo''Bar\\\\'", $this->platform->getListTableForeignKeysSQL("Foo'Bar\\"), '', true); } /** @@ -908,7 +908,7 @@ public function testQuotesSchemaNameInListTableForeignKeysSQL() { self::assertContains( "'Foo''Bar\\\\'", - $this->_platform->getListTableForeignKeysSQL("Foo'Bar\\.baz_table"), + $this->platform->getListTableForeignKeysSQL("Foo'Bar\\.baz_table"), '', true ); @@ -919,7 +919,7 @@ public function testQuotesSchemaNameInListTableForeignKeysSQL() */ public function testQuotesTableNameInListTableConstraintsSQL() { - self::assertContains("'Foo''Bar\\\\'", $this->_platform->getListTableConstraintsSQL("Foo'Bar\\"), '', true); + self::assertContains("'Foo''Bar\\\\'", $this->platform->getListTableConstraintsSQL("Foo'Bar\\"), '', true); } /** @@ -927,7 +927,7 @@ public function testQuotesTableNameInListTableConstraintsSQL() */ public function testQuotesTableNameInListTableIndexesSQL() { - self::assertContains("'Foo''Bar\\\\'", $this->_platform->getListTableIndexesSQL("Foo'Bar\\"), '', true); + self::assertContains("'Foo''Bar\\\\'", $this->platform->getListTableIndexesSQL("Foo'Bar\\"), '', true); } /** @@ -937,7 +937,7 @@ public function testQuotesSchemaNameInListTableIndexesSQL() { self::assertContains( "'Foo''Bar\\\\'", - $this->_platform->getListTableIndexesSQL("Foo'Bar\\.baz_table"), + $this->platform->getListTableIndexesSQL("Foo'Bar\\.baz_table"), '', true ); @@ -948,7 +948,7 @@ public function testQuotesSchemaNameInListTableIndexesSQL() */ public function testQuotesTableNameInListTableColumnsSQL() { - self::assertContains("'Foo''Bar\\\\'", $this->_platform->getListTableColumnsSQL("Foo'Bar\\"), '', true); + self::assertContains("'Foo''Bar\\\\'", $this->platform->getListTableColumnsSQL("Foo'Bar\\"), '', true); } /** @@ -958,7 +958,7 @@ public function testQuotesSchemaNameInListTableColumnsSQL() { self::assertContains( "'Foo''Bar\\\\'", - $this->_platform->getListTableColumnsSQL("Foo'Bar\\.baz_table"), + $this->platform->getListTableColumnsSQL("Foo'Bar\\.baz_table"), '', true ); @@ -971,7 +971,7 @@ public function testQuotesDatabaseNameInCloseActiveDatabaseConnectionsSQL() { self::assertContains( "'Foo''Bar\\\\'", - $this->_platform->getCloseActiveDatabaseConnectionsSQL("Foo'Bar\\"), + $this->platform->getCloseActiveDatabaseConnectionsSQL("Foo'Bar\\"), '', true ); diff --git a/tests/Doctrine/Tests/DBAL/Platforms/AbstractSQLServerPlatformTestCase.php b/tests/Doctrine/Tests/DBAL/Platforms/AbstractSQLServerPlatformTestCase.php index 8ded5a5514b..026052ac2a3 100644 --- a/tests/Doctrine/Tests/DBAL/Platforms/AbstractSQLServerPlatformTestCase.php +++ b/tests/Doctrine/Tests/DBAL/Platforms/AbstractSQLServerPlatformTestCase.php @@ -50,35 +50,35 @@ public function getGenerateAlterTableSql() */ public function testDoesNotSupportRegexp() { - $this->_platform->getRegexpExpression(); + $this->platform->getRegexpExpression(); } public function testGeneratesSqlSnippets() { - self::assertEquals('CONVERT(date, GETDATE())', $this->_platform->getCurrentDateSQL()); - self::assertEquals('CONVERT(time, GETDATE())', $this->_platform->getCurrentTimeSQL()); - self::assertEquals('CURRENT_TIMESTAMP', $this->_platform->getCurrentTimestampSQL()); - self::assertEquals('"', $this->_platform->getIdentifierQuoteCharacter(), 'Identifier quote character is not correct'); - self::assertEquals('(column1 + column2 + column3)', $this->_platform->getConcatExpression('column1', 'column2', 'column3'), 'Concatenation expression is not correct'); + self::assertEquals('CONVERT(date, GETDATE())', $this->platform->getCurrentDateSQL()); + self::assertEquals('CONVERT(time, GETDATE())', $this->platform->getCurrentTimeSQL()); + self::assertEquals('CURRENT_TIMESTAMP', $this->platform->getCurrentTimestampSQL()); + self::assertEquals('"', $this->platform->getIdentifierQuoteCharacter(), 'Identifier quote character is not correct'); + self::assertEquals('(column1 + column2 + column3)', $this->platform->getConcatExpression('column1', 'column2', 'column3'), 'Concatenation expression is not correct'); } public function testGeneratesTransactionsCommands() { self::assertEquals( 'SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED', - $this->_platform->getSetTransactionIsolationSQL(\Doctrine\DBAL\Connection::TRANSACTION_READ_UNCOMMITTED) + $this->platform->getSetTransactionIsolationSQL(\Doctrine\DBAL\Connection::TRANSACTION_READ_UNCOMMITTED) ); self::assertEquals( 'SET TRANSACTION ISOLATION LEVEL READ COMMITTED', - $this->_platform->getSetTransactionIsolationSQL(\Doctrine\DBAL\Connection::TRANSACTION_READ_COMMITTED) + $this->platform->getSetTransactionIsolationSQL(\Doctrine\DBAL\Connection::TRANSACTION_READ_COMMITTED) ); self::assertEquals( 'SET TRANSACTION ISOLATION LEVEL REPEATABLE READ', - $this->_platform->getSetTransactionIsolationSQL(\Doctrine\DBAL\Connection::TRANSACTION_REPEATABLE_READ) + $this->platform->getSetTransactionIsolationSQL(\Doctrine\DBAL\Connection::TRANSACTION_REPEATABLE_READ) ); self::assertEquals( 'SET TRANSACTION ISOLATION LEVEL SERIALIZABLE', - $this->_platform->getSetTransactionIsolationSQL(\Doctrine\DBAL\Connection::TRANSACTION_SERIALIZABLE) + $this->platform->getSetTransactionIsolationSQL(\Doctrine\DBAL\Connection::TRANSACTION_SERIALIZABLE) ); } @@ -86,25 +86,25 @@ public function testGeneratesDDLSnippets() { $dropDatabaseExpectation = 'DROP DATABASE foobar'; - self::assertEquals('SELECT * FROM sys.databases', $this->_platform->getListDatabasesSQL()); - self::assertEquals('CREATE DATABASE foobar', $this->_platform->getCreateDatabaseSQL('foobar')); - self::assertEquals($dropDatabaseExpectation, $this->_platform->getDropDatabaseSQL('foobar')); - self::assertEquals('DROP TABLE foobar', $this->_platform->getDropTableSQL('foobar')); + self::assertEquals('SELECT * FROM sys.databases', $this->platform->getListDatabasesSQL()); + self::assertEquals('CREATE DATABASE foobar', $this->platform->getCreateDatabaseSQL('foobar')); + self::assertEquals($dropDatabaseExpectation, $this->platform->getDropDatabaseSQL('foobar')); + self::assertEquals('DROP TABLE foobar', $this->platform->getDropTableSQL('foobar')); } public function testGeneratesTypeDeclarationForIntegers() { self::assertEquals( 'INT', - $this->_platform->getIntegerTypeDeclarationSQL(array()) + $this->platform->getIntegerTypeDeclarationSQL(array()) ); self::assertEquals( 'INT IDENTITY', - $this->_platform->getIntegerTypeDeclarationSQL(array('autoincrement' => true) + $this->platform->getIntegerTypeDeclarationSQL(array('autoincrement' => true) )); self::assertEquals( 'INT IDENTITY', - $this->_platform->getIntegerTypeDeclarationSQL( + $this->platform->getIntegerTypeDeclarationSQL( array('autoincrement' => true, 'primary' => true) )); } @@ -113,49 +113,49 @@ public function testGeneratesTypeDeclarationsForStrings() { self::assertEquals( 'NCHAR(10)', - $this->_platform->getVarcharTypeDeclarationSQL( + $this->platform->getVarcharTypeDeclarationSQL( array('length' => 10, 'fixed' => true) )); self::assertEquals( 'NVARCHAR(50)', - $this->_platform->getVarcharTypeDeclarationSQL(array('length' => 50)), + $this->platform->getVarcharTypeDeclarationSQL(array('length' => 50)), 'Variable string declaration is not correct' ); self::assertEquals( 'NVARCHAR(255)', - $this->_platform->getVarcharTypeDeclarationSQL(array()), + $this->platform->getVarcharTypeDeclarationSQL(array()), 'Long string declaration is not correct' ); - self::assertSame('VARCHAR(MAX)', $this->_platform->getClobTypeDeclarationSQL(array())); + self::assertSame('VARCHAR(MAX)', $this->platform->getClobTypeDeclarationSQL(array())); self::assertSame( 'VARCHAR(MAX)', - $this->_platform->getClobTypeDeclarationSQL(array('length' => 5, 'fixed' => true)) + $this->platform->getClobTypeDeclarationSQL(array('length' => 5, 'fixed' => true)) ); } public function testPrefersIdentityColumns() { - self::assertTrue($this->_platform->prefersIdentityColumns()); + self::assertTrue($this->platform->prefersIdentityColumns()); } public function testSupportsIdentityColumns() { - self::assertTrue($this->_platform->supportsIdentityColumns()); + self::assertTrue($this->platform->supportsIdentityColumns()); } public function testSupportsCreateDropDatabase() { - self::assertTrue($this->_platform->supportsCreateDropDatabase()); + self::assertTrue($this->platform->supportsCreateDropDatabase()); } public function testSupportsSchemas() { - self::assertTrue($this->_platform->supportsSchemas()); + self::assertTrue($this->platform->supportsSchemas()); } public function testDoesNotSupportSavePoints() { - self::assertTrue($this->_platform->supportsSavepoints()); + self::assertTrue($this->platform->supportsSavepoints()); } public function getGenerateIndexSql() @@ -177,7 +177,7 @@ public function testModifyLimitQuery() { $querySql = 'SELECT * FROM user'; $alteredSql = 'SELECT TOP 10 * FROM user'; - $sql = $this->_platform->modifyLimitQuery($querySql, 10, 0); + $sql = $this->platform->modifyLimitQuery($querySql, 10, 0); self::assertEquals(sprintf(self::$selectFromCtePattern, $alteredSql, 1, 10), $sql); } @@ -185,19 +185,19 @@ public function testModifyLimitQueryWithEmptyOffset() { $querySql = 'SELECT * FROM user'; $alteredSql = 'SELECT TOP 10 * FROM user'; - $sql = $this->_platform->modifyLimitQuery($querySql, 10); + $sql = $this->platform->modifyLimitQuery($querySql, 10); self::assertEquals(sprintf(self::$selectFromCtePattern, $alteredSql, 1, 10), $sql); } public function testModifyLimitQueryWithOffset() { - if ( ! $this->_platform->supportsLimitOffset()) { - $this->markTestSkipped(sprintf('Platform "%s" does not support offsets in result limiting.', $this->_platform->getName())); + if ( ! $this->platform->supportsLimitOffset()) { + $this->markTestSkipped(sprintf('Platform "%s" does not support offsets in result limiting.', $this->platform->getName())); } $querySql = 'SELECT * FROM user ORDER BY username DESC'; $alteredSql = 'SELECT TOP 15 * FROM user ORDER BY username DESC'; - $sql = $this->_platform->modifyLimitQuery($querySql, 10, 5); + $sql = $this->platform->modifyLimitQuery($querySql, 10, 5); self::assertEquals(sprintf(self::$selectFromCtePattern, $alteredSql, 6, 15), $sql); } @@ -206,7 +206,7 @@ public function testModifyLimitQueryWithAscOrderBy() { $querySql = 'SELECT * FROM user ORDER BY username ASC'; $alteredSql = 'SELECT TOP 10 * FROM user ORDER BY username ASC'; - $sql = $this->_platform->modifyLimitQuery($querySql, 10); + $sql = $this->platform->modifyLimitQuery($querySql, 10); self::assertEquals(sprintf(self::$selectFromCtePattern, $alteredSql, 1, 10), $sql); } @@ -215,7 +215,7 @@ public function testModifyLimitQueryWithLowercaseOrderBy() { $querySql = 'SELECT * FROM user order by username'; $alteredSql = 'SELECT TOP 10 * FROM user order by username'; - $sql = $this->_platform->modifyLimitQuery($querySql, 10); + $sql = $this->platform->modifyLimitQuery($querySql, 10); self::assertEquals(sprintf(self::$selectFromCtePattern, $alteredSql, 1, 10), $sql); } @@ -223,7 +223,7 @@ public function testModifyLimitQueryWithDescOrderBy() { $querySql = 'SELECT * FROM user ORDER BY username DESC'; $alteredSql = 'SELECT TOP 10 * FROM user ORDER BY username DESC'; - $sql = $this->_platform->modifyLimitQuery($querySql, 10); + $sql = $this->platform->modifyLimitQuery($querySql, 10); self::assertEquals(sprintf(self::$selectFromCtePattern, $alteredSql, 1, 10), $sql); } @@ -231,7 +231,7 @@ public function testModifyLimitQueryWithMultipleOrderBy() { $querySql = 'SELECT * FROM user ORDER BY username DESC, usereamil ASC'; $alteredSql = 'SELECT TOP 10 * FROM user ORDER BY username DESC, usereamil ASC'; - $sql = $this->_platform->modifyLimitQuery($querySql, 10); + $sql = $this->platform->modifyLimitQuery($querySql, 10); self::assertEquals(sprintf(self::$selectFromCtePattern, $alteredSql, 1, 10), $sql); } @@ -239,7 +239,7 @@ public function testModifyLimitQueryWithSubSelect() { $querySql = 'SELECT * FROM (SELECT u.id as uid, u.name as uname) dctrn_result'; $alteredSql = 'SELECT TOP 10 * FROM (SELECT u.id as uid, u.name as uname) dctrn_result'; - $sql = $this->_platform->modifyLimitQuery($querySql, 10); + $sql = $this->platform->modifyLimitQuery($querySql, 10); self::assertEquals(sprintf(self::$selectFromCtePattern, $alteredSql, 1, 10), $sql); } @@ -247,34 +247,34 @@ public function testModifyLimitQueryWithSubSelectAndOrder() { $querySql = 'SELECT * FROM (SELECT u.id as uid, u.name as uname ORDER BY u.name DESC) dctrn_result'; $alteredSql = 'SELECT TOP 10 * FROM (SELECT u.id as uid, u.name as uname) dctrn_result'; - $sql = $this->_platform->modifyLimitQuery($querySql, 10); + $sql = $this->platform->modifyLimitQuery($querySql, 10); self::assertEquals(sprintf(self::$selectFromCtePattern, $alteredSql, 1, 10), $sql); $querySql = 'SELECT * FROM (SELECT u.id, u.name ORDER BY u.name DESC) dctrn_result'; $alteredSql = 'SELECT TOP 10 * FROM (SELECT u.id, u.name) dctrn_result'; - $sql = $this->_platform->modifyLimitQuery($querySql, 10); + $sql = $this->platform->modifyLimitQuery($querySql, 10); self::assertEquals(sprintf(self::$selectFromCtePattern, $alteredSql, 1, 10), $sql); } public function testModifyLimitQueryWithSubSelectAndMultipleOrder() { - if ( ! $this->_platform->supportsLimitOffset()) { - $this->markTestSkipped(sprintf('Platform "%s" does not support offsets in result limiting.', $this->_platform->getName())); + if ( ! $this->platform->supportsLimitOffset()) { + $this->markTestSkipped(sprintf('Platform "%s" does not support offsets in result limiting.', $this->platform->getName())); } $querySql = 'SELECT * FROM (SELECT u.id as uid, u.name as uname ORDER BY u.name DESC, id ASC) dctrn_result'; $alteredSql = 'SELECT TOP 15 * FROM (SELECT u.id as uid, u.name as uname) dctrn_result'; - $sql = $this->_platform->modifyLimitQuery($querySql, 10, 5); + $sql = $this->platform->modifyLimitQuery($querySql, 10, 5); self::assertEquals(sprintf(self::$selectFromCtePattern, $alteredSql, 6, 15), $sql); $querySql = 'SELECT * FROM (SELECT u.id uid, u.name uname ORDER BY u.name DESC, id ASC) dctrn_result'; $alteredSql = 'SELECT TOP 15 * FROM (SELECT u.id uid, u.name uname) dctrn_result'; - $sql = $this->_platform->modifyLimitQuery($querySql, 10, 5); + $sql = $this->platform->modifyLimitQuery($querySql, 10, 5); self::assertEquals(sprintf(self::$selectFromCtePattern, $alteredSql, 6, 15), $sql); $querySql = 'SELECT * FROM (SELECT u.id, u.name ORDER BY u.name DESC, id ASC) dctrn_result'; $alteredSql = 'SELECT TOP 15 * FROM (SELECT u.id, u.name) dctrn_result'; - $sql = $this->_platform->modifyLimitQuery($querySql, 10, 5); + $sql = $this->platform->modifyLimitQuery($querySql, 10, 5); self::assertEquals(sprintf(self::$selectFromCtePattern, $alteredSql, 6, 15), $sql); } @@ -282,7 +282,7 @@ public function testModifyLimitQueryWithFromColumnNames() { $querySql = 'SELECT a.fromFoo, fromBar FROM foo'; $alteredSql = 'SELECT TOP 10 a.fromFoo, fromBar FROM foo'; - $sql = $this->_platform->modifyLimitQuery($querySql, 10); + $sql = $this->platform->modifyLimitQuery($querySql, 10); self::assertEquals(sprintf(self::$selectFromCtePattern, $alteredSql, 1, 10), $sql); } @@ -301,7 +301,7 @@ public function testModifyLimitQueryWithExtraLongQuery() $alteredSql.= 'AND (table2.column2 = table7.column7) AND (table2.column2 = table8.column8) AND (table3.column3 = table4.column4) AND (table3.column3 = table5.column5) AND (table3.column3 = table6.column6) AND (table3.column3 = table7.column7) AND (table3.column3 = table8.column8) AND (table4.column4 = table5.column5) AND (table4.column4 = table6.column6) AND (table4.column4 = table7.column7) AND (table4.column4 = table8.column8) '; $alteredSql.= 'AND (table5.column5 = table6.column6) AND (table5.column5 = table7.column7) AND (table5.column5 = table8.column8) AND (table6.column6 = table7.column7) AND (table6.column6 = table8.column8) AND (table7.column7 = table8.column8)'; - $sql = $this->_platform->modifyLimitQuery($query, 10); + $sql = $this->platform->modifyLimitQuery($query, 10); self::assertEquals(sprintf(self::$selectFromCtePattern, $alteredSql, 1, 10), $sql); } @@ -310,13 +310,13 @@ public function testModifyLimitQueryWithExtraLongQuery() */ public function testModifyLimitQueryWithOrderByClause() { - if ( ! $this->_platform->supportsLimitOffset()) { - $this->markTestSkipped(sprintf('Platform "%s" does not support offsets in result limiting.', $this->_platform->getName())); + if ( ! $this->platform->supportsLimitOffset()) { + $this->markTestSkipped(sprintf('Platform "%s" does not support offsets in result limiting.', $this->platform->getName())); } $sql = 'SELECT m0_.NOMBRE AS NOMBRE0, m0_.FECHAINICIO AS FECHAINICIO1, m0_.FECHAFIN AS FECHAFIN2 FROM MEDICION m0_ WITH (NOLOCK) INNER JOIN ESTUDIO e1_ ON m0_.ESTUDIO_ID = e1_.ID INNER JOIN CLIENTE c2_ ON e1_.CLIENTE_ID = c2_.ID INNER JOIN USUARIO u3_ ON c2_.ID = u3_.CLIENTE_ID WHERE u3_.ID = ? ORDER BY m0_.FECHAINICIO DESC'; $alteredSql = 'SELECT TOP 15 m0_.NOMBRE AS NOMBRE0, m0_.FECHAINICIO AS FECHAINICIO1, m0_.FECHAFIN AS FECHAFIN2 FROM MEDICION m0_ WITH (NOLOCK) INNER JOIN ESTUDIO e1_ ON m0_.ESTUDIO_ID = e1_.ID INNER JOIN CLIENTE c2_ ON e1_.CLIENTE_ID = c2_.ID INNER JOIN USUARIO u3_ ON c2_.ID = u3_.CLIENTE_ID WHERE u3_.ID = ? ORDER BY m0_.FECHAINICIO DESC'; - $actual = $this->_platform->modifyLimitQuery($sql, 10, 5); + $actual = $this->platform->modifyLimitQuery($sql, 10, 5); self::assertEquals(sprintf(self::$selectFromCtePattern, $alteredSql, 6, 15), $actual); } @@ -340,7 +340,7 @@ public function testModifyLimitQueryWithSubSelectInSelectList() "(SELECT (SELECT COUNT(*) FROM login l WHERE l.profile_id = p.id) FROM profile p WHERE p.user_id = u.id) login_count " . "FROM user u " . "WHERE u.status = 'disabled'"; - $sql = $this->_platform->modifyLimitQuery($querySql, 10); + $sql = $this->platform->modifyLimitQuery($querySql, 10); self::assertEquals(sprintf(self::$selectFromCtePattern, $alteredSql, 1, 10), $sql); } @@ -350,8 +350,8 @@ public function testModifyLimitQueryWithSubSelectInSelectList() */ public function testModifyLimitQueryWithSubSelectInSelectListAndOrderByClause() { - if ( ! $this->_platform->supportsLimitOffset()) { - $this->markTestSkipped(sprintf('Platform "%s" does not support offsets in result limiting.', $this->_platform->getName())); + if ( ! $this->platform->supportsLimitOffset()) { + $this->markTestSkipped(sprintf('Platform "%s" does not support offsets in result limiting.', $this->platform->getName())); } $querySql = "SELECT " . @@ -370,7 +370,7 @@ public function testModifyLimitQueryWithSubSelectInSelectListAndOrderByClause() "FROM user u " . "WHERE u.status = 'disabled' " . "ORDER BY u.username DESC"; - $sql = $this->_platform->modifyLimitQuery($querySql, 10, 5); + $sql = $this->platform->modifyLimitQuery($querySql, 10, 5); self::assertEquals(sprintf(self::$selectFromCtePattern, $alteredSql, 6, 15), $sql); } @@ -391,7 +391,7 @@ public function testModifyLimitQueryWithAggregateFunctionInOrderByClause() "FROM operator_model_operator " . "GROUP BY code " . "ORDER BY MAX(heading_id) DESC"; - $sql = $this->_platform->modifyLimitQuery($querySql, 1, 0); + $sql = $this->platform->modifyLimitQuery($querySql, 1, 0); self::assertEquals(sprintf(self::$selectFromCtePattern, $alteredSql, 1, 1), $sql); } @@ -415,7 +415,7 @@ public function testModifyLimitSubqueryWithJoinAndSubqueryOrderedByColumnFromBas . "LEFT JOIN join_table t2 ON t1.id = t2.table_id" . ") dctrn_result " . "ORDER BY id_0 ASC"; - $sql = $this->_platform->modifyLimitQuery($querySql, 5); + $sql = $this->platform->modifyLimitQuery($querySql, 5); self::assertEquals(sprintf(self::$selectFromCtePattern, $alteredSql, 1, 5), $sql); } @@ -440,7 +440,7 @@ public function testModifyLimitSubqueryWithJoinAndSubqueryOrderedByColumnFromJoi . "LEFT JOIN join_table t2 ON t1.id = t2.table_id" . ") dctrn_result " . "ORDER BY name_1 ASC"; - $sql = $this->_platform->modifyLimitQuery($querySql, 5); + $sql = $this->platform->modifyLimitQuery($querySql, 5); self::assertEquals(sprintf(self::$selectFromCtePattern, $alteredSql, 1, 5), $sql); } @@ -464,7 +464,7 @@ public function testModifyLimitSubqueryWithJoinAndSubqueryOrderedByColumnsFromBo . "LEFT JOIN join_table t2 ON t1.id = t2.table_id" . ") dctrn_result " . "ORDER BY name_1 ASC, foo_2 DESC"; - $sql = $this->_platform->modifyLimitQuery($querySql, 5); + $sql = $this->platform->modifyLimitQuery($querySql, 5); self::assertEquals(sprintf(self::$selectFromCtePattern, $alteredSql, 1, 5), $sql); } @@ -475,7 +475,7 @@ public function testModifyLimitSubquerySimple() . "FROM key_table k0_ WHERE (k0_.where_field IN (1))) dctrn_result"; $alteredSql = "SELECT DISTINCT TOP 20 id_0 FROM (SELECT k0_.id AS id_0, k0_.field AS field_1 " . "FROM key_table k0_ WHERE (k0_.where_field IN (1))) dctrn_result"; - $sql = $this->_platform->modifyLimitQuery($querySql, 20); + $sql = $this->platform->modifyLimitQuery($querySql, 20); self::assertEquals(sprintf(self::$selectFromCtePattern, $alteredSql, 1, 20), $sql); } @@ -484,9 +484,9 @@ public function testModifyLimitSubquerySimple() */ public function testQuoteIdentifier() { - self::assertEquals('[fo][o]', $this->_platform->quoteIdentifier('fo]o')); - self::assertEquals('[test]', $this->_platform->quoteIdentifier('test')); - self::assertEquals('[test].[test]', $this->_platform->quoteIdentifier('test.test')); + self::assertEquals('[fo][o]', $this->platform->quoteIdentifier('fo]o')); + self::assertEquals('[test]', $this->platform->quoteIdentifier('test')); + self::assertEquals('[test].[test]', $this->platform->quoteIdentifier('test.test')); } /** @@ -494,9 +494,9 @@ public function testQuoteIdentifier() */ public function testQuoteSingleIdentifier() { - self::assertEquals('[fo][o]', $this->_platform->quoteSingleIdentifier('fo]o')); - self::assertEquals('[test]', $this->_platform->quoteSingleIdentifier('test')); - self::assertEquals('[test.test]', $this->_platform->quoteSingleIdentifier('test.test')); + self::assertEquals('[fo][o]', $this->platform->quoteSingleIdentifier('fo]o')); + self::assertEquals('[test]', $this->platform->quoteSingleIdentifier('test')); + self::assertEquals('[test.test]', $this->platform->quoteSingleIdentifier('test.test')); } /** @@ -506,7 +506,7 @@ public function testCreateClusteredIndex() { $idx = new \Doctrine\DBAL\Schema\Index('idx', array('id')); $idx->addFlag('clustered'); - self::assertEquals('CREATE CLUSTERED INDEX idx ON tbl (id)', $this->_platform->getCreateIndexSQL($idx, 'tbl')); + self::assertEquals('CREATE CLUSTERED INDEX idx ON tbl (id)', $this->platform->getCreateIndexSQL($idx, 'tbl')); } /** @@ -519,7 +519,7 @@ public function testCreateNonClusteredPrimaryKeyInTable() $table->setPrimaryKey(Array("id")); $table->getIndex('primary')->addFlag('nonclustered'); - self::assertEquals(array('CREATE TABLE tbl (id INT NOT NULL, PRIMARY KEY NONCLUSTERED (id))'), $this->_platform->getCreateTableSQL($table)); + self::assertEquals(array('CREATE TABLE tbl (id INT NOT NULL, PRIMARY KEY NONCLUSTERED (id))'), $this->platform->getCreateTableSQL($table)); } /** @@ -529,13 +529,13 @@ public function testCreateNonClusteredPrimaryKey() { $idx = new \Doctrine\DBAL\Schema\Index('idx', array('id'), false, true); $idx->addFlag('nonclustered'); - self::assertEquals('ALTER TABLE tbl ADD PRIMARY KEY NONCLUSTERED (id)', $this->_platform->getCreatePrimaryKeySQL($idx, 'tbl')); + self::assertEquals('ALTER TABLE tbl ADD PRIMARY KEY NONCLUSTERED (id)', $this->platform->getCreatePrimaryKeySQL($idx, 'tbl')); } public function testAlterAddPrimaryKey() { $idx = new \Doctrine\DBAL\Schema\Index('idx', array('id'), false, true); - self::assertEquals('ALTER TABLE tbl ADD PRIMARY KEY (id)', $this->_platform->getCreateIndexSQL($idx, 'tbl')); + self::assertEquals('ALTER TABLE tbl ADD PRIMARY KEY (id)', $this->platform->getCreateIndexSQL($idx, 'tbl')); } protected function getQuotedColumnInPrimaryKeySQL() @@ -574,7 +574,7 @@ protected function getQuotedColumnInForeignKeySQL() public function testGetCreateSchemaSQL() { $schemaName = 'schema'; - $sql = $this->_platform->getCreateSchemaSQL($schemaName); + $sql = $this->platform->getCreateSchemaSQL($schemaName); self::assertEquals('CREATE SCHEMA ' . $schemaName, $sql); } @@ -647,7 +647,7 @@ public function testGeneratesCreateTableSQLWithColumnComments() "EXEC sp_addextendedproperty N'MS_Description', N'Doctrine array type.(DC2Type:array)', N'SCHEMA', dbo, N'TABLE', mytable, N'COLUMN', commented_type_with_comment", "EXEC sp_addextendedproperty N'MS_Description', N'O''Reilly', N'SCHEMA', dbo, N'TABLE', mytable, N'COLUMN', comment_with_string_literal_char", ), - $this->_platform->getCreateTableSQL($table) + $this->platform->getCreateTableSQL($table) ); } @@ -830,7 +830,7 @@ public function testGeneratesAlterTableSQLWithColumnComments() "EXEC sp_updateextendedproperty N'MS_Description', N'(DC2Type:array)', N'SCHEMA', dbo, N'TABLE', mytable, N'COLUMN', commented_type_with_comment", "EXEC sp_updateextendedproperty N'MS_Description', N'''', N'SCHEMA', dbo, N'TABLE', mytable, N'COLUMN', comment_with_string_literal_char", ), - $this->_platform->getAlterTableSQL($tableDiff) + $this->platform->getAlterTableSQL($tableDiff) ); } @@ -839,80 +839,80 @@ public function testGeneratesAlterTableSQLWithColumnComments() */ public function testInitializesDoctrineTypeMappings() { - self::assertTrue($this->_platform->hasDoctrineTypeMappingFor('bigint')); - self::assertSame('bigint', $this->_platform->getDoctrineTypeMapping('bigint')); + self::assertTrue($this->platform->hasDoctrineTypeMappingFor('bigint')); + self::assertSame('bigint', $this->platform->getDoctrineTypeMapping('bigint')); - self::assertTrue($this->_platform->hasDoctrineTypeMappingFor('numeric')); - self::assertSame('decimal', $this->_platform->getDoctrineTypeMapping('numeric')); + self::assertTrue($this->platform->hasDoctrineTypeMappingFor('numeric')); + self::assertSame('decimal', $this->platform->getDoctrineTypeMapping('numeric')); - self::assertTrue($this->_platform->hasDoctrineTypeMappingFor('bit')); - self::assertSame('boolean', $this->_platform->getDoctrineTypeMapping('bit')); + self::assertTrue($this->platform->hasDoctrineTypeMappingFor('bit')); + self::assertSame('boolean', $this->platform->getDoctrineTypeMapping('bit')); - self::assertTrue($this->_platform->hasDoctrineTypeMappingFor('smallint')); - self::assertSame('smallint', $this->_platform->getDoctrineTypeMapping('smallint')); + self::assertTrue($this->platform->hasDoctrineTypeMappingFor('smallint')); + self::assertSame('smallint', $this->platform->getDoctrineTypeMapping('smallint')); - self::assertTrue($this->_platform->hasDoctrineTypeMappingFor('decimal')); - self::assertSame('decimal', $this->_platform->getDoctrineTypeMapping('decimal')); + self::assertTrue($this->platform->hasDoctrineTypeMappingFor('decimal')); + self::assertSame('decimal', $this->platform->getDoctrineTypeMapping('decimal')); - self::assertTrue($this->_platform->hasDoctrineTypeMappingFor('smallmoney')); - self::assertSame('integer', $this->_platform->getDoctrineTypeMapping('smallmoney')); + self::assertTrue($this->platform->hasDoctrineTypeMappingFor('smallmoney')); + self::assertSame('integer', $this->platform->getDoctrineTypeMapping('smallmoney')); - self::assertTrue($this->_platform->hasDoctrineTypeMappingFor('int')); - self::assertSame('integer', $this->_platform->getDoctrineTypeMapping('int')); + self::assertTrue($this->platform->hasDoctrineTypeMappingFor('int')); + self::assertSame('integer', $this->platform->getDoctrineTypeMapping('int')); - self::assertTrue($this->_platform->hasDoctrineTypeMappingFor('tinyint')); - self::assertSame('smallint', $this->_platform->getDoctrineTypeMapping('tinyint')); + self::assertTrue($this->platform->hasDoctrineTypeMappingFor('tinyint')); + self::assertSame('smallint', $this->platform->getDoctrineTypeMapping('tinyint')); - self::assertTrue($this->_platform->hasDoctrineTypeMappingFor('money')); - self::assertSame('integer', $this->_platform->getDoctrineTypeMapping('money')); + self::assertTrue($this->platform->hasDoctrineTypeMappingFor('money')); + self::assertSame('integer', $this->platform->getDoctrineTypeMapping('money')); - self::assertTrue($this->_platform->hasDoctrineTypeMappingFor('float')); - self::assertSame('float', $this->_platform->getDoctrineTypeMapping('float')); + self::assertTrue($this->platform->hasDoctrineTypeMappingFor('float')); + self::assertSame('float', $this->platform->getDoctrineTypeMapping('float')); - self::assertTrue($this->_platform->hasDoctrineTypeMappingFor('real')); - self::assertSame('float', $this->_platform->getDoctrineTypeMapping('real')); + self::assertTrue($this->platform->hasDoctrineTypeMappingFor('real')); + self::assertSame('float', $this->platform->getDoctrineTypeMapping('real')); - self::assertTrue($this->_platform->hasDoctrineTypeMappingFor('double')); - self::assertSame('float', $this->_platform->getDoctrineTypeMapping('double')); + self::assertTrue($this->platform->hasDoctrineTypeMappingFor('double')); + self::assertSame('float', $this->platform->getDoctrineTypeMapping('double')); - self::assertTrue($this->_platform->hasDoctrineTypeMappingFor('double precision')); - self::assertSame('float', $this->_platform->getDoctrineTypeMapping('double precision')); + self::assertTrue($this->platform->hasDoctrineTypeMappingFor('double precision')); + self::assertSame('float', $this->platform->getDoctrineTypeMapping('double precision')); - self::assertTrue($this->_platform->hasDoctrineTypeMappingFor('smalldatetime')); - self::assertSame('datetime', $this->_platform->getDoctrineTypeMapping('smalldatetime')); + self::assertTrue($this->platform->hasDoctrineTypeMappingFor('smalldatetime')); + self::assertSame('datetime', $this->platform->getDoctrineTypeMapping('smalldatetime')); - self::assertTrue($this->_platform->hasDoctrineTypeMappingFor('datetime')); - self::assertSame('datetime', $this->_platform->getDoctrineTypeMapping('datetime')); + self::assertTrue($this->platform->hasDoctrineTypeMappingFor('datetime')); + self::assertSame('datetime', $this->platform->getDoctrineTypeMapping('datetime')); - self::assertTrue($this->_platform->hasDoctrineTypeMappingFor('char')); - self::assertSame('string', $this->_platform->getDoctrineTypeMapping('char')); + self::assertTrue($this->platform->hasDoctrineTypeMappingFor('char')); + self::assertSame('string', $this->platform->getDoctrineTypeMapping('char')); - self::assertTrue($this->_platform->hasDoctrineTypeMappingFor('varchar')); - self::assertSame('string', $this->_platform->getDoctrineTypeMapping('varchar')); + self::assertTrue($this->platform->hasDoctrineTypeMappingFor('varchar')); + self::assertSame('string', $this->platform->getDoctrineTypeMapping('varchar')); - self::assertTrue($this->_platform->hasDoctrineTypeMappingFor('text')); - self::assertSame('text', $this->_platform->getDoctrineTypeMapping('text')); + self::assertTrue($this->platform->hasDoctrineTypeMappingFor('text')); + self::assertSame('text', $this->platform->getDoctrineTypeMapping('text')); - self::assertTrue($this->_platform->hasDoctrineTypeMappingFor('nchar')); - self::assertSame('string', $this->_platform->getDoctrineTypeMapping('nchar')); + self::assertTrue($this->platform->hasDoctrineTypeMappingFor('nchar')); + self::assertSame('string', $this->platform->getDoctrineTypeMapping('nchar')); - self::assertTrue($this->_platform->hasDoctrineTypeMappingFor('nvarchar')); - self::assertSame('string', $this->_platform->getDoctrineTypeMapping('nvarchar')); + self::assertTrue($this->platform->hasDoctrineTypeMappingFor('nvarchar')); + self::assertSame('string', $this->platform->getDoctrineTypeMapping('nvarchar')); - self::assertTrue($this->_platform->hasDoctrineTypeMappingFor('ntext')); - self::assertSame('text', $this->_platform->getDoctrineTypeMapping('ntext')); + self::assertTrue($this->platform->hasDoctrineTypeMappingFor('ntext')); + self::assertSame('text', $this->platform->getDoctrineTypeMapping('ntext')); - self::assertTrue($this->_platform->hasDoctrineTypeMappingFor('binary')); - self::assertSame('binary', $this->_platform->getDoctrineTypeMapping('binary')); + self::assertTrue($this->platform->hasDoctrineTypeMappingFor('binary')); + self::assertSame('binary', $this->platform->getDoctrineTypeMapping('binary')); - self::assertTrue($this->_platform->hasDoctrineTypeMappingFor('varbinary')); - self::assertSame('binary', $this->_platform->getDoctrineTypeMapping('varbinary')); + self::assertTrue($this->platform->hasDoctrineTypeMappingFor('varbinary')); + self::assertSame('binary', $this->platform->getDoctrineTypeMapping('varbinary')); - self::assertTrue($this->_platform->hasDoctrineTypeMappingFor('image')); - self::assertSame('blob', $this->_platform->getDoctrineTypeMapping('image')); + self::assertTrue($this->platform->hasDoctrineTypeMappingFor('image')); + self::assertSame('blob', $this->platform->getDoctrineTypeMapping('image')); - self::assertTrue($this->_platform->hasDoctrineTypeMappingFor('uniqueidentifier')); - self::assertSame('guid', $this->_platform->getDoctrineTypeMapping('uniqueidentifier')); + self::assertTrue($this->platform->hasDoctrineTypeMappingFor('uniqueidentifier')); + self::assertSame('guid', $this->platform->getDoctrineTypeMapping('uniqueidentifier')); } protected function getBinaryMaxLength() @@ -922,15 +922,15 @@ protected function getBinaryMaxLength() public function testReturnsBinaryTypeDeclarationSQL() { - self::assertSame('VARBINARY(255)', $this->_platform->getBinaryTypeDeclarationSQL(array())); - self::assertSame('VARBINARY(255)', $this->_platform->getBinaryTypeDeclarationSQL(array('length' => 0))); - self::assertSame('VARBINARY(8000)', $this->_platform->getBinaryTypeDeclarationSQL(array('length' => 8000))); - self::assertSame('VARBINARY(MAX)', $this->_platform->getBinaryTypeDeclarationSQL(array('length' => 8001))); + self::assertSame('VARBINARY(255)', $this->platform->getBinaryTypeDeclarationSQL(array())); + self::assertSame('VARBINARY(255)', $this->platform->getBinaryTypeDeclarationSQL(array('length' => 0))); + self::assertSame('VARBINARY(8000)', $this->platform->getBinaryTypeDeclarationSQL(array('length' => 8000))); + self::assertSame('VARBINARY(MAX)', $this->platform->getBinaryTypeDeclarationSQL(array('length' => 8001))); - self::assertSame('BINARY(255)', $this->_platform->getBinaryTypeDeclarationSQL(array('fixed' => true))); - self::assertSame('BINARY(255)', $this->_platform->getBinaryTypeDeclarationSQL(array('fixed' => true, 'length' => 0))); - self::assertSame('BINARY(8000)', $this->_platform->getBinaryTypeDeclarationSQL(array('fixed' => true, 'length' => 8000))); - self::assertSame('VARBINARY(MAX)', $this->_platform->getBinaryTypeDeclarationSQL(array('fixed' => true, 'length' => 8001))); + self::assertSame('BINARY(255)', $this->platform->getBinaryTypeDeclarationSQL(array('fixed' => true))); + self::assertSame('BINARY(255)', $this->platform->getBinaryTypeDeclarationSQL(array('fixed' => true, 'length' => 0))); + self::assertSame('BINARY(8000)', $this->platform->getBinaryTypeDeclarationSQL(array('fixed' => true, 'length' => 8000))); + self::assertSame('VARBINARY(MAX)', $this->platform->getBinaryTypeDeclarationSQL(array('fixed' => true, 'length' => 8001))); } /** @@ -981,7 +981,7 @@ public function testChangeColumnsTypeWithDefaultValue() new Column('col_string', Type::getType('string'), array('default' => 666)) ); - $expected = $this->_platform->getAlterTableSQL($tableDiff); + $expected = $this->platform->getAlterTableSQL($tableDiff); self::assertSame( $expected, @@ -1059,7 +1059,7 @@ protected function getQuotesDropConstraintSQL() */ public function testGeneratesIdentifierNamesInDefaultConstraintDeclarationSQL($table, $column, $expectedSql) { - self::assertSame($expectedSql, $this->_platform->getDefaultConstraintDeclarationSQL($table, $column)); + self::assertSame($expectedSql, $this->platform->getDefaultConstraintDeclarationSQL($table, $column)); } public function getGeneratesIdentifierNamesInDefaultConstraintDeclarationSQL() @@ -1082,7 +1082,7 @@ public function getGeneratesIdentifierNamesInDefaultConstraintDeclarationSQL() */ public function testGeneratesIdentifierNamesInCreateTableSQL($table, $expectedSql) { - self::assertSame($expectedSql, $this->_platform->getCreateTableSQL($table)); + self::assertSame($expectedSql, $this->platform->getCreateTableSQL($table)); } public function getGeneratesIdentifierNamesInCreateTableSQL() @@ -1129,7 +1129,7 @@ public function getGeneratesIdentifierNamesInCreateTableSQL() */ public function testGeneratesIdentifierNamesInAlterTableSQL($tableDiff, $expectedSql) { - self::assertSame($expectedSql, $this->_platform->getAlterTableSQL($tableDiff)); + self::assertSame($expectedSql, $this->platform->getAlterTableSQL($tableDiff)); } public function getGeneratesIdentifierNamesInAlterTableSQL() @@ -1239,7 +1239,7 @@ public function getGeneratesIdentifierNamesInAlterTableSQL() */ public function testReturnsGuidTypeDeclarationSQL() { - self::assertSame('UNIQUEIDENTIFIER', $this->_platform->getGuidTypeDeclarationSQL(array())); + self::assertSame('UNIQUEIDENTIFIER', $this->platform->getGuidTypeDeclarationSQL(array())); } /** @@ -1351,12 +1351,12 @@ public function testModifyLimitQueryWithTopNSubQueryWithOrderBy() { $querySql = 'SELECT * FROM test t WHERE t.id = (SELECT TOP 1 t2.id FROM test t2 ORDER BY t2.data DESC)'; $alteredSql = 'SELECT TOP 10 * FROM test t WHERE t.id = (SELECT TOP 1 t2.id FROM test t2 ORDER BY t2.data DESC)'; - $sql = $this->_platform->modifyLimitQuery($querySql, 10); + $sql = $this->platform->modifyLimitQuery($querySql, 10); self::assertEquals(sprintf(static::$selectFromCtePattern, $alteredSql, 1, 10), $sql); $querySql = 'SELECT * FROM test t WHERE t.id = (SELECT TOP 1 t2.id FROM test t2 ORDER BY t2.data DESC) ORDER BY t.data2 DESC'; $alteredSql = 'SELECT TOP 10 * FROM test t WHERE t.id = (SELECT TOP 1 t2.id FROM test t2 ORDER BY t2.data DESC) ORDER BY t.data2 DESC'; - $sql = $this->_platform->modifyLimitQuery($querySql, 10); + $sql = $this->platform->modifyLimitQuery($querySql, 10); self::assertEquals(sprintf(static::$selectFromCtePattern, $alteredSql, 1, 10), $sql); } @@ -1365,7 +1365,7 @@ public function testModifyLimitQueryWithTopNSubQueryWithOrderBy() */ public function testQuotesTableNameInListTableColumnsSQL() { - self::assertContains("'Foo''Bar\\'", $this->_platform->getListTableColumnsSQL("Foo'Bar\\"), '', true); + self::assertContains("'Foo''Bar\\'", $this->platform->getListTableColumnsSQL("Foo'Bar\\"), '', true); } /** @@ -1375,7 +1375,7 @@ public function testQuotesSchemaNameInListTableColumnsSQL() { self::assertContains( "'Foo''Bar\\'", - $this->_platform->getListTableColumnsSQL("Foo'Bar\\.baz_table"), + $this->platform->getListTableColumnsSQL("Foo'Bar\\.baz_table"), '', true ); @@ -1386,7 +1386,7 @@ public function testQuotesSchemaNameInListTableColumnsSQL() */ public function testQuotesTableNameInListTableForeignKeysSQL() { - self::assertContains("'Foo''Bar\\'", $this->_platform->getListTableForeignKeysSQL("Foo'Bar\\"), '', true); + self::assertContains("'Foo''Bar\\'", $this->platform->getListTableForeignKeysSQL("Foo'Bar\\"), '', true); } /** @@ -1396,7 +1396,7 @@ public function testQuotesSchemaNameInListTableForeignKeysSQL() { self::assertContains( "'Foo''Bar\\'", - $this->_platform->getListTableForeignKeysSQL("Foo'Bar\\.baz_table"), + $this->platform->getListTableForeignKeysSQL("Foo'Bar\\.baz_table"), '', true ); @@ -1407,7 +1407,7 @@ public function testQuotesSchemaNameInListTableForeignKeysSQL() */ public function testQuotesTableNameInListTableIndexesSQL() { - self::assertContains("'Foo''Bar\\'", $this->_platform->getListTableIndexesSQL("Foo'Bar\\"), '', true); + self::assertContains("'Foo''Bar\\'", $this->platform->getListTableIndexesSQL("Foo'Bar\\"), '', true); } /** @@ -1417,7 +1417,7 @@ public function testQuotesSchemaNameInListTableIndexesSQL() { self::assertContains( "'Foo''Bar\\'", - $this->_platform->getListTableIndexesSQL("Foo'Bar\\.baz_table"), + $this->platform->getListTableIndexesSQL("Foo'Bar\\.baz_table"), '', true ); @@ -1428,7 +1428,7 @@ public function testQuotesSchemaNameInListTableIndexesSQL() */ public function testGetDefaultValueDeclarationSQLForDateType() : void { - $currentDateSql = $this->_platform->getCurrentDateSQL(); + $currentDateSql = $this->platform->getCurrentDateSQL(); foreach (['date', 'date_immutable'] as $type) { $field = [ 'type' => Type::getType($type), @@ -1437,7 +1437,7 @@ public function testGetDefaultValueDeclarationSQLForDateType() : void self::assertSame( " DEFAULT '" . $currentDateSql . "'", - $this->_platform->getDefaultValueDeclarationSQL($field) + $this->platform->getDefaultValueDeclarationSQL($field) ); } } diff --git a/tests/Doctrine/Tests/DBAL/Platforms/DB2PlatformTest.php b/tests/Doctrine/Tests/DBAL/Platforms/DB2PlatformTest.php index fc7795bda7b..a8a53f4894f 100644 --- a/tests/Doctrine/Tests/DBAL/Platforms/DB2PlatformTest.php +++ b/tests/Doctrine/Tests/DBAL/Platforms/DB2PlatformTest.php @@ -16,7 +16,7 @@ class DB2PlatformTest extends AbstractPlatformTestCase /** * @var \Doctrine\DBAL\Platforms\DB2Platform */ - protected $_platform; + protected $platform; public function createPlatform() { @@ -141,7 +141,7 @@ public function getCreateTableColumnTypeCommentsSQL() public function testHasCorrectPlatformName() { - self::assertEquals('db2', $this->_platform->getName()); + self::assertEquals('db2', $this->platform->getName()); } public function testGeneratesCreateTableSQLWithCommonIndexes() @@ -159,7 +159,7 @@ public function testGeneratesCreateTableSQLWithCommonIndexes() 'CREATE INDEX IDX_D87F7E0C5E237E06 ON test (name)', 'CREATE INDEX composite_idx ON test (id, name)' ), - $this->_platform->getCreateTableSQL($table) + $this->platform->getCreateTableSQL($table) ); } @@ -185,7 +185,7 @@ public function testGeneratesCreateTableSQLWithForeignKeyConstraints() 'ALTER TABLE test ADD CONSTRAINT FK_D87F7E0C177612A38E7F4319 FOREIGN KEY (fk_1, fk_2) REFERENCES foreign_table (pk_1, pk_2)', 'ALTER TABLE test ADD CONSTRAINT named_fk FOREIGN KEY (fk_1, fk_2) REFERENCES foreign_table2 (pk_1, pk_2)', ), - $this->_platform->getCreateTableSQL($table, AbstractPlatform::CREATE_FOREIGNKEYS) + $this->platform->getCreateTableSQL($table, AbstractPlatform::CREATE_FOREIGNKEYS) ); } @@ -201,7 +201,7 @@ public function testGeneratesCreateTableSQLWithCheckConstraints() array( 'CREATE TABLE test (id INTEGER NOT NULL, check_max INTEGER NOT NULL, check_min INTEGER NOT NULL, PRIMARY KEY(id), CHECK (check_max <= 10), CHECK (check_min >= 10))' ), - $this->_platform->getCreateTableSQL($table) + $this->platform->getCreateTableSQL($table) ); } @@ -214,77 +214,77 @@ public function testGeneratesColumnTypesDeclarationSQL() 'autoincrement' => true ); - self::assertEquals('VARCHAR(255)', $this->_platform->getVarcharTypeDeclarationSQL(array())); - self::assertEquals('VARCHAR(10)', $this->_platform->getVarcharTypeDeclarationSQL(array('length' => 10))); - self::assertEquals('CHAR(255)', $this->_platform->getVarcharTypeDeclarationSQL(array('fixed' => true))); - self::assertEquals('CHAR(10)', $this->_platform->getVarcharTypeDeclarationSQL($fullColumnDef)); + self::assertEquals('VARCHAR(255)', $this->platform->getVarcharTypeDeclarationSQL(array())); + self::assertEquals('VARCHAR(10)', $this->platform->getVarcharTypeDeclarationSQL(array('length' => 10))); + self::assertEquals('CHAR(255)', $this->platform->getVarcharTypeDeclarationSQL(array('fixed' => true))); + self::assertEquals('CHAR(10)', $this->platform->getVarcharTypeDeclarationSQL($fullColumnDef)); - self::assertEquals('SMALLINT', $this->_platform->getSmallIntTypeDeclarationSQL(array())); - self::assertEquals('SMALLINT', $this->_platform->getSmallIntTypeDeclarationSQL(array( + self::assertEquals('SMALLINT', $this->platform->getSmallIntTypeDeclarationSQL(array())); + self::assertEquals('SMALLINT', $this->platform->getSmallIntTypeDeclarationSQL(array( 'unsigned' => true ))); - self::assertEquals('SMALLINT GENERATED BY DEFAULT AS IDENTITY', $this->_platform->getSmallIntTypeDeclarationSQL($fullColumnDef)); - self::assertEquals('INTEGER', $this->_platform->getIntegerTypeDeclarationSQL(array())); - self::assertEquals('INTEGER', $this->_platform->getIntegerTypeDeclarationSQL(array( + self::assertEquals('SMALLINT GENERATED BY DEFAULT AS IDENTITY', $this->platform->getSmallIntTypeDeclarationSQL($fullColumnDef)); + self::assertEquals('INTEGER', $this->platform->getIntegerTypeDeclarationSQL(array())); + self::assertEquals('INTEGER', $this->platform->getIntegerTypeDeclarationSQL(array( 'unsigned' => true ))); - self::assertEquals('INTEGER GENERATED BY DEFAULT AS IDENTITY', $this->_platform->getIntegerTypeDeclarationSQL($fullColumnDef)); - self::assertEquals('BIGINT', $this->_platform->getBigIntTypeDeclarationSQL(array())); - self::assertEquals('BIGINT', $this->_platform->getBigIntTypeDeclarationSQL(array( + self::assertEquals('INTEGER GENERATED BY DEFAULT AS IDENTITY', $this->platform->getIntegerTypeDeclarationSQL($fullColumnDef)); + self::assertEquals('BIGINT', $this->platform->getBigIntTypeDeclarationSQL(array())); + self::assertEquals('BIGINT', $this->platform->getBigIntTypeDeclarationSQL(array( 'unsigned' => true ))); - self::assertEquals('BIGINT GENERATED BY DEFAULT AS IDENTITY', $this->_platform->getBigIntTypeDeclarationSQL($fullColumnDef)); - self::assertEquals('BLOB(1M)', $this->_platform->getBlobTypeDeclarationSQL($fullColumnDef)); - self::assertEquals('SMALLINT', $this->_platform->getBooleanTypeDeclarationSQL($fullColumnDef)); - self::assertEquals('CLOB(1M)', $this->_platform->getClobTypeDeclarationSQL($fullColumnDef)); - self::assertEquals('DATE', $this->_platform->getDateTypeDeclarationSQL($fullColumnDef)); - self::assertEquals('TIMESTAMP(0) WITH DEFAULT', $this->_platform->getDateTimeTypeDeclarationSQL(array('version' => true))); - self::assertEquals('TIMESTAMP(0)', $this->_platform->getDateTimeTypeDeclarationSQL($fullColumnDef)); - self::assertEquals('TIME', $this->_platform->getTimeTypeDeclarationSQL($fullColumnDef)); + self::assertEquals('BIGINT GENERATED BY DEFAULT AS IDENTITY', $this->platform->getBigIntTypeDeclarationSQL($fullColumnDef)); + self::assertEquals('BLOB(1M)', $this->platform->getBlobTypeDeclarationSQL($fullColumnDef)); + self::assertEquals('SMALLINT', $this->platform->getBooleanTypeDeclarationSQL($fullColumnDef)); + self::assertEquals('CLOB(1M)', $this->platform->getClobTypeDeclarationSQL($fullColumnDef)); + self::assertEquals('DATE', $this->platform->getDateTypeDeclarationSQL($fullColumnDef)); + self::assertEquals('TIMESTAMP(0) WITH DEFAULT', $this->platform->getDateTimeTypeDeclarationSQL(array('version' => true))); + self::assertEquals('TIMESTAMP(0)', $this->platform->getDateTimeTypeDeclarationSQL($fullColumnDef)); + self::assertEquals('TIME', $this->platform->getTimeTypeDeclarationSQL($fullColumnDef)); } public function testInitializesDoctrineTypeMappings() { - $this->_platform->initializeDoctrineTypeMappings(); + $this->platform->initializeDoctrineTypeMappings(); - self::assertTrue($this->_platform->hasDoctrineTypeMappingFor('smallint')); - self::assertSame('smallint', $this->_platform->getDoctrineTypeMapping('smallint')); + self::assertTrue($this->platform->hasDoctrineTypeMappingFor('smallint')); + self::assertSame('smallint', $this->platform->getDoctrineTypeMapping('smallint')); - self::assertTrue($this->_platform->hasDoctrineTypeMappingFor('bigint')); - self::assertSame('bigint', $this->_platform->getDoctrineTypeMapping('bigint')); + self::assertTrue($this->platform->hasDoctrineTypeMappingFor('bigint')); + self::assertSame('bigint', $this->platform->getDoctrineTypeMapping('bigint')); - self::assertTrue($this->_platform->hasDoctrineTypeMappingFor('integer')); - self::assertSame('integer', $this->_platform->getDoctrineTypeMapping('integer')); + self::assertTrue($this->platform->hasDoctrineTypeMappingFor('integer')); + self::assertSame('integer', $this->platform->getDoctrineTypeMapping('integer')); - self::assertTrue($this->_platform->hasDoctrineTypeMappingFor('time')); - self::assertSame('time', $this->_platform->getDoctrineTypeMapping('time')); + self::assertTrue($this->platform->hasDoctrineTypeMappingFor('time')); + self::assertSame('time', $this->platform->getDoctrineTypeMapping('time')); - self::assertTrue($this->_platform->hasDoctrineTypeMappingFor('date')); - self::assertSame('date', $this->_platform->getDoctrineTypeMapping('date')); + self::assertTrue($this->platform->hasDoctrineTypeMappingFor('date')); + self::assertSame('date', $this->platform->getDoctrineTypeMapping('date')); - self::assertTrue($this->_platform->hasDoctrineTypeMappingFor('varchar')); - self::assertSame('string', $this->_platform->getDoctrineTypeMapping('varchar')); + self::assertTrue($this->platform->hasDoctrineTypeMappingFor('varchar')); + self::assertSame('string', $this->platform->getDoctrineTypeMapping('varchar')); - self::assertTrue($this->_platform->hasDoctrineTypeMappingFor('character')); - self::assertSame('string', $this->_platform->getDoctrineTypeMapping('character')); + self::assertTrue($this->platform->hasDoctrineTypeMappingFor('character')); + self::assertSame('string', $this->platform->getDoctrineTypeMapping('character')); - self::assertTrue($this->_platform->hasDoctrineTypeMappingFor('clob')); - self::assertSame('text', $this->_platform->getDoctrineTypeMapping('clob')); + self::assertTrue($this->platform->hasDoctrineTypeMappingFor('clob')); + self::assertSame('text', $this->platform->getDoctrineTypeMapping('clob')); - self::assertTrue($this->_platform->hasDoctrineTypeMappingFor('blob')); - self::assertSame('blob', $this->_platform->getDoctrineTypeMapping('blob')); + self::assertTrue($this->platform->hasDoctrineTypeMappingFor('blob')); + self::assertSame('blob', $this->platform->getDoctrineTypeMapping('blob')); - self::assertTrue($this->_platform->hasDoctrineTypeMappingFor('decimal')); - self::assertSame('decimal', $this->_platform->getDoctrineTypeMapping('decimal')); + self::assertTrue($this->platform->hasDoctrineTypeMappingFor('decimal')); + self::assertSame('decimal', $this->platform->getDoctrineTypeMapping('decimal')); - self::assertTrue($this->_platform->hasDoctrineTypeMappingFor('double')); - self::assertSame('float', $this->_platform->getDoctrineTypeMapping('double')); + self::assertTrue($this->platform->hasDoctrineTypeMappingFor('double')); + self::assertSame('float', $this->platform->getDoctrineTypeMapping('double')); - self::assertTrue($this->_platform->hasDoctrineTypeMappingFor('real')); - self::assertSame('float', $this->_platform->getDoctrineTypeMapping('real')); + self::assertTrue($this->platform->hasDoctrineTypeMappingFor('real')); + self::assertSame('float', $this->platform->getDoctrineTypeMapping('real')); - self::assertTrue($this->_platform->hasDoctrineTypeMappingFor('timestamp')); - self::assertSame('datetime', $this->_platform->getDoctrineTypeMapping('timestamp')); + self::assertTrue($this->platform->hasDoctrineTypeMappingFor('timestamp')); + self::assertSame('datetime', $this->platform->getDoctrineTypeMapping('timestamp')); } public function getIsCommentedDoctrineType() @@ -298,22 +298,22 @@ public function getIsCommentedDoctrineType() public function testGeneratesDDLSnippets() { - self::assertEquals("CREATE DATABASE foobar", $this->_platform->getCreateDatabaseSQL('foobar')); - self::assertEquals("DROP DATABASE foobar", $this->_platform->getDropDatabaseSQL('foobar')); - self::assertEquals('DECLARE GLOBAL TEMPORARY TABLE', $this->_platform->getCreateTemporaryTableSnippetSQL()); - self::assertEquals('TRUNCATE foobar IMMEDIATE', $this->_platform->getTruncateTableSQL('foobar')); - self::assertEquals('TRUNCATE foobar IMMEDIATE', $this->_platform->getTruncateTableSQL('foobar'), true); + self::assertEquals("CREATE DATABASE foobar", $this->platform->getCreateDatabaseSQL('foobar')); + self::assertEquals("DROP DATABASE foobar", $this->platform->getDropDatabaseSQL('foobar')); + self::assertEquals('DECLARE GLOBAL TEMPORARY TABLE', $this->platform->getCreateTemporaryTableSnippetSQL()); + self::assertEquals('TRUNCATE foobar IMMEDIATE', $this->platform->getTruncateTableSQL('foobar')); + self::assertEquals('TRUNCATE foobar IMMEDIATE', $this->platform->getTruncateTableSQL('foobar'), true); $viewSql = 'SELECT * FROM footable'; - self::assertEquals('CREATE VIEW fooview AS ' . $viewSql, $this->_platform->getCreateViewSQL('fooview', $viewSql)); - self::assertEquals('DROP VIEW fooview', $this->_platform->getDropViewSQL('fooview')); + self::assertEquals('CREATE VIEW fooview AS ' . $viewSql, $this->platform->getCreateViewSQL('fooview', $viewSql)); + self::assertEquals('DROP VIEW fooview', $this->platform->getDropViewSQL('fooview')); } public function testGeneratesCreateUnnamedPrimaryKeySQL() { self::assertEquals( 'ALTER TABLE foo ADD PRIMARY KEY (a, b)', - $this->_platform->getCreatePrimaryKeySQL( + $this->platform->getCreatePrimaryKeySQL( new Index('any_pk_name', array('a', 'b'), true, true), 'foo' ) @@ -322,89 +322,89 @@ public function testGeneratesCreateUnnamedPrimaryKeySQL() public function testGeneratesSQLSnippets() { - self::assertEquals('CURRENT DATE', $this->_platform->getCurrentDateSQL()); - self::assertEquals('CURRENT TIME', $this->_platform->getCurrentTimeSQL()); - self::assertEquals('CURRENT TIMESTAMP', $this->_platform->getCurrentTimestampSQL()); - self::assertEquals("'1987/05/02' + 4 DAY", $this->_platform->getDateAddDaysExpression("'1987/05/02'", 4)); - self::assertEquals("'1987/05/02' + 12 HOUR", $this->_platform->getDateAddHourExpression("'1987/05/02'", 12)); - self::assertEquals("'1987/05/02' + 2 MINUTE", $this->_platform->getDateAddMinutesExpression("'1987/05/02'", 2)); - self::assertEquals("'1987/05/02' + 102 MONTH", $this->_platform->getDateAddMonthExpression("'1987/05/02'", 102)); - self::assertEquals("'1987/05/02' + 15 MONTH", $this->_platform->getDateAddQuartersExpression("'1987/05/02'", 5)); - self::assertEquals("'1987/05/02' + 1 SECOND", $this->_platform->getDateAddSecondsExpression("'1987/05/02'", 1)); - self::assertEquals("'1987/05/02' + 21 DAY", $this->_platform->getDateAddWeeksExpression("'1987/05/02'", 3)); - self::assertEquals("'1987/05/02' + 10 YEAR", $this->_platform->getDateAddYearsExpression("'1987/05/02'", 10)); - self::assertEquals("DAYS('1987/05/02') - DAYS('1987/04/01')", $this->_platform->getDateDiffExpression("'1987/05/02'", "'1987/04/01'")); - self::assertEquals("'1987/05/02' - 4 DAY", $this->_platform->getDateSubDaysExpression("'1987/05/02'", 4)); - self::assertEquals("'1987/05/02' - 12 HOUR", $this->_platform->getDateSubHourExpression("'1987/05/02'", 12)); - self::assertEquals("'1987/05/02' - 2 MINUTE", $this->_platform->getDateSubMinutesExpression("'1987/05/02'", 2)); - self::assertEquals("'1987/05/02' - 102 MONTH", $this->_platform->getDateSubMonthExpression("'1987/05/02'", 102)); - self::assertEquals("'1987/05/02' - 15 MONTH", $this->_platform->getDateSubQuartersExpression("'1987/05/02'", 5)); - self::assertEquals("'1987/05/02' - 1 SECOND", $this->_platform->getDateSubSecondsExpression("'1987/05/02'", 1)); - self::assertEquals("'1987/05/02' - 21 DAY", $this->_platform->getDateSubWeeksExpression("'1987/05/02'", 3)); - self::assertEquals("'1987/05/02' - 10 YEAR", $this->_platform->getDateSubYearsExpression("'1987/05/02'", 10)); - self::assertEquals(' WITH RR USE AND KEEP UPDATE LOCKS', $this->_platform->getForUpdateSQL()); - self::assertEquals('LOCATE(substring_column, string_column)', $this->_platform->getLocateExpression('string_column', 'substring_column')); - self::assertEquals('LOCATE(substring_column, string_column)', $this->_platform->getLocateExpression('string_column', 'substring_column')); - self::assertEquals('LOCATE(substring_column, string_column, 1)', $this->_platform->getLocateExpression('string_column', 'substring_column', 1)); - self::assertEquals('SUBSTR(column, 5)', $this->_platform->getSubstringExpression('column', 5)); - self::assertEquals('SUBSTR(column, 5, 2)', $this->_platform->getSubstringExpression('column', 5, 2)); + self::assertEquals('CURRENT DATE', $this->platform->getCurrentDateSQL()); + self::assertEquals('CURRENT TIME', $this->platform->getCurrentTimeSQL()); + self::assertEquals('CURRENT TIMESTAMP', $this->platform->getCurrentTimestampSQL()); + self::assertEquals("'1987/05/02' + 4 DAY", $this->platform->getDateAddDaysExpression("'1987/05/02'", 4)); + self::assertEquals("'1987/05/02' + 12 HOUR", $this->platform->getDateAddHourExpression("'1987/05/02'", 12)); + self::assertEquals("'1987/05/02' + 2 MINUTE", $this->platform->getDateAddMinutesExpression("'1987/05/02'", 2)); + self::assertEquals("'1987/05/02' + 102 MONTH", $this->platform->getDateAddMonthExpression("'1987/05/02'", 102)); + self::assertEquals("'1987/05/02' + 15 MONTH", $this->platform->getDateAddQuartersExpression("'1987/05/02'", 5)); + self::assertEquals("'1987/05/02' + 1 SECOND", $this->platform->getDateAddSecondsExpression("'1987/05/02'", 1)); + self::assertEquals("'1987/05/02' + 21 DAY", $this->platform->getDateAddWeeksExpression("'1987/05/02'", 3)); + self::assertEquals("'1987/05/02' + 10 YEAR", $this->platform->getDateAddYearsExpression("'1987/05/02'", 10)); + self::assertEquals("DAYS('1987/05/02') - DAYS('1987/04/01')", $this->platform->getDateDiffExpression("'1987/05/02'", "'1987/04/01'")); + self::assertEquals("'1987/05/02' - 4 DAY", $this->platform->getDateSubDaysExpression("'1987/05/02'", 4)); + self::assertEquals("'1987/05/02' - 12 HOUR", $this->platform->getDateSubHourExpression("'1987/05/02'", 12)); + self::assertEquals("'1987/05/02' - 2 MINUTE", $this->platform->getDateSubMinutesExpression("'1987/05/02'", 2)); + self::assertEquals("'1987/05/02' - 102 MONTH", $this->platform->getDateSubMonthExpression("'1987/05/02'", 102)); + self::assertEquals("'1987/05/02' - 15 MONTH", $this->platform->getDateSubQuartersExpression("'1987/05/02'", 5)); + self::assertEquals("'1987/05/02' - 1 SECOND", $this->platform->getDateSubSecondsExpression("'1987/05/02'", 1)); + self::assertEquals("'1987/05/02' - 21 DAY", $this->platform->getDateSubWeeksExpression("'1987/05/02'", 3)); + self::assertEquals("'1987/05/02' - 10 YEAR", $this->platform->getDateSubYearsExpression("'1987/05/02'", 10)); + self::assertEquals(' WITH RR USE AND KEEP UPDATE LOCKS', $this->platform->getForUpdateSQL()); + self::assertEquals('LOCATE(substring_column, string_column)', $this->platform->getLocateExpression('string_column', 'substring_column')); + self::assertEquals('LOCATE(substring_column, string_column)', $this->platform->getLocateExpression('string_column', 'substring_column')); + self::assertEquals('LOCATE(substring_column, string_column, 1)', $this->platform->getLocateExpression('string_column', 'substring_column', 1)); + self::assertEquals('SUBSTR(column, 5)', $this->platform->getSubstringExpression('column', 5)); + self::assertEquals('SUBSTR(column, 5, 2)', $this->platform->getSubstringExpression('column', 5, 2)); } public function testModifiesLimitQuery() { self::assertEquals( 'SELECT * FROM user', - $this->_platform->modifyLimitQuery('SELECT * FROM user', null, null) + $this->platform->modifyLimitQuery('SELECT * FROM user', null, null) ); self::assertEquals( 'SELECT db22.* FROM (SELECT db21.*, ROW_NUMBER() OVER() AS DC_ROWNUM FROM (SELECT * FROM user) db21) db22 WHERE db22.DC_ROWNUM <= 10', - $this->_platform->modifyLimitQuery('SELECT * FROM user', 10, 0) + $this->platform->modifyLimitQuery('SELECT * FROM user', 10, 0) ); self::assertEquals( 'SELECT db22.* FROM (SELECT db21.*, ROW_NUMBER() OVER() AS DC_ROWNUM FROM (SELECT * FROM user) db21) db22 WHERE db22.DC_ROWNUM <= 10', - $this->_platform->modifyLimitQuery('SELECT * FROM user', 10) + $this->platform->modifyLimitQuery('SELECT * FROM user', 10) ); self::assertEquals( 'SELECT db22.* FROM (SELECT db21.*, ROW_NUMBER() OVER() AS DC_ROWNUM FROM (SELECT * FROM user) db21) db22 WHERE db22.DC_ROWNUM >= 6 AND db22.DC_ROWNUM <= 15', - $this->_platform->modifyLimitQuery('SELECT * FROM user', 10, 5) + $this->platform->modifyLimitQuery('SELECT * FROM user', 10, 5) ); self::assertEquals( 'SELECT db22.* FROM (SELECT db21.*, ROW_NUMBER() OVER() AS DC_ROWNUM FROM (SELECT * FROM user) db21) db22 WHERE db22.DC_ROWNUM >= 6 AND db22.DC_ROWNUM <= 5', - $this->_platform->modifyLimitQuery('SELECT * FROM user', 0, 5) + $this->platform->modifyLimitQuery('SELECT * FROM user', 0, 5) ); } public function testPrefersIdentityColumns() { - self::assertTrue($this->_platform->prefersIdentityColumns()); + self::assertTrue($this->platform->prefersIdentityColumns()); } public function testSupportsIdentityColumns() { - self::assertTrue($this->_platform->supportsIdentityColumns()); + self::assertTrue($this->platform->supportsIdentityColumns()); } public function testDoesNotSupportSavePoints() { - self::assertFalse($this->_platform->supportsSavepoints()); + self::assertFalse($this->platform->supportsSavepoints()); } public function testDoesNotSupportReleasePoints() { - self::assertFalse($this->_platform->supportsReleaseSavepoints()); + self::assertFalse($this->platform->supportsReleaseSavepoints()); } public function testDoesNotSupportCreateDropDatabase() { - self::assertFalse($this->_platform->supportsCreateDropDatabase()); + self::assertFalse($this->platform->supportsCreateDropDatabase()); } public function testReturnsSQLResultCasing() { - self::assertSame('COL', $this->_platform->getSQLResultCasing('cOl')); + self::assertSame('COL', $this->platform->getSQLResultCasing('cOl')); } protected function getBinaryDefaultLength() @@ -419,15 +419,15 @@ protected function getBinaryMaxLength() public function testReturnsBinaryTypeDeclarationSQL() { - self::assertSame('VARBINARY(1)', $this->_platform->getBinaryTypeDeclarationSQL(array())); - self::assertSame('VARBINARY(255)', $this->_platform->getBinaryTypeDeclarationSQL(array('length' => 0))); - self::assertSame('VARBINARY(32704)', $this->_platform->getBinaryTypeDeclarationSQL(array('length' => 32704))); - self::assertSame('BLOB(1M)', $this->_platform->getBinaryTypeDeclarationSQL(array('length' => 32705))); + self::assertSame('VARBINARY(1)', $this->platform->getBinaryTypeDeclarationSQL(array())); + self::assertSame('VARBINARY(255)', $this->platform->getBinaryTypeDeclarationSQL(array('length' => 0))); + self::assertSame('VARBINARY(32704)', $this->platform->getBinaryTypeDeclarationSQL(array('length' => 32704))); + self::assertSame('BLOB(1M)', $this->platform->getBinaryTypeDeclarationSQL(array('length' => 32705))); - self::assertSame('BINARY(1)', $this->_platform->getBinaryTypeDeclarationSQL(array('fixed' => true))); - self::assertSame('BINARY(255)', $this->_platform->getBinaryTypeDeclarationSQL(array('fixed' => true, 'length' => 0))); - self::assertSame('BINARY(32704)', $this->_platform->getBinaryTypeDeclarationSQL(array('fixed' => true, 'length' => 32704))); - self::assertSame('BLOB(1M)', $this->_platform->getBinaryTypeDeclarationSQL(array('fixed' => true, 'length' => 32705))); + self::assertSame('BINARY(1)', $this->platform->getBinaryTypeDeclarationSQL(array('fixed' => true))); + self::assertSame('BINARY(255)', $this->platform->getBinaryTypeDeclarationSQL(array('fixed' => true, 'length' => 0))); + self::assertSame('BINARY(32704)', $this->platform->getBinaryTypeDeclarationSQL(array('fixed' => true, 'length' => 32704))); + self::assertSame('BLOB(1M)', $this->platform->getBinaryTypeDeclarationSQL(array('fixed' => true, 'length' => 32705))); } /** @@ -504,7 +504,7 @@ protected function getQuotedAlterTableRenameIndexInSchemaSQL() */ public function testReturnsGuidTypeDeclarationSQL() { - self::assertSame('CHAR(36)', $this->_platform->getGuidTypeDeclarationSQL(array())); + self::assertSame('CHAR(36)', $this->platform->getGuidTypeDeclarationSQL(array())); } /** @@ -568,7 +568,7 @@ public function testGeneratesAlterColumnSQL($changedProperty, Column $column, $e $expectedSQL[] = "CALL SYSPROC.ADMIN_CMD ('REORG TABLE foo')"; - self::assertSame($expectedSQL, $this->_platform->getAlterTableSQL($tableDiff)); + self::assertSame($expectedSQL, $this->platform->getAlterTableSQL($tableDiff)); } /** @@ -701,7 +701,7 @@ protected function getGeneratesAlterTableRenameIndexUsedByForeignKeySQL() */ public function testQuotesTableNameInListTableColumnsSQL() { - self::assertContains("'Foo''Bar\\'", $this->_platform->getListTableColumnsSQL("Foo'Bar\\"), '', true); + self::assertContains("'Foo''Bar\\'", $this->platform->getListTableColumnsSQL("Foo'Bar\\"), '', true); } /** @@ -709,7 +709,7 @@ public function testQuotesTableNameInListTableColumnsSQL() */ public function testQuotesTableNameInListTableIndexesSQL() { - self::assertContains("'Foo''Bar\\'", $this->_platform->getListTableIndexesSQL("Foo'Bar\\"), '', true); + self::assertContains("'Foo''Bar\\'", $this->platform->getListTableIndexesSQL("Foo'Bar\\"), '', true); } /** @@ -717,6 +717,6 @@ public function testQuotesTableNameInListTableIndexesSQL() */ public function testQuotesTableNameInListTableForeignKeysSQL() { - self::assertContains("'Foo''Bar\\'", $this->_platform->getListTableForeignKeysSQL("Foo'Bar\\"), '', true); + self::assertContains("'Foo''Bar\\'", $this->platform->getListTableForeignKeysSQL("Foo'Bar\\"), '', true); } } diff --git a/tests/Doctrine/Tests/DBAL/Platforms/MariaDb1027PlatformTest.php b/tests/Doctrine/Tests/DBAL/Platforms/MariaDb1027PlatformTest.php index 79d08d1a07d..b6e46572e95 100644 --- a/tests/Doctrine/Tests/DBAL/Platforms/MariaDb1027PlatformTest.php +++ b/tests/Doctrine/Tests/DBAL/Platforms/MariaDb1027PlatformTest.php @@ -19,7 +19,7 @@ public function createPlatform() : MariaDb1027Platform public function testHasNativeJsonType() : void { - self::assertFalse($this->_platform->hasNativeJsonType()); + self::assertFalse($this->platform->hasNativeJsonType()); } /** @@ -28,13 +28,13 @@ public function testHasNativeJsonType() : void */ public function testReturnsJsonTypeDeclarationSQL() : void { - self::assertSame('LONGTEXT', $this->_platform->getJsonTypeDeclarationSQL([])); + self::assertSame('LONGTEXT', $this->platform->getJsonTypeDeclarationSQL([])); } public function testInitializesJsonTypeMapping() : void { - self::assertTrue($this->_platform->hasDoctrineTypeMappingFor('json')); - self::assertSame(Type::JSON, $this->_platform->getDoctrineTypeMapping('json')); + self::assertTrue($this->platform->hasDoctrineTypeMappingFor('json')); + self::assertSame(Type::JSON, $this->platform->getDoctrineTypeMapping('json')); } /** diff --git a/tests/Doctrine/Tests/DBAL/Platforms/MySQL57PlatformTest.php b/tests/Doctrine/Tests/DBAL/Platforms/MySQL57PlatformTest.php index 2ea04fe75a8..bd178f3f292 100644 --- a/tests/Doctrine/Tests/DBAL/Platforms/MySQL57PlatformTest.php +++ b/tests/Doctrine/Tests/DBAL/Platforms/MySQL57PlatformTest.php @@ -17,18 +17,18 @@ public function createPlatform() public function testHasNativeJsonType() { - self::assertTrue($this->_platform->hasNativeJsonType()); + self::assertTrue($this->platform->hasNativeJsonType()); } public function testReturnsJsonTypeDeclarationSQL() { - self::assertSame('JSON', $this->_platform->getJsonTypeDeclarationSQL(array())); + self::assertSame('JSON', $this->platform->getJsonTypeDeclarationSQL(array())); } public function testInitializesJsonTypeMapping() { - self::assertTrue($this->_platform->hasDoctrineTypeMappingFor('json')); - self::assertSame(Type::JSON, $this->_platform->getDoctrineTypeMapping('json')); + self::assertTrue($this->platform->hasDoctrineTypeMappingFor('json')); + self::assertSame(Type::JSON, $this->platform->getDoctrineTypeMapping('json')); } /** diff --git a/tests/Doctrine/Tests/DBAL/Platforms/MySqlPlatformTest.php b/tests/Doctrine/Tests/DBAL/Platforms/MySqlPlatformTest.php index fb2331b4daf..a7bfaa107f7 100644 --- a/tests/Doctrine/Tests/DBAL/Platforms/MySqlPlatformTest.php +++ b/tests/Doctrine/Tests/DBAL/Platforms/MySqlPlatformTest.php @@ -16,7 +16,7 @@ public function testHasCorrectDefaultTransactionIsolationLevel() { self::assertEquals( Connection::TRANSACTION_REPEATABLE_READ, - $this->_platform->getDefaultTransactionIsolationLevel() + $this->platform->getDefaultTransactionIsolationLevel() ); } } diff --git a/tests/Doctrine/Tests/DBAL/Platforms/OraclePlatformTest.php b/tests/Doctrine/Tests/DBAL/Platforms/OraclePlatformTest.php index 7ebbea2d11f..0988c03a225 100644 --- a/tests/Doctrine/Tests/DBAL/Platforms/OraclePlatformTest.php +++ b/tests/Doctrine/Tests/DBAL/Platforms/OraclePlatformTest.php @@ -93,32 +93,32 @@ public function getGenerateAlterTableSql() */ public function testRLike() { - self::assertEquals('RLIKE', $this->_platform->getRegexpExpression(), 'Regular expression operator is not correct'); + self::assertEquals('RLIKE', $this->platform->getRegexpExpression(), 'Regular expression operator is not correct'); } public function testGeneratesSqlSnippets() { - self::assertEquals('"', $this->_platform->getIdentifierQuoteCharacter(), 'Identifier quote character is not correct'); - self::assertEquals('column1 || column2 || column3', $this->_platform->getConcatExpression('column1', 'column2', 'column3'), 'Concatenation expression is not correct'); + self::assertEquals('"', $this->platform->getIdentifierQuoteCharacter(), 'Identifier quote character is not correct'); + self::assertEquals('column1 || column2 || column3', $this->platform->getConcatExpression('column1', 'column2', 'column3'), 'Concatenation expression is not correct'); } public function testGeneratesTransactionsCommands() { self::assertEquals( 'SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED', - $this->_platform->getSetTransactionIsolationSQL(\Doctrine\DBAL\Connection::TRANSACTION_READ_UNCOMMITTED) + $this->platform->getSetTransactionIsolationSQL(\Doctrine\DBAL\Connection::TRANSACTION_READ_UNCOMMITTED) ); self::assertEquals( 'SET TRANSACTION ISOLATION LEVEL READ COMMITTED', - $this->_platform->getSetTransactionIsolationSQL(\Doctrine\DBAL\Connection::TRANSACTION_READ_COMMITTED) + $this->platform->getSetTransactionIsolationSQL(\Doctrine\DBAL\Connection::TRANSACTION_READ_COMMITTED) ); self::assertEquals( 'SET TRANSACTION ISOLATION LEVEL SERIALIZABLE', - $this->_platform->getSetTransactionIsolationSQL(\Doctrine\DBAL\Connection::TRANSACTION_REPEATABLE_READ) + $this->platform->getSetTransactionIsolationSQL(\Doctrine\DBAL\Connection::TRANSACTION_REPEATABLE_READ) ); self::assertEquals( 'SET TRANSACTION ISOLATION LEVEL SERIALIZABLE', - $this->_platform->getSetTransactionIsolationSQL(\Doctrine\DBAL\Connection::TRANSACTION_SERIALIZABLE) + $this->platform->getSetTransactionIsolationSQL(\Doctrine\DBAL\Connection::TRANSACTION_SERIALIZABLE) ); } @@ -127,32 +127,32 @@ public function testGeneratesTransactionsCommands() */ public function testCreateDatabaseThrowsException() { - self::assertEquals('CREATE DATABASE foobar', $this->_platform->getCreateDatabaseSQL('foobar')); + self::assertEquals('CREATE DATABASE foobar', $this->platform->getCreateDatabaseSQL('foobar')); } public function testDropDatabaseThrowsException() { - self::assertEquals('DROP USER foobar CASCADE', $this->_platform->getDropDatabaseSQL('foobar')); + self::assertEquals('DROP USER foobar CASCADE', $this->platform->getDropDatabaseSQL('foobar')); } public function testDropTable() { - self::assertEquals('DROP TABLE foobar', $this->_platform->getDropTableSQL('foobar')); + self::assertEquals('DROP TABLE foobar', $this->platform->getDropTableSQL('foobar')); } public function testGeneratesTypeDeclarationForIntegers() { self::assertEquals( 'NUMBER(10)', - $this->_platform->getIntegerTypeDeclarationSQL(array()) + $this->platform->getIntegerTypeDeclarationSQL(array()) ); self::assertEquals( 'NUMBER(10)', - $this->_platform->getIntegerTypeDeclarationSQL(array('autoincrement' => true) + $this->platform->getIntegerTypeDeclarationSQL(array('autoincrement' => true) )); self::assertEquals( 'NUMBER(10)', - $this->_platform->getIntegerTypeDeclarationSQL( + $this->platform->getIntegerTypeDeclarationSQL( array('autoincrement' => true, 'primary' => true) )); } @@ -161,34 +161,34 @@ public function testGeneratesTypeDeclarationsForStrings() { self::assertEquals( 'CHAR(10)', - $this->_platform->getVarcharTypeDeclarationSQL( + $this->platform->getVarcharTypeDeclarationSQL( array('length' => 10, 'fixed' => true) )); self::assertEquals( 'VARCHAR2(50)', - $this->_platform->getVarcharTypeDeclarationSQL(array('length' => 50)), + $this->platform->getVarcharTypeDeclarationSQL(array('length' => 50)), 'Variable string declaration is not correct' ); self::assertEquals( 'VARCHAR2(255)', - $this->_platform->getVarcharTypeDeclarationSQL(array()), + $this->platform->getVarcharTypeDeclarationSQL(array()), 'Long string declaration is not correct' ); } public function testPrefersIdentityColumns() { - self::assertFalse($this->_platform->prefersIdentityColumns()); + self::assertFalse($this->platform->prefersIdentityColumns()); } public function testSupportsIdentityColumns() { - self::assertFalse($this->_platform->supportsIdentityColumns()); + self::assertFalse($this->platform->supportsIdentityColumns()); } public function testSupportsSavePoints() { - self::assertTrue($this->_platform->supportsSavepoints()); + self::assertTrue($this->platform->supportsSavepoints()); } /** @@ -223,7 +223,7 @@ public function testGeneratesAdvancedForeignKeyOptionsSQL(array $options, $expec { $foreignKey = new ForeignKeyConstraint(array('foo'), 'foreign_table', array('bar'), null, $options); - self::assertSame($expectedSql, $this->_platform->getAdvancedForeignKeyOptionsSQL($foreignKey)); + self::assertSame($expectedSql, $this->platform->getAdvancedForeignKeyOptionsSQL($foreignKey)); } /** @@ -257,37 +257,37 @@ public function getReturnsForeignKeyReferentialActionSQL() public function testModifyLimitQuery() { - $sql = $this->_platform->modifyLimitQuery('SELECT * FROM user', 10, 0); + $sql = $this->platform->modifyLimitQuery('SELECT * FROM user', 10, 0); self::assertEquals('SELECT a.* FROM (SELECT * FROM user) a WHERE ROWNUM <= 10', $sql); } public function testModifyLimitQueryWithEmptyOffset() { - $sql = $this->_platform->modifyLimitQuery('SELECT * FROM user', 10); + $sql = $this->platform->modifyLimitQuery('SELECT * FROM user', 10); self::assertEquals('SELECT a.* FROM (SELECT * FROM user) a WHERE ROWNUM <= 10', $sql); } public function testModifyLimitQueryWithNonEmptyOffset() { - $sql = $this->_platform->modifyLimitQuery('SELECT * FROM user', 10, 10); + $sql = $this->platform->modifyLimitQuery('SELECT * FROM user', 10, 10); self::assertEquals('SELECT * FROM (SELECT a.*, ROWNUM AS doctrine_rownum FROM (SELECT * FROM user) a WHERE ROWNUM <= 20) WHERE doctrine_rownum >= 11', $sql); } public function testModifyLimitQueryWithEmptyLimit() { - $sql = $this->_platform->modifyLimitQuery('SELECT * FROM user', null, 10); + $sql = $this->platform->modifyLimitQuery('SELECT * FROM user', null, 10); self::assertEquals('SELECT * FROM (SELECT a.*, ROWNUM AS doctrine_rownum FROM (SELECT * FROM user) a) WHERE doctrine_rownum >= 11', $sql); } public function testModifyLimitQueryWithAscOrderBy() { - $sql = $this->_platform->modifyLimitQuery('SELECT * FROM user ORDER BY username ASC', 10); + $sql = $this->platform->modifyLimitQuery('SELECT * FROM user ORDER BY username ASC', 10); self::assertEquals('SELECT a.* FROM (SELECT * FROM user ORDER BY username ASC) a WHERE ROWNUM <= 10', $sql); } public function testModifyLimitQueryWithDescOrderBy() { - $sql = $this->_platform->modifyLimitQuery('SELECT * FROM user ORDER BY username DESC', 10); + $sql = $this->platform->modifyLimitQuery('SELECT * FROM user ORDER BY username DESC', 10); self::assertEquals('SELECT a.* FROM (SELECT * FROM user ORDER BY username DESC) a WHERE ROWNUM <= 10', $sql); } @@ -304,7 +304,7 @@ public function testGenerateTableWithAutoincrement() "CREATE SEQUENCE {$tableName}_SEQ START WITH 1 MINVALUE 1 INCREMENT BY 1", "CREATE TRIGGER {$tableName}_AI_PK BEFORE INSERT ON {$tableName} FOR EACH ROW DECLARE last_Sequence NUMBER; last_InsertID NUMBER; BEGIN SELECT {$tableName}_SEQ.NEXTVAL INTO :NEW.{$columnName} FROM DUAL; IF (:NEW.{$columnName} IS NULL OR :NEW.{$columnName} = 0) THEN SELECT {$tableName}_SEQ.NEXTVAL INTO :NEW.{$columnName} FROM DUAL; ELSE SELECT NVL(Last_Number, 0) INTO last_Sequence FROM User_Sequences WHERE Sequence_Name = '{$tableName}_SEQ'; SELECT :NEW.{$columnName} INTO last_InsertID FROM DUAL; WHILE (last_InsertID > last_Sequence) LOOP SELECT {$tableName}_SEQ.NEXTVAL INTO last_Sequence FROM DUAL; END LOOP; END IF; END;" ); - $statements = $this->_platform->getCreateTableSQL($table); + $statements = $this->platform->getCreateTableSQL($table); //strip all the whitespace from the statements array_walk($statements, function(&$value){ $value = preg_replace('/\s+/', ' ',$value); @@ -413,7 +413,7 @@ public function testAlterTableNotNULL() $expectedSql = array( "ALTER TABLE mytable MODIFY (foo VARCHAR2(255) DEFAULT 'bla', baz VARCHAR2(255) DEFAULT 'bla' NOT NULL, metar VARCHAR2(2000) DEFAULT NULL NULL)", ); - self::assertEquals($expectedSql, $this->_platform->getAlterTableSQL($tableDiff)); + self::assertEquals($expectedSql, $this->platform->getAlterTableSQL($tableDiff)); } /** @@ -421,14 +421,14 @@ public function testAlterTableNotNULL() */ public function testInitializesDoctrineTypeMappings() { - self::assertTrue($this->_platform->hasDoctrineTypeMappingFor('long raw')); - self::assertSame('blob', $this->_platform->getDoctrineTypeMapping('long raw')); + self::assertTrue($this->platform->hasDoctrineTypeMappingFor('long raw')); + self::assertSame('blob', $this->platform->getDoctrineTypeMapping('long raw')); - self::assertTrue($this->_platform->hasDoctrineTypeMappingFor('raw')); - self::assertSame('binary', $this->_platform->getDoctrineTypeMapping('raw')); + self::assertTrue($this->platform->hasDoctrineTypeMappingFor('raw')); + self::assertSame('binary', $this->platform->getDoctrineTypeMapping('raw')); - self::assertTrue($this->_platform->hasDoctrineTypeMappingFor('date')); - self::assertSame('date', $this->_platform->getDoctrineTypeMapping('date')); + self::assertTrue($this->platform->hasDoctrineTypeMappingFor('date')); + self::assertSame('date', $this->platform->getDoctrineTypeMapping('date')); } protected function getBinaryMaxLength() @@ -438,15 +438,15 @@ protected function getBinaryMaxLength() public function testReturnsBinaryTypeDeclarationSQL() { - self::assertSame('RAW(255)', $this->_platform->getBinaryTypeDeclarationSQL(array())); - self::assertSame('RAW(2000)', $this->_platform->getBinaryTypeDeclarationSQL(array('length' => 0))); - self::assertSame('RAW(2000)', $this->_platform->getBinaryTypeDeclarationSQL(array('length' => 2000))); - self::assertSame('BLOB', $this->_platform->getBinaryTypeDeclarationSQL(array('length' => 2001))); + self::assertSame('RAW(255)', $this->platform->getBinaryTypeDeclarationSQL(array())); + self::assertSame('RAW(2000)', $this->platform->getBinaryTypeDeclarationSQL(array('length' => 0))); + self::assertSame('RAW(2000)', $this->platform->getBinaryTypeDeclarationSQL(array('length' => 2000))); + self::assertSame('BLOB', $this->platform->getBinaryTypeDeclarationSQL(array('length' => 2001))); - self::assertSame('RAW(255)', $this->_platform->getBinaryTypeDeclarationSQL(array('fixed' => true))); - self::assertSame('RAW(2000)', $this->_platform->getBinaryTypeDeclarationSQL(array('fixed' => true, 'length' => 0))); - self::assertSame('RAW(2000)', $this->_platform->getBinaryTypeDeclarationSQL(array('fixed' => true, 'length' => 2000))); - self::assertSame('BLOB', $this->_platform->getBinaryTypeDeclarationSQL(array('fixed' => true, 'length' => 2001))); + self::assertSame('RAW(255)', $this->platform->getBinaryTypeDeclarationSQL(array('fixed' => true))); + self::assertSame('RAW(2000)', $this->platform->getBinaryTypeDeclarationSQL(array('fixed' => true, 'length' => 0))); + self::assertSame('RAW(2000)', $this->platform->getBinaryTypeDeclarationSQL(array('fixed' => true, 'length' => 2000))); + self::assertSame('BLOB', $this->platform->getBinaryTypeDeclarationSQL(array('fixed' => true, 'length' => 2001))); } public function testDoesNotPropagateUnnecessaryTableAlterationOnBinaryType() @@ -463,7 +463,7 @@ public function testDoesNotPropagateUnnecessaryTableAlterationOnBinaryType() // VARBINARY -> BINARY // BINARY -> VARBINARY - self::assertEmpty($this->_platform->getAlterTableSQL($comparator->diffTable($table1, $table2))); + self::assertEmpty($this->platform->getAlterTableSQL($comparator->diffTable($table1, $table2))); } /** @@ -471,7 +471,7 @@ public function testDoesNotPropagateUnnecessaryTableAlterationOnBinaryType() */ public function testUsesSequenceEmulatedIdentityColumns() { - self::assertTrue($this->_platform->usesSequenceEmulatedIdentityColumns()); + self::assertTrue($this->platform->usesSequenceEmulatedIdentityColumns()); } /** @@ -480,10 +480,10 @@ public function testUsesSequenceEmulatedIdentityColumns() */ public function testReturnsIdentitySequenceName() { - self::assertSame('MYTABLE_SEQ', $this->_platform->getIdentitySequenceName('mytable', 'mycolumn')); - self::assertSame('"mytable_SEQ"', $this->_platform->getIdentitySequenceName('"mytable"', 'mycolumn')); - self::assertSame('MYTABLE_SEQ', $this->_platform->getIdentitySequenceName('mytable', '"mycolumn"')); - self::assertSame('"mytable_SEQ"', $this->_platform->getIdentitySequenceName('"mytable"', '"mycolumn"')); + self::assertSame('MYTABLE_SEQ', $this->platform->getIdentitySequenceName('mytable', 'mycolumn')); + self::assertSame('"mytable_SEQ"', $this->platform->getIdentitySequenceName('"mytable"', 'mycolumn')); + self::assertSame('MYTABLE_SEQ', $this->platform->getIdentitySequenceName('mytable', '"mycolumn"')); + self::assertSame('"mytable_SEQ"', $this->platform->getIdentitySequenceName('"mytable"', '"mycolumn"')); } /** @@ -493,7 +493,7 @@ public function testReturnsIdentitySequenceName() public function testCreateSequenceWithCache($cacheSize, $expectedSql) { $sequence = new \Doctrine\DBAL\Schema\Sequence('foo', 1, 1, $cacheSize); - self::assertContains($expectedSql, $this->_platform->getCreateSequenceSQL($sequence)); + self::assertContains($expectedSql, $this->platform->getCreateSequenceSQL($sequence)); } public function dataCreateSequenceWithCache() @@ -583,7 +583,7 @@ protected function getQuotesDropForeignKeySQL() */ public function testReturnsGuidTypeDeclarationSQL() { - self::assertSame('CHAR(36)', $this->_platform->getGuidTypeDeclarationSQL(array())); + self::assertSame('CHAR(36)', $this->platform->getGuidTypeDeclarationSQL(array())); } /** @@ -602,7 +602,7 @@ public function getAlterTableRenameColumnSQL() */ public function testReturnsDropAutoincrementSQL($table, $expectedSql) { - self::assertSame($expectedSql, $this->_platform->getDropAutoincrementSql($table)); + self::assertSame($expectedSql, $this->platform->getDropAutoincrementSql($table)); } public function getReturnsDropAutoincrementSQL() @@ -682,7 +682,7 @@ public function testAltersTableColumnCommentWithExplicitlyQuotedIdentifiers() array( 'COMMENT ON COLUMN "foo"."bar" IS \'baz\'', ), - $this->_platform->getAlterTableSQL($tableDiff) + $this->platform->getAlterTableSQL($tableDiff) ); } @@ -694,9 +694,9 @@ public function testQuotedTableNames() // assert tabel self::assertTrue($table->isQuoted()); self::assertEquals('test', $table->getName()); - self::assertEquals('"test"', $table->getQuotedName($this->_platform)); + self::assertEquals('"test"', $table->getQuotedName($this->platform)); - $sql = $this->_platform->getCreateTableSQL($table); + $sql = $this->platform->getCreateTableSQL($table); self::assertEquals('CREATE TABLE "test" ("id" NUMBER(10) NOT NULL)', $sql[0]); self::assertEquals('CREATE SEQUENCE "test_SEQ" START WITH 1 MINVALUE 1 INCREMENT BY 1', $sql[2]); $createTriggerStatement = <<_platform->getListTableColumnsSQL('"test"', $database)); + self::assertEquals($expectedSql, $this->platform->getListTableColumnsSQL('"test"', $database)); } public function getReturnsGetListTableColumnsSQL() @@ -832,7 +832,7 @@ protected function getGeneratesAlterTableRenameIndexUsedByForeignKeySQL() */ public function testQuotesDatabaseNameInListSequencesSQL() { - self::assertContains("'Foo''Bar\\\\'", $this->_platform->getListSequencesSQL("Foo'Bar\\"), '', true); + self::assertContains("'Foo''Bar\\\\'", $this->platform->getListSequencesSQL("Foo'Bar\\"), '', true); } /** @@ -840,7 +840,7 @@ public function testQuotesDatabaseNameInListSequencesSQL() */ public function testQuotesTableNameInListTableIndexesSQL() { - self::assertContains("'Foo''Bar\\\\'", $this->_platform->getListTableIndexesSQL("Foo'Bar\\"), '', true); + self::assertContains("'Foo''Bar\\\\'", $this->platform->getListTableIndexesSQL("Foo'Bar\\"), '', true); } /** @@ -848,7 +848,7 @@ public function testQuotesTableNameInListTableIndexesSQL() */ public function testQuotesTableNameInListTableForeignKeysSQL() { - self::assertContains("'Foo''Bar\\\\'", $this->_platform->getListTableForeignKeysSQL("Foo'Bar\\"), '', true); + self::assertContains("'Foo''Bar\\\\'", $this->platform->getListTableForeignKeysSQL("Foo'Bar\\"), '', true); } /** @@ -856,7 +856,7 @@ public function testQuotesTableNameInListTableForeignKeysSQL() */ public function testQuotesTableNameInListTableConstraintsSQL() { - self::assertContains("'Foo''Bar\\\\'", $this->_platform->getListTableConstraintsSQL("Foo'Bar\\"), '', true); + self::assertContains("'Foo''Bar\\\\'", $this->platform->getListTableConstraintsSQL("Foo'Bar\\"), '', true); } /** @@ -864,7 +864,7 @@ public function testQuotesTableNameInListTableConstraintsSQL() */ public function testQuotesTableNameInListTableColumnsSQL() { - self::assertContains("'Foo''Bar\\\\'", $this->_platform->getListTableColumnsSQL("Foo'Bar\\"), '', true); + self::assertContains("'Foo''Bar\\\\'", $this->platform->getListTableColumnsSQL("Foo'Bar\\"), '', true); } /** @@ -872,6 +872,6 @@ public function testQuotesTableNameInListTableColumnsSQL() */ public function testQuotesDatabaseNameInListTableColumnsSQL() { - self::assertContains("'Foo''Bar\\\\'", $this->_platform->getListTableColumnsSQL('foo_table', "Foo'Bar\\"), '', true); + self::assertContains("'Foo''Bar\\\\'", $this->platform->getListTableColumnsSQL('foo_table', "Foo'Bar\\"), '', true); } } diff --git a/tests/Doctrine/Tests/DBAL/Platforms/PostgreSQL100PlatformTest.php b/tests/Doctrine/Tests/DBAL/Platforms/PostgreSQL100PlatformTest.php index 987628de218..df30fc471f0 100644 --- a/tests/Doctrine/Tests/DBAL/Platforms/PostgreSQL100PlatformTest.php +++ b/tests/Doctrine/Tests/DBAL/Platforms/PostgreSQL100PlatformTest.php @@ -27,7 +27,7 @@ public function testGetListSequencesSQL() : void WHERE sequence_catalog = 'test_db' AND sequence_schema NOT LIKE 'pg\_%' AND sequence_schema != 'information_schema'", - $this->_platform->getListSequencesSQL('test_db') + $this->platform->getListSequencesSQL('test_db') ); } } diff --git a/tests/Doctrine/Tests/DBAL/Platforms/PostgreSQL91PlatformTest.php b/tests/Doctrine/Tests/DBAL/Platforms/PostgreSQL91PlatformTest.php index ed09f26c92e..270d63900cf 100644 --- a/tests/Doctrine/Tests/DBAL/Platforms/PostgreSQL91PlatformTest.php +++ b/tests/Doctrine/Tests/DBAL/Platforms/PostgreSQL91PlatformTest.php @@ -15,7 +15,7 @@ public function testColumnCollationDeclarationSQL() { self::assertEquals( 'COLLATE "en_US.UTF-8"', - $this->_platform->getColumnCollationDeclarationSQL('en_US.UTF-8') + $this->platform->getColumnCollationDeclarationSQL('en_US.UTF-8') ); } } diff --git a/tests/Doctrine/Tests/DBAL/Platforms/PostgreSQL92PlatformTest.php b/tests/Doctrine/Tests/DBAL/Platforms/PostgreSQL92PlatformTest.php index 0189dbdfe36..383e44e2c4a 100644 --- a/tests/Doctrine/Tests/DBAL/Platforms/PostgreSQL92PlatformTest.php +++ b/tests/Doctrine/Tests/DBAL/Platforms/PostgreSQL92PlatformTest.php @@ -20,7 +20,7 @@ public function createPlatform() */ public function testHasNativeJsonType() { - self::assertTrue($this->_platform->hasNativeJsonType()); + self::assertTrue($this->platform->hasNativeJsonType()); } /** @@ -28,24 +28,24 @@ public function testHasNativeJsonType() */ public function testReturnsJsonTypeDeclarationSQL() { - self::assertSame('JSON', $this->_platform->getJsonTypeDeclarationSQL(array())); + self::assertSame('JSON', $this->platform->getJsonTypeDeclarationSQL(array())); } public function testReturnsSmallIntTypeDeclarationSQL() { self::assertSame( 'SMALLSERIAL', - $this->_platform->getSmallIntTypeDeclarationSQL(array('autoincrement' => true)) + $this->platform->getSmallIntTypeDeclarationSQL(array('autoincrement' => true)) ); self::assertSame( 'SMALLINT', - $this->_platform->getSmallIntTypeDeclarationSQL(array('autoincrement' => false)) + $this->platform->getSmallIntTypeDeclarationSQL(array('autoincrement' => false)) ); self::assertSame( 'SMALLINT', - $this->_platform->getSmallIntTypeDeclarationSQL(array()) + $this->platform->getSmallIntTypeDeclarationSQL(array()) ); } @@ -54,8 +54,8 @@ public function testReturnsSmallIntTypeDeclarationSQL() */ public function testInitializesJsonTypeMapping() { - self::assertTrue($this->_platform->hasDoctrineTypeMappingFor('json')); - self::assertEquals(Type::JSON, $this->_platform->getDoctrineTypeMapping('json')); + self::assertTrue($this->platform->hasDoctrineTypeMappingFor('json')); + self::assertEquals(Type::JSON, $this->platform->getDoctrineTypeMapping('json')); } /** @@ -65,7 +65,7 @@ public function testReturnsCloseActiveDatabaseConnectionsSQL() { self::assertSame( "SELECT pg_terminate_backend(pid) FROM pg_stat_activity WHERE datname = 'foo'", - $this->_platform->getCloseActiveDatabaseConnectionsSQL('foo') + $this->platform->getCloseActiveDatabaseConnectionsSQL('foo') ); } } diff --git a/tests/Doctrine/Tests/DBAL/Platforms/PostgreSQL94PlatformTest.php b/tests/Doctrine/Tests/DBAL/Platforms/PostgreSQL94PlatformTest.php index d566007afc2..634f2d76554 100644 --- a/tests/Doctrine/Tests/DBAL/Platforms/PostgreSQL94PlatformTest.php +++ b/tests/Doctrine/Tests/DBAL/Platforms/PostgreSQL94PlatformTest.php @@ -18,14 +18,14 @@ public function createPlatform() public function testReturnsJsonTypeDeclarationSQL() { parent::testReturnsJsonTypeDeclarationSQL(); - self::assertSame('JSON', $this->_platform->getJsonTypeDeclarationSQL(array('jsonb' => false))); - self::assertSame('JSONB', $this->_platform->getJsonTypeDeclarationSQL(array('jsonb' => true))); + self::assertSame('JSON', $this->platform->getJsonTypeDeclarationSQL(array('jsonb' => false))); + self::assertSame('JSONB', $this->platform->getJsonTypeDeclarationSQL(array('jsonb' => true))); } public function testInitializesJsonTypeMapping() { parent::testInitializesJsonTypeMapping(); - self::assertTrue($this->_platform->hasDoctrineTypeMappingFor('jsonb')); - self::assertEquals(Type::JSON, $this->_platform->getDoctrineTypeMapping('jsonb')); + self::assertTrue($this->platform->hasDoctrineTypeMappingFor('jsonb')); + self::assertEquals(Type::JSON, $this->platform->getDoctrineTypeMapping('jsonb')); } } diff --git a/tests/Doctrine/Tests/DBAL/Platforms/PostgreSqlPlatformTest.php b/tests/Doctrine/Tests/DBAL/Platforms/PostgreSqlPlatformTest.php index 6db159df48e..b3ead8b293c 100644 --- a/tests/Doctrine/Tests/DBAL/Platforms/PostgreSqlPlatformTest.php +++ b/tests/Doctrine/Tests/DBAL/Platforms/PostgreSqlPlatformTest.php @@ -13,6 +13,6 @@ public function createPlatform() public function testSupportsPartialIndexes() { - self::assertTrue($this->_platform->supportsPartialIndexes()); + self::assertTrue($this->platform->supportsPartialIndexes()); } } diff --git a/tests/Doctrine/Tests/DBAL/Platforms/SQLAnywhere11PlatformTest.php b/tests/Doctrine/Tests/DBAL/Platforms/SQLAnywhere11PlatformTest.php index c59a9b1ac12..cd64ea492fe 100644 --- a/tests/Doctrine/Tests/DBAL/Platforms/SQLAnywhere11PlatformTest.php +++ b/tests/Doctrine/Tests/DBAL/Platforms/SQLAnywhere11PlatformTest.php @@ -9,7 +9,7 @@ class SQLAnywhere11PlatformTest extends SQLAnywherePlatformTest /** * @var \Doctrine\DBAL\Platforms\SQLAnywhere11Platform */ - protected $_platform; + protected $platform; public function createPlatform() { @@ -23,6 +23,6 @@ public function testDoesNotSupportRegexp() public function testGeneratesRegularExpressionSQLSnippet() { - self::assertEquals('REGEXP', $this->_platform->getRegexpExpression()); + self::assertEquals('REGEXP', $this->platform->getRegexpExpression()); } } diff --git a/tests/Doctrine/Tests/DBAL/Platforms/SQLAnywhere12PlatformTest.php b/tests/Doctrine/Tests/DBAL/Platforms/SQLAnywhere12PlatformTest.php index 4c6763ae124..fdba2267a54 100644 --- a/tests/Doctrine/Tests/DBAL/Platforms/SQLAnywhere12PlatformTest.php +++ b/tests/Doctrine/Tests/DBAL/Platforms/SQLAnywhere12PlatformTest.php @@ -11,7 +11,7 @@ class SQLAnywhere12PlatformTest extends SQLAnywhere11PlatformTest /** * @var \Doctrine\DBAL\Platforms\SQLAnywhere12Platform */ - protected $_platform; + protected $platform; public function createPlatform() { @@ -25,7 +25,7 @@ public function testDoesNotSupportSequences() public function testSupportsSequences() { - self::assertTrue($this->_platform->supportsSequences()); + self::assertTrue($this->platform->supportsSequences()); } public function testGeneratesSequenceSqlCommands() @@ -33,27 +33,27 @@ public function testGeneratesSequenceSqlCommands() $sequence = new Sequence('myseq', 20, 1); self::assertEquals( 'CREATE SEQUENCE myseq INCREMENT BY 20 START WITH 1 MINVALUE 1', - $this->_platform->getCreateSequenceSQL($sequence) + $this->platform->getCreateSequenceSQL($sequence) ); self::assertEquals( 'ALTER SEQUENCE myseq INCREMENT BY 20', - $this->_platform->getAlterSequenceSQL($sequence) + $this->platform->getAlterSequenceSQL($sequence) ); self::assertEquals( 'DROP SEQUENCE myseq', - $this->_platform->getDropSequenceSQL('myseq') + $this->platform->getDropSequenceSQL('myseq') ); self::assertEquals( 'DROP SEQUENCE myseq', - $this->_platform->getDropSequenceSQL($sequence) + $this->platform->getDropSequenceSQL($sequence) ); self::assertEquals( "SELECT myseq.NEXTVAL", - $this->_platform->getSequenceNextValSQL('myseq') + $this->platform->getSequenceNextValSQL('myseq') ); self::assertEquals( 'SELECT sequence_name, increment_by, start_with, min_value FROM SYS.SYSSEQUENCE', - $this->_platform->getListSequencesSQL(null) + $this->platform->getListSequencesSQL(null) ); } @@ -61,7 +61,7 @@ public function testGeneratesDateTimeTzColumnTypeDeclarationSQL() { self::assertEquals( 'TIMESTAMP WITH TIME ZONE', - $this->_platform->getDateTimeTzTypeDeclarationSQL(array( + $this->platform->getDateTimeTzTypeDeclarationSQL(array( 'length' => 10, 'fixed' => true, 'unsigned' => true, @@ -72,20 +72,20 @@ public function testGeneratesDateTimeTzColumnTypeDeclarationSQL() public function testHasCorrectDateTimeTzFormatString() { - self::assertEquals('Y-m-d H:i:s.uP', $this->_platform->getDateTimeTzFormatString()); + self::assertEquals('Y-m-d H:i:s.uP', $this->platform->getDateTimeTzFormatString()); } public function testInitializesDateTimeTzTypeMapping() { - self::assertTrue($this->_platform->hasDoctrineTypeMappingFor('timestamp with time zone')); - self::assertEquals('datetime', $this->_platform->getDoctrineTypeMapping('timestamp with time zone')); + self::assertTrue($this->platform->hasDoctrineTypeMappingFor('timestamp with time zone')); + self::assertEquals('datetime', $this->platform->getDoctrineTypeMapping('timestamp with time zone')); } public function testGeneratesCreateIndexWithAdvancedPlatformOptionsSQL() { self::assertEquals( 'CREATE VIRTUAL UNIQUE CLUSTERED INDEX fooindex ON footable (a, b) WITH NULLS NOT DISTINCT FOR OLAP WORKLOAD', - $this->_platform->getCreateIndexSQL( + $this->platform->getCreateIndexSQL( new Index( 'fooindex', array('a', 'b'), @@ -98,7 +98,7 @@ public function testGeneratesCreateIndexWithAdvancedPlatformOptionsSQL() ); self::assertEquals( 'CREATE VIRTUAL CLUSTERED INDEX fooindex ON footable (a, b) FOR OLAP WORKLOAD', - $this->_platform->getCreateIndexSQL( + $this->platform->getCreateIndexSQL( new Index( 'fooindex', array('a', 'b'), @@ -113,7 +113,7 @@ public function testGeneratesCreateIndexWithAdvancedPlatformOptionsSQL() // WITH NULLS NOT DISTINCT clause not available on primary indexes. self::assertEquals( 'ALTER TABLE footable ADD PRIMARY KEY (a, b)', - $this->_platform->getCreateIndexSQL( + $this->platform->getCreateIndexSQL( new Index( 'fooindex', array('a', 'b'), @@ -128,7 +128,7 @@ public function testGeneratesCreateIndexWithAdvancedPlatformOptionsSQL() // WITH NULLS NOT DISTINCT clause not available on non-unique indexes. self::assertEquals( 'CREATE INDEX fooindex ON footable (a, b)', - $this->_platform->getCreateIndexSQL( + $this->platform->getCreateIndexSQL( new Index( 'fooindex', array('a', 'b'), diff --git a/tests/Doctrine/Tests/DBAL/Platforms/SQLAnywhere16PlatformTest.php b/tests/Doctrine/Tests/DBAL/Platforms/SQLAnywhere16PlatformTest.php index c66bb5177ab..09767b9f3aa 100644 --- a/tests/Doctrine/Tests/DBAL/Platforms/SQLAnywhere16PlatformTest.php +++ b/tests/Doctrine/Tests/DBAL/Platforms/SQLAnywhere16PlatformTest.php @@ -16,7 +16,7 @@ public function testGeneratesCreateIndexWithAdvancedPlatformOptionsSQL() { self::assertEquals( 'CREATE UNIQUE INDEX fooindex ON footable (a, b) WITH NULLS DISTINCT', - $this->_platform->getCreateIndexSQL( + $this->platform->getCreateIndexSQL( new Index( 'fooindex', array('a', 'b'), @@ -31,7 +31,7 @@ public function testGeneratesCreateIndexWithAdvancedPlatformOptionsSQL() // WITH NULLS DISTINCT clause not available on primary indexes. self::assertEquals( 'ALTER TABLE footable ADD PRIMARY KEY (a, b)', - $this->_platform->getCreateIndexSQL( + $this->platform->getCreateIndexSQL( new Index( 'fooindex', array('a', 'b'), @@ -46,7 +46,7 @@ public function testGeneratesCreateIndexWithAdvancedPlatformOptionsSQL() // WITH NULLS DISTINCT clause not available on non-unique indexes. self::assertEquals( 'CREATE INDEX fooindex ON footable (a, b)', - $this->_platform->getCreateIndexSQL( + $this->platform->getCreateIndexSQL( new Index( 'fooindex', array('a', 'b'), @@ -65,7 +65,7 @@ public function testThrowsExceptionOnInvalidWithNullsNotDistinctIndexOptions() { $this->expectException('UnexpectedValueException'); - $this->_platform->getCreateIndexSQL( + $this->platform->getCreateIndexSQL( new Index( 'fooindex', array('a', 'b'), diff --git a/tests/Doctrine/Tests/DBAL/Platforms/SQLAnywherePlatformTest.php b/tests/Doctrine/Tests/DBAL/Platforms/SQLAnywherePlatformTest.php index 5d96d60ba77..0fa71db3b53 100644 --- a/tests/Doctrine/Tests/DBAL/Platforms/SQLAnywherePlatformTest.php +++ b/tests/Doctrine/Tests/DBAL/Platforms/SQLAnywherePlatformTest.php @@ -21,7 +21,7 @@ class SQLAnywherePlatformTest extends AbstractPlatformTestCase /** * @var \Doctrine\DBAL\Platforms\SQLAnywherePlatform */ - protected $_platform; + protected $platform; public function createPlatform() { @@ -122,7 +122,7 @@ public function getCreateTableColumnTypeCommentsSQL() public function testHasCorrectPlatformName() { - self::assertEquals('sqlanywhere', $this->_platform->getName()); + self::assertEquals('sqlanywhere', $this->platform->getName()); } public function testGeneratesCreateTableSQLWithCommonIndexes() @@ -140,7 +140,7 @@ public function testGeneratesCreateTableSQLWithCommonIndexes() 'CREATE INDEX IDX_D87F7E0C5E237E06 ON test (name)', 'CREATE INDEX composite_idx ON test (id, name)' ), - $this->_platform->getCreateTableSQL($table) + $this->platform->getCreateTableSQL($table) ); } @@ -166,7 +166,7 @@ public function testGeneratesCreateTableSQLWithForeignKeyConstraints() 'CONSTRAINT FK_D87F7E0C177612A38E7F4319 FOREIGN KEY (fk_1, fk_2) REFERENCES foreign_table (pk_1, pk_2), ' . 'CONSTRAINT named_fk FOREIGN KEY (fk_1, fk_2) REFERENCES foreign_table2 (pk_1, pk_2))' ), - $this->_platform->getCreateTableSQL($table, AbstractPlatform::CREATE_FOREIGNKEYS) + $this->platform->getCreateTableSQL($table, AbstractPlatform::CREATE_FOREIGNKEYS) ); } @@ -182,7 +182,7 @@ public function testGeneratesCreateTableSQLWithCheckConstraints() array( 'CREATE TABLE test (id INT NOT NULL, check_max INT NOT NULL, check_min INT NOT NULL, PRIMARY KEY (id), CHECK (check_max <= 10), CHECK (check_min >= 10))' ), - $this->_platform->getCreateTableSQL($table) + $this->platform->getCreateTableSQL($table) ); } @@ -203,7 +203,7 @@ public function testGeneratesTableAlterationWithRemovedColumnCommentSql() array( "COMMENT ON COLUMN mytable.foo IS NULL" ), - $this->_platform->getAlterTableSQL($tableDiff) + $this->platform->getAlterTableSQL($tableDiff) ); } @@ -215,7 +215,7 @@ public function testAppendsLockHint($lockMode, $lockHint) $fromClause = 'FROM users'; $expectedResult = $fromClause . $lockHint; - self::assertSame($expectedResult, $this->_platform->appendLockHint($fromClause, $lockMode)); + self::assertSame($expectedResult, $this->platform->appendLockHint($fromClause, $lockMode)); } public function getLockHints() @@ -233,12 +233,12 @@ public function getLockHints() public function testHasCorrectMaxIdentifierLength() { - self::assertEquals(128, $this->_platform->getMaxIdentifierLength()); + self::assertEquals(128, $this->platform->getMaxIdentifierLength()); } public function testFixesSchemaElementNames() { - $maxIdentifierLength = $this->_platform->getMaxIdentifierLength(); + $maxIdentifierLength = $this->platform->getMaxIdentifierLength(); $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; $schemaElementName = ''; @@ -250,11 +250,11 @@ public function testFixesSchemaElementNames() self::assertEquals( $fixedSchemaElementName, - $this->_platform->fixSchemaElementName($schemaElementName) + $this->platform->fixSchemaElementName($schemaElementName) ); self::assertEquals( $fixedSchemaElementName, - $this->_platform->fixSchemaElementName($fixedSchemaElementName) + $this->platform->fixSchemaElementName($fixedSchemaElementName) ); } @@ -267,73 +267,73 @@ public function testGeneratesColumnTypesDeclarationSQL() 'autoincrement' => true ); - self::assertEquals('SMALLINT', $this->_platform->getSmallIntTypeDeclarationSQL(array())); - self::assertEquals('UNSIGNED SMALLINT', $this->_platform->getSmallIntTypeDeclarationSQL(array( + self::assertEquals('SMALLINT', $this->platform->getSmallIntTypeDeclarationSQL(array())); + self::assertEquals('UNSIGNED SMALLINT', $this->platform->getSmallIntTypeDeclarationSQL(array( 'unsigned' => true ))); - self::assertEquals('UNSIGNED SMALLINT IDENTITY', $this->_platform->getSmallIntTypeDeclarationSQL($fullColumnDef)); - self::assertEquals('INT', $this->_platform->getIntegerTypeDeclarationSQL(array())); - self::assertEquals('UNSIGNED INT', $this->_platform->getIntegerTypeDeclarationSQL(array( + self::assertEquals('UNSIGNED SMALLINT IDENTITY', $this->platform->getSmallIntTypeDeclarationSQL($fullColumnDef)); + self::assertEquals('INT', $this->platform->getIntegerTypeDeclarationSQL(array())); + self::assertEquals('UNSIGNED INT', $this->platform->getIntegerTypeDeclarationSQL(array( 'unsigned' => true ))); - self::assertEquals('UNSIGNED INT IDENTITY', $this->_platform->getIntegerTypeDeclarationSQL($fullColumnDef)); - self::assertEquals('BIGINT', $this->_platform->getBigIntTypeDeclarationSQL(array())); - self::assertEquals('UNSIGNED BIGINT', $this->_platform->getBigIntTypeDeclarationSQL(array( + self::assertEquals('UNSIGNED INT IDENTITY', $this->platform->getIntegerTypeDeclarationSQL($fullColumnDef)); + self::assertEquals('BIGINT', $this->platform->getBigIntTypeDeclarationSQL(array())); + self::assertEquals('UNSIGNED BIGINT', $this->platform->getBigIntTypeDeclarationSQL(array( 'unsigned' => true ))); - self::assertEquals('UNSIGNED BIGINT IDENTITY', $this->_platform->getBigIntTypeDeclarationSQL($fullColumnDef)); - self::assertEquals('LONG BINARY', $this->_platform->getBlobTypeDeclarationSQL($fullColumnDef)); - self::assertEquals('BIT', $this->_platform->getBooleanTypeDeclarationSQL($fullColumnDef)); - self::assertEquals('TEXT', $this->_platform->getClobTypeDeclarationSQL($fullColumnDef)); - self::assertEquals('DATE', $this->_platform->getDateTypeDeclarationSQL($fullColumnDef)); - self::assertEquals('DATETIME', $this->_platform->getDateTimeTypeDeclarationSQL($fullColumnDef)); - self::assertEquals('TIME', $this->_platform->getTimeTypeDeclarationSQL($fullColumnDef)); - self::assertEquals('UNIQUEIDENTIFIER', $this->_platform->getGuidTypeDeclarationSQL($fullColumnDef)); + self::assertEquals('UNSIGNED BIGINT IDENTITY', $this->platform->getBigIntTypeDeclarationSQL($fullColumnDef)); + self::assertEquals('LONG BINARY', $this->platform->getBlobTypeDeclarationSQL($fullColumnDef)); + self::assertEquals('BIT', $this->platform->getBooleanTypeDeclarationSQL($fullColumnDef)); + self::assertEquals('TEXT', $this->platform->getClobTypeDeclarationSQL($fullColumnDef)); + self::assertEquals('DATE', $this->platform->getDateTypeDeclarationSQL($fullColumnDef)); + self::assertEquals('DATETIME', $this->platform->getDateTimeTypeDeclarationSQL($fullColumnDef)); + self::assertEquals('TIME', $this->platform->getTimeTypeDeclarationSQL($fullColumnDef)); + self::assertEquals('UNIQUEIDENTIFIER', $this->platform->getGuidTypeDeclarationSQL($fullColumnDef)); - self::assertEquals(1, $this->_platform->getVarcharDefaultLength()); - self::assertEquals(32767, $this->_platform->getVarcharMaxLength()); + self::assertEquals(1, $this->platform->getVarcharDefaultLength()); + self::assertEquals(32767, $this->platform->getVarcharMaxLength()); } public function testHasNativeGuidType() { - self::assertTrue($this->_platform->hasNativeGuidType()); + self::assertTrue($this->platform->hasNativeGuidType()); } public function testGeneratesDDLSnippets() { - self::assertEquals("CREATE DATABASE 'foobar'", $this->_platform->getCreateDatabaseSQL('foobar')); - self::assertEquals("CREATE DATABASE 'foobar'", $this->_platform->getCreateDatabaseSQL('"foobar"')); - self::assertEquals("CREATE DATABASE 'create'", $this->_platform->getCreateDatabaseSQL('create')); - self::assertEquals("DROP DATABASE 'foobar'", $this->_platform->getDropDatabaseSQL('foobar')); - self::assertEquals("DROP DATABASE 'foobar'", $this->_platform->getDropDatabaseSQL('"foobar"')); - self::assertEquals("DROP DATABASE 'create'", $this->_platform->getDropDatabaseSQL('create')); - self::assertEquals('CREATE GLOBAL TEMPORARY TABLE', $this->_platform->getCreateTemporaryTableSnippetSQL()); - self::assertEquals("START DATABASE 'foobar' AUTOSTOP OFF", $this->_platform->getStartDatabaseSQL('foobar')); - self::assertEquals("START DATABASE 'foobar' AUTOSTOP OFF", $this->_platform->getStartDatabaseSQL('"foobar"')); - self::assertEquals("START DATABASE 'create' AUTOSTOP OFF", $this->_platform->getStartDatabaseSQL('create')); - self::assertEquals('STOP DATABASE "foobar" UNCONDITIONALLY', $this->_platform->getStopDatabaseSQL('foobar')); - self::assertEquals('STOP DATABASE "foobar" UNCONDITIONALLY', $this->_platform->getStopDatabaseSQL('"foobar"')); - self::assertEquals('STOP DATABASE "create" UNCONDITIONALLY', $this->_platform->getStopDatabaseSQL('create')); - self::assertEquals('TRUNCATE TABLE foobar', $this->_platform->getTruncateTableSQL('foobar')); - self::assertEquals('TRUNCATE TABLE foobar', $this->_platform->getTruncateTableSQL('foobar'), true); + self::assertEquals("CREATE DATABASE 'foobar'", $this->platform->getCreateDatabaseSQL('foobar')); + self::assertEquals("CREATE DATABASE 'foobar'", $this->platform->getCreateDatabaseSQL('"foobar"')); + self::assertEquals("CREATE DATABASE 'create'", $this->platform->getCreateDatabaseSQL('create')); + self::assertEquals("DROP DATABASE 'foobar'", $this->platform->getDropDatabaseSQL('foobar')); + self::assertEquals("DROP DATABASE 'foobar'", $this->platform->getDropDatabaseSQL('"foobar"')); + self::assertEquals("DROP DATABASE 'create'", $this->platform->getDropDatabaseSQL('create')); + self::assertEquals('CREATE GLOBAL TEMPORARY TABLE', $this->platform->getCreateTemporaryTableSnippetSQL()); + self::assertEquals("START DATABASE 'foobar' AUTOSTOP OFF", $this->platform->getStartDatabaseSQL('foobar')); + self::assertEquals("START DATABASE 'foobar' AUTOSTOP OFF", $this->platform->getStartDatabaseSQL('"foobar"')); + self::assertEquals("START DATABASE 'create' AUTOSTOP OFF", $this->platform->getStartDatabaseSQL('create')); + self::assertEquals('STOP DATABASE "foobar" UNCONDITIONALLY', $this->platform->getStopDatabaseSQL('foobar')); + self::assertEquals('STOP DATABASE "foobar" UNCONDITIONALLY', $this->platform->getStopDatabaseSQL('"foobar"')); + self::assertEquals('STOP DATABASE "create" UNCONDITIONALLY', $this->platform->getStopDatabaseSQL('create')); + self::assertEquals('TRUNCATE TABLE foobar', $this->platform->getTruncateTableSQL('foobar')); + self::assertEquals('TRUNCATE TABLE foobar', $this->platform->getTruncateTableSQL('foobar'), true); $viewSql = 'SELECT * FROM footable'; - self::assertEquals('CREATE VIEW fooview AS ' . $viewSql, $this->_platform->getCreateViewSQL('fooview', $viewSql)); - self::assertEquals('DROP VIEW fooview', $this->_platform->getDropViewSQL('fooview')); + self::assertEquals('CREATE VIEW fooview AS ' . $viewSql, $this->platform->getCreateViewSQL('fooview', $viewSql)); + self::assertEquals('DROP VIEW fooview', $this->platform->getDropViewSQL('fooview')); } public function testGeneratesPrimaryKeyDeclarationSQL() { self::assertEquals( 'CONSTRAINT pk PRIMARY KEY CLUSTERED (a, b)', - $this->_platform->getPrimaryKeyDeclarationSQL( + $this->platform->getPrimaryKeyDeclarationSQL( new Index(null, array('a', 'b'), true, true, array('clustered')), 'pk' ) ); self::assertEquals( 'PRIMARY KEY (a, b)', - $this->_platform->getPrimaryKeyDeclarationSQL( + $this->platform->getPrimaryKeyDeclarationSQL( new Index(null, array('a', 'b'), true, true) ) ); @@ -343,21 +343,21 @@ public function testCannotGeneratePrimaryKeyDeclarationSQLWithEmptyColumns() { $this->expectException('\InvalidArgumentException'); - $this->_platform->getPrimaryKeyDeclarationSQL(new Index('pk', array(), true, true)); + $this->platform->getPrimaryKeyDeclarationSQL(new Index('pk', array(), true, true)); } public function testGeneratesCreateUnnamedPrimaryKeySQL() { self::assertEquals( 'ALTER TABLE foo ADD PRIMARY KEY CLUSTERED (a, b)', - $this->_platform->getCreatePrimaryKeySQL( + $this->platform->getCreatePrimaryKeySQL( new Index('pk', array('a', 'b'), true, true, array('clustered')), 'foo' ) ); self::assertEquals( 'ALTER TABLE foo ADD PRIMARY KEY (a, b)', - $this->_platform->getCreatePrimaryKeySQL( + $this->platform->getCreatePrimaryKeySQL( new Index('any_pk_name', array('a', 'b'), true, true), new Table('foo') ) @@ -368,14 +368,14 @@ public function testGeneratesUniqueConstraintDeclarationSQL() { self::assertEquals( 'CONSTRAINT unique_constraint UNIQUE CLUSTERED (a, b)', - $this->_platform->getUniqueConstraintDeclarationSQL( + $this->platform->getUniqueConstraintDeclarationSQL( 'unique_constraint', new UniqueConstraint(null, array('a', 'b'), array('clustered')) ) ); self::assertEquals( 'CONSTRAINT UNIQUE (a, b)', - $this->_platform->getUniqueConstraintDeclarationSQL(null, new UniqueConstraint(null, array('a', 'b'))) + $this->platform->getUniqueConstraintDeclarationSQL(null, new UniqueConstraint(null, array('a', 'b'))) ); } @@ -383,7 +383,7 @@ public function testCannotGenerateUniqueConstraintDeclarationSQLWithEmptyColumns { $this->expectException('\InvalidArgumentException'); - $this->_platform->getUniqueConstraintDeclarationSQL('constr', new UniqueConstraint('constr', array())); + $this->platform->getUniqueConstraintDeclarationSQL('constr', new UniqueConstraint('constr', array())); } public function testGeneratesForeignKeyConstraintsWithAdvancedPlatformOptionsSQL() @@ -393,7 +393,7 @@ public function testGeneratesForeignKeyConstraintsWithAdvancedPlatformOptionsSQL 'NOT NULL FOREIGN KEY (a, b) ' . 'REFERENCES foreign_table (c, d) ' . 'MATCH UNIQUE SIMPLE ON UPDATE CASCADE ON DELETE SET NULL CHECK ON COMMIT CLUSTERED FOR OLAP WORKLOAD', - $this->_platform->getForeignKeyDeclarationSQL( + $this->platform->getForeignKeyDeclarationSQL( new ForeignKeyConstraint(array('a', 'b'), 'foreign_table', array('c', 'd'), 'fk', array( 'notnull' => true, 'match' => SQLAnywherePlatform::FOREIGN_KEY_MATCH_SIMPLE_UNIQUE, @@ -407,7 +407,7 @@ public function testGeneratesForeignKeyConstraintsWithAdvancedPlatformOptionsSQL ); self::assertEquals( 'FOREIGN KEY (a, b) REFERENCES foreign_table (c, d)', - $this->_platform->getForeignKeyDeclarationSQL( + $this->platform->getForeignKeyDeclarationSQL( new ForeignKeyConstraint(array('a', 'b'), 'foreign_table', array('c', 'd')) ) ); @@ -415,56 +415,56 @@ public function testGeneratesForeignKeyConstraintsWithAdvancedPlatformOptionsSQL public function testGeneratesForeignKeyMatchClausesSQL() { - self::assertEquals('SIMPLE', $this->_platform->getForeignKeyMatchClauseSQL(1)); - self::assertEquals('FULL', $this->_platform->getForeignKeyMatchClauseSQL(2)); - self::assertEquals('UNIQUE SIMPLE', $this->_platform->getForeignKeyMatchClauseSQL(129)); - self::assertEquals('UNIQUE FULL', $this->_platform->getForeignKeyMatchClauseSQL(130)); + self::assertEquals('SIMPLE', $this->platform->getForeignKeyMatchClauseSQL(1)); + self::assertEquals('FULL', $this->platform->getForeignKeyMatchClauseSQL(2)); + self::assertEquals('UNIQUE SIMPLE', $this->platform->getForeignKeyMatchClauseSQL(129)); + self::assertEquals('UNIQUE FULL', $this->platform->getForeignKeyMatchClauseSQL(130)); } public function testCannotGenerateInvalidForeignKeyMatchClauseSQL() { $this->expectException('\InvalidArgumentException'); - $this->_platform->getForeignKeyMatchCLauseSQL(3); + $this->platform->getForeignKeyMatchCLauseSQL(3); } public function testCannotGenerateForeignKeyConstraintSQLWithEmptyLocalColumns() { $this->expectException('\InvalidArgumentException'); - $this->_platform->getForeignKeyDeclarationSQL(new ForeignKeyConstraint(array(), 'foreign_tbl', array('c', 'd'))); + $this->platform->getForeignKeyDeclarationSQL(new ForeignKeyConstraint(array(), 'foreign_tbl', array('c', 'd'))); } public function testCannotGenerateForeignKeyConstraintSQLWithEmptyForeignColumns() { $this->expectException('\InvalidArgumentException'); - $this->_platform->getForeignKeyDeclarationSQL(new ForeignKeyConstraint(array('a', 'b'), 'foreign_tbl', array())); + $this->platform->getForeignKeyDeclarationSQL(new ForeignKeyConstraint(array('a', 'b'), 'foreign_tbl', array())); } public function testCannotGenerateForeignKeyConstraintSQLWithEmptyForeignTableName() { $this->expectException('\InvalidArgumentException'); - $this->_platform->getForeignKeyDeclarationSQL(new ForeignKeyConstraint(array('a', 'b'), '', array('c', 'd'))); + $this->platform->getForeignKeyDeclarationSQL(new ForeignKeyConstraint(array('a', 'b'), '', array('c', 'd'))); } public function testCannotGenerateCommonIndexWithCreateConstraintSQL() { $this->expectException('\InvalidArgumentException'); - $this->_platform->getCreateConstraintSQL(new Index('fooindex', array()), new Table('footable')); + $this->platform->getCreateConstraintSQL(new Index('fooindex', array()), new Table('footable')); } public function testCannotGenerateCustomConstraintWithCreateConstraintSQL() { $this->expectException('\InvalidArgumentException'); - $this->_platform->getCreateConstraintSQL($this->createMock('\Doctrine\DBAL\Schema\Constraint'), 'footable'); + $this->platform->getCreateConstraintSQL($this->createMock('\Doctrine\DBAL\Schema\Constraint'), 'footable'); } public function testGeneratesCreateIndexWithAdvancedPlatformOptionsSQL() { self::assertEquals( 'CREATE VIRTUAL UNIQUE CLUSTERED INDEX fooindex ON footable (a, b) FOR OLAP WORKLOAD', - $this->_platform->getCreateIndexSQL( + $this->platform->getCreateIndexSQL( new Index( 'fooindex', array('a', 'b'), @@ -481,16 +481,16 @@ public function testDoesNotSupportIndexDeclarationInCreateAlterTableStatements() { $this->expectException('\Doctrine\DBAL\DBALException'); - $this->_platform->getIndexDeclarationSQL('index', new Index('index', array())); + $this->platform->getIndexDeclarationSQL('index', new Index('index', array())); } public function testGeneratesDropIndexSQL() { $index = new Index('fooindex', array()); - self::assertEquals('DROP INDEX fooindex', $this->_platform->getDropIndexSQL($index)); - self::assertEquals('DROP INDEX footable.fooindex', $this->_platform->getDropIndexSQL($index, 'footable')); - self::assertEquals('DROP INDEX footable.fooindex', $this->_platform->getDropIndexSQL( + self::assertEquals('DROP INDEX fooindex', $this->platform->getDropIndexSQL($index)); + self::assertEquals('DROP INDEX footable.fooindex', $this->platform->getDropIndexSQL($index, 'footable')); + self::assertEquals('DROP INDEX footable.fooindex', $this->platform->getDropIndexSQL( $index, new Table('footable') )); @@ -500,87 +500,87 @@ public function testCannotGenerateDropIndexSQLWithInvalidIndexParameter() { $this->expectException('\InvalidArgumentException'); - $this->_platform->getDropIndexSQL(array('index'), 'table'); + $this->platform->getDropIndexSQL(array('index'), 'table'); } public function testCannotGenerateDropIndexSQLWithInvalidTableParameter() { $this->expectException('\InvalidArgumentException'); - $this->_platform->getDropIndexSQL('index', array('table')); + $this->platform->getDropIndexSQL('index', array('table')); } public function testGeneratesSQLSnippets() { - self::assertEquals('STRING(column1, "string1", column2, "string2")', $this->_platform->getConcatExpression( + self::assertEquals('STRING(column1, "string1", column2, "string2")', $this->platform->getConcatExpression( 'column1', '"string1"', 'column2', '"string2"' )); - self::assertEquals('CURRENT DATE', $this->_platform->getCurrentDateSQL()); - self::assertEquals('CURRENT TIME', $this->_platform->getCurrentTimeSQL()); - self::assertEquals('CURRENT TIMESTAMP', $this->_platform->getCurrentTimestampSQL()); - self::assertEquals("DATEADD(DAY, 4, '1987/05/02')", $this->_platform->getDateAddDaysExpression("'1987/05/02'", 4)); - self::assertEquals("DATEADD(HOUR, 12, '1987/05/02')", $this->_platform->getDateAddHourExpression("'1987/05/02'", 12)); - self::assertEquals("DATEADD(MINUTE, 2, '1987/05/02')", $this->_platform->getDateAddMinutesExpression("'1987/05/02'", 2)); - self::assertEquals("DATEADD(MONTH, 102, '1987/05/02')", $this->_platform->getDateAddMonthExpression("'1987/05/02'", 102)); - self::assertEquals("DATEADD(QUARTER, 5, '1987/05/02')", $this->_platform->getDateAddQuartersExpression("'1987/05/02'", 5)); - self::assertEquals("DATEADD(SECOND, 1, '1987/05/02')", $this->_platform->getDateAddSecondsExpression("'1987/05/02'", 1)); - self::assertEquals("DATEADD(WEEK, 3, '1987/05/02')", $this->_platform->getDateAddWeeksExpression("'1987/05/02'", 3)); - self::assertEquals("DATEADD(YEAR, 10, '1987/05/02')", $this->_platform->getDateAddYearsExpression("'1987/05/02'", 10)); - self::assertEquals("DATEDIFF(day, '1987/04/01', '1987/05/02')", $this->_platform->getDateDiffExpression("'1987/05/02'", "'1987/04/01'")); - self::assertEquals("DATEADD(DAY, -1 * 4, '1987/05/02')", $this->_platform->getDateSubDaysExpression("'1987/05/02'", 4)); - self::assertEquals("DATEADD(HOUR, -1 * 12, '1987/05/02')", $this->_platform->getDateSubHourExpression("'1987/05/02'", 12)); - self::assertEquals("DATEADD(MINUTE, -1 * 2, '1987/05/02')", $this->_platform->getDateSubMinutesExpression("'1987/05/02'", 2)); - self::assertEquals("DATEADD(MONTH, -1 * 102, '1987/05/02')", $this->_platform->getDateSubMonthExpression("'1987/05/02'", 102)); - self::assertEquals("DATEADD(QUARTER, -1 * 5, '1987/05/02')", $this->_platform->getDateSubQuartersExpression("'1987/05/02'", 5)); - self::assertEquals("DATEADD(SECOND, -1 * 1, '1987/05/02')", $this->_platform->getDateSubSecondsExpression("'1987/05/02'", 1)); - self::assertEquals("DATEADD(WEEK, -1 * 3, '1987/05/02')", $this->_platform->getDateSubWeeksExpression("'1987/05/02'", 3)); - self::assertEquals("DATEADD(YEAR, -1 * 10, '1987/05/02')", $this->_platform->getDateSubYearsExpression("'1987/05/02'", 10)); - self::assertEquals("Y-m-d H:i:s.u", $this->_platform->getDateTimeFormatString()); - self::assertEquals("H:i:s.u", $this->_platform->getTimeFormatString()); - self::assertEquals('', $this->_platform->getForUpdateSQL()); - self::assertEquals('NEWID()', $this->_platform->getGuidExpression()); - self::assertEquals('LOCATE(string_column, substring_column)', $this->_platform->getLocateExpression('string_column', 'substring_column')); - self::assertEquals('LOCATE(string_column, substring_column, 1)', $this->_platform->getLocateExpression('string_column', 'substring_column', 1)); - self::assertEquals("HASH(column, 'MD5')", $this->_platform->getMd5Expression('column')); - self::assertEquals('SUBSTRING(column, 5)', $this->_platform->getSubstringExpression('column', 5)); - self::assertEquals('SUBSTRING(column, 5, 2)', $this->_platform->getSubstringExpression('column', 5, 2)); - self::assertEquals('GLOBAL TEMPORARY', $this->_platform->getTemporaryTableSQL()); + self::assertEquals('CURRENT DATE', $this->platform->getCurrentDateSQL()); + self::assertEquals('CURRENT TIME', $this->platform->getCurrentTimeSQL()); + self::assertEquals('CURRENT TIMESTAMP', $this->platform->getCurrentTimestampSQL()); + self::assertEquals("DATEADD(DAY, 4, '1987/05/02')", $this->platform->getDateAddDaysExpression("'1987/05/02'", 4)); + self::assertEquals("DATEADD(HOUR, 12, '1987/05/02')", $this->platform->getDateAddHourExpression("'1987/05/02'", 12)); + self::assertEquals("DATEADD(MINUTE, 2, '1987/05/02')", $this->platform->getDateAddMinutesExpression("'1987/05/02'", 2)); + self::assertEquals("DATEADD(MONTH, 102, '1987/05/02')", $this->platform->getDateAddMonthExpression("'1987/05/02'", 102)); + self::assertEquals("DATEADD(QUARTER, 5, '1987/05/02')", $this->platform->getDateAddQuartersExpression("'1987/05/02'", 5)); + self::assertEquals("DATEADD(SECOND, 1, '1987/05/02')", $this->platform->getDateAddSecondsExpression("'1987/05/02'", 1)); + self::assertEquals("DATEADD(WEEK, 3, '1987/05/02')", $this->platform->getDateAddWeeksExpression("'1987/05/02'", 3)); + self::assertEquals("DATEADD(YEAR, 10, '1987/05/02')", $this->platform->getDateAddYearsExpression("'1987/05/02'", 10)); + self::assertEquals("DATEDIFF(day, '1987/04/01', '1987/05/02')", $this->platform->getDateDiffExpression("'1987/05/02'", "'1987/04/01'")); + self::assertEquals("DATEADD(DAY, -1 * 4, '1987/05/02')", $this->platform->getDateSubDaysExpression("'1987/05/02'", 4)); + self::assertEquals("DATEADD(HOUR, -1 * 12, '1987/05/02')", $this->platform->getDateSubHourExpression("'1987/05/02'", 12)); + self::assertEquals("DATEADD(MINUTE, -1 * 2, '1987/05/02')", $this->platform->getDateSubMinutesExpression("'1987/05/02'", 2)); + self::assertEquals("DATEADD(MONTH, -1 * 102, '1987/05/02')", $this->platform->getDateSubMonthExpression("'1987/05/02'", 102)); + self::assertEquals("DATEADD(QUARTER, -1 * 5, '1987/05/02')", $this->platform->getDateSubQuartersExpression("'1987/05/02'", 5)); + self::assertEquals("DATEADD(SECOND, -1 * 1, '1987/05/02')", $this->platform->getDateSubSecondsExpression("'1987/05/02'", 1)); + self::assertEquals("DATEADD(WEEK, -1 * 3, '1987/05/02')", $this->platform->getDateSubWeeksExpression("'1987/05/02'", 3)); + self::assertEquals("DATEADD(YEAR, -1 * 10, '1987/05/02')", $this->platform->getDateSubYearsExpression("'1987/05/02'", 10)); + self::assertEquals("Y-m-d H:i:s.u", $this->platform->getDateTimeFormatString()); + self::assertEquals("H:i:s.u", $this->platform->getTimeFormatString()); + self::assertEquals('', $this->platform->getForUpdateSQL()); + self::assertEquals('NEWID()', $this->platform->getGuidExpression()); + self::assertEquals('LOCATE(string_column, substring_column)', $this->platform->getLocateExpression('string_column', 'substring_column')); + self::assertEquals('LOCATE(string_column, substring_column, 1)', $this->platform->getLocateExpression('string_column', 'substring_column', 1)); + self::assertEquals("HASH(column, 'MD5')", $this->platform->getMd5Expression('column')); + self::assertEquals('SUBSTRING(column, 5)', $this->platform->getSubstringExpression('column', 5)); + self::assertEquals('SUBSTRING(column, 5, 2)', $this->platform->getSubstringExpression('column', 5, 2)); + self::assertEquals('GLOBAL TEMPORARY', $this->platform->getTemporaryTableSQL()); self::assertEquals( 'LTRIM(column)', - $this->_platform->getTrimExpression('column', AbstractPlatform::TRIM_LEADING) + $this->platform->getTrimExpression('column', AbstractPlatform::TRIM_LEADING) ); self::assertEquals( 'RTRIM(column)', - $this->_platform->getTrimExpression('column', AbstractPlatform::TRIM_TRAILING) + $this->platform->getTrimExpression('column', AbstractPlatform::TRIM_TRAILING) ); self::assertEquals( 'TRIM(column)', - $this->_platform->getTrimExpression('column') + $this->platform->getTrimExpression('column') ); self::assertEquals( 'TRIM(column)', - $this->_platform->getTrimExpression('column', AbstractPlatform::TRIM_UNSPECIFIED) + $this->platform->getTrimExpression('column', AbstractPlatform::TRIM_UNSPECIFIED) ); self::assertEquals( "SUBSTR(column, PATINDEX('%[^' + c + ']%', column))", - $this->_platform->getTrimExpression('column', AbstractPlatform::TRIM_LEADING, 'c') + $this->platform->getTrimExpression('column', AbstractPlatform::TRIM_LEADING, 'c') ); self::assertEquals( "REVERSE(SUBSTR(REVERSE(column), PATINDEX('%[^' + c + ']%', REVERSE(column))))", - $this->_platform->getTrimExpression('column', AbstractPlatform::TRIM_TRAILING, 'c') + $this->platform->getTrimExpression('column', AbstractPlatform::TRIM_TRAILING, 'c') ); self::assertEquals( "REVERSE(SUBSTR(REVERSE(SUBSTR(column, PATINDEX('%[^' + c + ']%', column))), PATINDEX('%[^' + c + ']%', " . "REVERSE(SUBSTR(column, PATINDEX('%[^' + c + ']%', column))))))", - $this->_platform->getTrimExpression('column', null, 'c') + $this->platform->getTrimExpression('column', null, 'c') ); self::assertEquals( "REVERSE(SUBSTR(REVERSE(SUBSTR(column, PATINDEX('%[^' + c + ']%', column))), PATINDEX('%[^' + c + ']%', " . "REVERSE(SUBSTR(column, PATINDEX('%[^' + c + ']%', column))))))", - $this->_platform->getTrimExpression('column', AbstractPlatform::TRIM_UNSPECIFIED, 'c') + $this->platform->getTrimExpression('column', AbstractPlatform::TRIM_UNSPECIFIED, 'c') ); } @@ -588,7 +588,7 @@ public function testDoesNotSupportRegexp() { $this->expectException('\Doctrine\DBAL\DBALException'); - $this->_platform->getRegexpExpression(); + $this->platform->getRegexpExpression(); } public function testHasCorrectDateTimeTzFormatString() @@ -596,14 +596,14 @@ public function testHasCorrectDateTimeTzFormatString() // Date time type with timezone is not supported before version 12. // For versions before we have to ensure that the date time with timezone format // equals the normal date time format so that it corresponds to the declaration SQL equality (datetimetz -> datetime). - self::assertEquals($this->_platform->getDateTimeFormatString(), $this->_platform->getDateTimeTzFormatString()); + self::assertEquals($this->platform->getDateTimeFormatString(), $this->platform->getDateTimeTzFormatString()); } public function testHasCorrectDefaultTransactionIsolationLevel() { self::assertEquals( Connection::TRANSACTION_READ_UNCOMMITTED, - $this->_platform->getDefaultTransactionIsolationLevel() + $this->platform->getDefaultTransactionIsolationLevel() ); } @@ -611,19 +611,19 @@ public function testGeneratesTransactionsCommands() { self::assertEquals( 'SET TEMPORARY OPTION isolation_level = 0', - $this->_platform->getSetTransactionIsolationSQL(Connection::TRANSACTION_READ_UNCOMMITTED) + $this->platform->getSetTransactionIsolationSQL(Connection::TRANSACTION_READ_UNCOMMITTED) ); self::assertEquals( 'SET TEMPORARY OPTION isolation_level = 1', - $this->_platform->getSetTransactionIsolationSQL(Connection::TRANSACTION_READ_COMMITTED) + $this->platform->getSetTransactionIsolationSQL(Connection::TRANSACTION_READ_COMMITTED) ); self::assertEquals( 'SET TEMPORARY OPTION isolation_level = 2', - $this->_platform->getSetTransactionIsolationSQL(Connection::TRANSACTION_REPEATABLE_READ) + $this->platform->getSetTransactionIsolationSQL(Connection::TRANSACTION_REPEATABLE_READ) ); self::assertEquals( 'SET TEMPORARY OPTION isolation_level = 3', - $this->_platform->getSetTransactionIsolationSQL(Connection::TRANSACTION_SERIALIZABLE) + $this->platform->getSetTransactionIsolationSQL(Connection::TRANSACTION_SERIALIZABLE) ); } @@ -631,14 +631,14 @@ public function testCannotGenerateTransactionCommandWithInvalidIsolationLevel() { $this->expectException('\InvalidArgumentException'); - $this->_platform->getSetTransactionIsolationSQL('invalid_transaction_isolation_level'); + $this->platform->getSetTransactionIsolationSQL('invalid_transaction_isolation_level'); } public function testModifiesLimitQuery() { self::assertEquals( 'SELECT TOP 10 * FROM user', - $this->_platform->modifyLimitQuery('SELECT * FROM user', 10, 0) + $this->platform->modifyLimitQuery('SELECT * FROM user', 10, 0) ); } @@ -646,7 +646,7 @@ public function testModifiesLimitQueryWithEmptyOffset() { self::assertEquals( 'SELECT TOP 10 * FROM user', - $this->_platform->modifyLimitQuery('SELECT * FROM user', 10) + $this->platform->modifyLimitQuery('SELECT * FROM user', 10) ); } @@ -654,11 +654,11 @@ public function testModifiesLimitQueryWithOffset() { self::assertEquals( 'SELECT TOP 10 START AT 6 * FROM user', - $this->_platform->modifyLimitQuery('SELECT * FROM user', 10, 5) + $this->platform->modifyLimitQuery('SELECT * FROM user', 10, 5) ); self::assertEquals( 'SELECT TOP ALL START AT 6 * FROM user', - $this->_platform->modifyLimitQuery('SELECT * FROM user', 0, 5) + $this->platform->modifyLimitQuery('SELECT * FROM user', 0, 5) ); } @@ -666,110 +666,110 @@ public function testModifiesLimitQueryWithSubSelect() { self::assertEquals( 'SELECT TOP 10 * FROM (SELECT u.id as uid, u.name as uname FROM user) AS doctrine_tbl', - $this->_platform->modifyLimitQuery('SELECT * FROM (SELECT u.id as uid, u.name as uname FROM user) AS doctrine_tbl', 10) + $this->platform->modifyLimitQuery('SELECT * FROM (SELECT u.id as uid, u.name as uname FROM user) AS doctrine_tbl', 10) ); } public function testPrefersIdentityColumns() { - self::assertTrue($this->_platform->prefersIdentityColumns()); + self::assertTrue($this->platform->prefersIdentityColumns()); } public function testDoesNotPreferSequences() { - self::assertFalse($this->_platform->prefersSequences()); + self::assertFalse($this->platform->prefersSequences()); } public function testSupportsIdentityColumns() { - self::assertTrue($this->_platform->supportsIdentityColumns()); + self::assertTrue($this->platform->supportsIdentityColumns()); } public function testSupportsPrimaryConstraints() { - self::assertTrue($this->_platform->supportsPrimaryConstraints()); + self::assertTrue($this->platform->supportsPrimaryConstraints()); } public function testSupportsForeignKeyConstraints() { - self::assertTrue($this->_platform->supportsForeignKeyConstraints()); + self::assertTrue($this->platform->supportsForeignKeyConstraints()); } public function testSupportsForeignKeyOnUpdate() { - self::assertTrue($this->_platform->supportsForeignKeyOnUpdate()); + self::assertTrue($this->platform->supportsForeignKeyOnUpdate()); } public function testSupportsAlterTable() { - self::assertTrue($this->_platform->supportsAlterTable()); + self::assertTrue($this->platform->supportsAlterTable()); } public function testSupportsTransactions() { - self::assertTrue($this->_platform->supportsTransactions()); + self::assertTrue($this->platform->supportsTransactions()); } public function testSupportsSchemas() { - self::assertFalse($this->_platform->supportsSchemas()); + self::assertFalse($this->platform->supportsSchemas()); } public function testSupportsIndexes() { - self::assertTrue($this->_platform->supportsIndexes()); + self::assertTrue($this->platform->supportsIndexes()); } public function testSupportsCommentOnStatement() { - self::assertTrue($this->_platform->supportsCommentOnStatement()); + self::assertTrue($this->platform->supportsCommentOnStatement()); } public function testSupportsSavePoints() { - self::assertTrue($this->_platform->supportsSavepoints()); + self::assertTrue($this->platform->supportsSavepoints()); } public function testSupportsReleasePoints() { - self::assertTrue($this->_platform->supportsReleaseSavepoints()); + self::assertTrue($this->platform->supportsReleaseSavepoints()); } public function testSupportsCreateDropDatabase() { - self::assertTrue($this->_platform->supportsCreateDropDatabase()); + self::assertTrue($this->platform->supportsCreateDropDatabase()); } public function testSupportsGettingAffectedRows() { - self::assertTrue($this->_platform->supportsGettingAffectedRows()); + self::assertTrue($this->platform->supportsGettingAffectedRows()); } public function testDoesNotSupportSequences() { - self::assertFalse($this->_platform->supportsSequences()); + self::assertFalse($this->platform->supportsSequences()); } public function testDoesNotSupportInlineColumnComments() { - self::assertFalse($this->_platform->supportsInlineColumnComments()); + self::assertFalse($this->platform->supportsInlineColumnComments()); } public function testCannotEmulateSchemas() { - self::assertFalse($this->_platform->canEmulateSchemas()); + self::assertFalse($this->platform->canEmulateSchemas()); } public function testInitializesDoctrineTypeMappings() { - self::assertTrue($this->_platform->hasDoctrineTypeMappingFor('integer')); - self::assertSame('integer', $this->_platform->getDoctrineTypeMapping('integer')); + self::assertTrue($this->platform->hasDoctrineTypeMappingFor('integer')); + self::assertSame('integer', $this->platform->getDoctrineTypeMapping('integer')); - self::assertTrue($this->_platform->hasDoctrineTypeMappingFor('binary')); - self::assertSame('binary', $this->_platform->getDoctrineTypeMapping('binary')); + self::assertTrue($this->platform->hasDoctrineTypeMappingFor('binary')); + self::assertSame('binary', $this->platform->getDoctrineTypeMapping('binary')); - self::assertTrue($this->_platform->hasDoctrineTypeMappingFor('varbinary')); - self::assertSame('binary', $this->_platform->getDoctrineTypeMapping('varbinary')); + self::assertTrue($this->platform->hasDoctrineTypeMappingFor('varbinary')); + self::assertSame('binary', $this->platform->getDoctrineTypeMapping('varbinary')); } protected function getBinaryDefaultLength() @@ -784,15 +784,15 @@ protected function getBinaryMaxLength() public function testReturnsBinaryTypeDeclarationSQL() { - self::assertSame('VARBINARY(1)', $this->_platform->getBinaryTypeDeclarationSQL(array())); - self::assertSame('VARBINARY(1)', $this->_platform->getBinaryTypeDeclarationSQL(array('length' => 0))); - self::assertSame('VARBINARY(32767)', $this->_platform->getBinaryTypeDeclarationSQL(array('length' => 32767))); - self::assertSame('LONG BINARY', $this->_platform->getBinaryTypeDeclarationSQL(array('length' => 32768))); + self::assertSame('VARBINARY(1)', $this->platform->getBinaryTypeDeclarationSQL(array())); + self::assertSame('VARBINARY(1)', $this->platform->getBinaryTypeDeclarationSQL(array('length' => 0))); + self::assertSame('VARBINARY(32767)', $this->platform->getBinaryTypeDeclarationSQL(array('length' => 32767))); + self::assertSame('LONG BINARY', $this->platform->getBinaryTypeDeclarationSQL(array('length' => 32768))); - self::assertSame('BINARY(1)', $this->_platform->getBinaryTypeDeclarationSQL(array('fixed' => true))); - self::assertSame('BINARY(1)', $this->_platform->getBinaryTypeDeclarationSQL(array('fixed' => true, 'length' => 0))); - self::assertSame('BINARY(32767)', $this->_platform->getBinaryTypeDeclarationSQL(array('fixed' => true, 'length' => 32767))); - self::assertSame('LONG BINARY', $this->_platform->getBinaryTypeDeclarationSQL(array('fixed' => true, 'length' => 32768))); + self::assertSame('BINARY(1)', $this->platform->getBinaryTypeDeclarationSQL(array('fixed' => true))); + self::assertSame('BINARY(1)', $this->platform->getBinaryTypeDeclarationSQL(array('fixed' => true, 'length' => 0))); + self::assertSame('BINARY(32767)', $this->platform->getBinaryTypeDeclarationSQL(array('fixed' => true, 'length' => 32767))); + self::assertSame('LONG BINARY', $this->platform->getBinaryTypeDeclarationSQL(array('fixed' => true, 'length' => 32768))); } /** @@ -868,7 +868,7 @@ protected function getQuotedAlterTableRenameIndexInSchemaSQL() */ public function testReturnsGuidTypeDeclarationSQL() { - self::assertSame('UNIQUEIDENTIFIER', $this->_platform->getGuidTypeDeclarationSQL(array())); + self::assertSame('UNIQUEIDENTIFIER', $this->platform->getGuidTypeDeclarationSQL(array())); } /** @@ -926,7 +926,7 @@ public function testAltersTableColumnCommentWithExplicitlyQuotedIdentifiers() array( 'COMMENT ON COLUMN "foo"."bar" IS \'baz\'', ), - $this->_platform->getAlterTableSQL($tableDiff) + $this->platform->getAlterTableSQL($tableDiff) ); } @@ -1004,7 +1004,7 @@ public function testQuotesSchemaNameInListTableColumnsSQL() { self::assertContains( "'Foo''Bar\\'", - $this->_platform->getListTableColumnsSQL("Foo'Bar\\.baz_table"), + $this->platform->getListTableColumnsSQL("Foo'Bar\\.baz_table"), '', true ); @@ -1015,7 +1015,7 @@ public function testQuotesSchemaNameInListTableColumnsSQL() */ public function testQuotesTableNameInListTableConstraintsSQL() { - self::assertContains("'Foo''Bar\\'", $this->_platform->getListTableConstraintsSQL("Foo'Bar\\"), '', true); + self::assertContains("'Foo''Bar\\'", $this->platform->getListTableConstraintsSQL("Foo'Bar\\"), '', true); } /** @@ -1025,7 +1025,7 @@ public function testQuotesSchemaNameInListTableConstraintsSQL() { self::assertContains( "'Foo''Bar\\'", - $this->_platform->getListTableConstraintsSQL("Foo'Bar\\.baz_table"), + $this->platform->getListTableConstraintsSQL("Foo'Bar\\.baz_table"), '', true ); @@ -1036,7 +1036,7 @@ public function testQuotesSchemaNameInListTableConstraintsSQL() */ public function testQuotesTableNameInListTableForeignKeysSQL() { - self::assertContains("'Foo''Bar\\'", $this->_platform->getListTableForeignKeysSQL("Foo'Bar\\"), '', true); + self::assertContains("'Foo''Bar\\'", $this->platform->getListTableForeignKeysSQL("Foo'Bar\\"), '', true); } /** @@ -1046,7 +1046,7 @@ public function testQuotesSchemaNameInListTableForeignKeysSQL() { self::assertContains( "'Foo''Bar\\'", - $this->_platform->getListTableForeignKeysSQL("Foo'Bar\\.baz_table"), + $this->platform->getListTableForeignKeysSQL("Foo'Bar\\.baz_table"), '', true ); @@ -1057,7 +1057,7 @@ public function testQuotesSchemaNameInListTableForeignKeysSQL() */ public function testQuotesTableNameInListTableIndexesSQL() { - self::assertContains("'Foo''Bar\\'", $this->_platform->getListTableIndexesSQL("Foo'Bar\\"), '', true); + self::assertContains("'Foo''Bar\\'", $this->platform->getListTableIndexesSQL("Foo'Bar\\"), '', true); } /** @@ -1067,7 +1067,7 @@ public function testQuotesSchemaNameInListTableIndexesSQL() { self::assertContains( "'Foo''Bar\\'", - $this->_platform->getListTableIndexesSQL("Foo'Bar\\.baz_table"), + $this->platform->getListTableIndexesSQL("Foo'Bar\\.baz_table"), '', true ); diff --git a/tests/Doctrine/Tests/DBAL/Platforms/SQLServer2008PlatformTest.php b/tests/Doctrine/Tests/DBAL/Platforms/SQLServer2008PlatformTest.php index 3670c4a80a6..d8c334c1e47 100644 --- a/tests/Doctrine/Tests/DBAL/Platforms/SQLServer2008PlatformTest.php +++ b/tests/Doctrine/Tests/DBAL/Platforms/SQLServer2008PlatformTest.php @@ -13,6 +13,6 @@ public function createPlatform() public function testGeneratesTypeDeclarationForDateTimeTz() { - self::assertEquals('DATETIMEOFFSET(6)', $this->_platform->getDateTimeTzTypeDeclarationSQL([])); + self::assertEquals('DATETIMEOFFSET(6)', $this->platform->getDateTimeTzTypeDeclarationSQL([])); } } diff --git a/tests/Doctrine/Tests/DBAL/Platforms/SQLServer2012PlatformTest.php b/tests/Doctrine/Tests/DBAL/Platforms/SQLServer2012PlatformTest.php index 69e0840b629..b959c136d8e 100644 --- a/tests/Doctrine/Tests/DBAL/Platforms/SQLServer2012PlatformTest.php +++ b/tests/Doctrine/Tests/DBAL/Platforms/SQLServer2012PlatformTest.php @@ -14,12 +14,12 @@ public function createPlatform() public function testSupportsSequences() { - self::assertTrue($this->_platform->supportsSequences()); + self::assertTrue($this->platform->supportsSequences()); } public function testDoesNotPreferSequences() { - self::assertFalse($this->_platform->prefersSequences()); + self::assertFalse($this->platform->prefersSequences()); } public function testGeneratesSequenceSqlCommands() @@ -27,95 +27,95 @@ public function testGeneratesSequenceSqlCommands() $sequence = new Sequence('myseq', 20, 1); self::assertEquals( 'CREATE SEQUENCE myseq START WITH 1 INCREMENT BY 20 MINVALUE 1', - $this->_platform->getCreateSequenceSQL($sequence) + $this->platform->getCreateSequenceSQL($sequence) ); self::assertEquals( 'ALTER SEQUENCE myseq INCREMENT BY 20', - $this->_platform->getAlterSequenceSQL($sequence) + $this->platform->getAlterSequenceSQL($sequence) ); self::assertEquals( 'DROP SEQUENCE myseq', - $this->_platform->getDropSequenceSQL('myseq') + $this->platform->getDropSequenceSQL('myseq') ); self::assertEquals( "SELECT NEXT VALUE FOR myseq", - $this->_platform->getSequenceNextValSQL('myseq') + $this->platform->getSequenceNextValSQL('myseq') ); } public function testModifyLimitQuery() { - $sql = $this->_platform->modifyLimitQuery('SELECT * FROM user', 10, 0); + $sql = $this->platform->modifyLimitQuery('SELECT * FROM user', 10, 0); self::assertEquals('SELECT * FROM user ORDER BY (SELECT 0) OFFSET 0 ROWS FETCH NEXT 10 ROWS ONLY', $sql); } public function testModifyLimitQueryWithEmptyOffset() { - $sql = $this->_platform->modifyLimitQuery('SELECT * FROM user', 10); + $sql = $this->platform->modifyLimitQuery('SELECT * FROM user', 10); self::assertEquals('SELECT * FROM user ORDER BY (SELECT 0) OFFSET 0 ROWS FETCH NEXT 10 ROWS ONLY', $sql); } public function testModifyLimitQueryWithOffset() { - $sql = $this->_platform->modifyLimitQuery('SELECT * FROM user ORDER BY username DESC', 10, 5); + $sql = $this->platform->modifyLimitQuery('SELECT * FROM user ORDER BY username DESC', 10, 5); self::assertEquals('SELECT * FROM user ORDER BY username DESC OFFSET 5 ROWS FETCH NEXT 10 ROWS ONLY', $sql); } public function testModifyLimitQueryWithAscOrderBy() { - $sql = $this->_platform->modifyLimitQuery('SELECT * FROM user ORDER BY username ASC', 10); + $sql = $this->platform->modifyLimitQuery('SELECT * FROM user ORDER BY username ASC', 10); self::assertEquals('SELECT * FROM user ORDER BY username ASC OFFSET 0 ROWS FETCH NEXT 10 ROWS ONLY', $sql); } public function testModifyLimitQueryWithLowercaseOrderBy() { - $sql = $this->_platform->modifyLimitQuery('SELECT * FROM user order by username', 10); + $sql = $this->platform->modifyLimitQuery('SELECT * FROM user order by username', 10); self::assertEquals('SELECT * FROM user order by username OFFSET 0 ROWS FETCH NEXT 10 ROWS ONLY', $sql); } public function testModifyLimitQueryWithDescOrderBy() { - $sql = $this->_platform->modifyLimitQuery('SELECT * FROM user ORDER BY username DESC', 10); + $sql = $this->platform->modifyLimitQuery('SELECT * FROM user ORDER BY username DESC', 10); self::assertEquals('SELECT * FROM user ORDER BY username DESC OFFSET 0 ROWS FETCH NEXT 10 ROWS ONLY', $sql); } public function testModifyLimitQueryWithMultipleOrderBy() { - $sql = $this->_platform->modifyLimitQuery('SELECT * FROM user ORDER BY username DESC, usereamil ASC', 10); + $sql = $this->platform->modifyLimitQuery('SELECT * FROM user ORDER BY username DESC, usereamil ASC', 10); self::assertEquals('SELECT * FROM user ORDER BY username DESC, usereamil ASC OFFSET 0 ROWS FETCH NEXT 10 ROWS ONLY', $sql); } public function testModifyLimitQueryWithSubSelect() { - $sql = $this->_platform->modifyLimitQuery('SELECT * FROM (SELECT u.id as uid, u.name as uname) dctrn_result', 10); + $sql = $this->platform->modifyLimitQuery('SELECT * FROM (SELECT u.id as uid, u.name as uname) dctrn_result', 10); self::assertEquals('SELECT * FROM (SELECT u.id as uid, u.name as uname) dctrn_result ORDER BY (SELECT 0) OFFSET 0 ROWS FETCH NEXT 10 ROWS ONLY', $sql); } public function testModifyLimitQueryWithSubSelectAndOrder() { - $sql = $this->_platform->modifyLimitQuery('SELECT * FROM (SELECT u.id as uid, u.name as uname) dctrn_result ORDER BY uname DESC', 10); + $sql = $this->platform->modifyLimitQuery('SELECT * FROM (SELECT u.id as uid, u.name as uname) dctrn_result ORDER BY uname DESC', 10); self::assertEquals('SELECT * FROM (SELECT u.id as uid, u.name as uname) dctrn_result ORDER BY uname DESC OFFSET 0 ROWS FETCH NEXT 10 ROWS ONLY', $sql); - $sql = $this->_platform->modifyLimitQuery('SELECT * FROM (SELECT u.id, u.name) dctrn_result ORDER BY name DESC', 10); + $sql = $this->platform->modifyLimitQuery('SELECT * FROM (SELECT u.id, u.name) dctrn_result ORDER BY name DESC', 10); self::assertEquals('SELECT * FROM (SELECT u.id, u.name) dctrn_result ORDER BY name DESC OFFSET 0 ROWS FETCH NEXT 10 ROWS ONLY', $sql); } public function testModifyLimitQueryWithSubSelectAndMultipleOrder() { - $sql = $this->_platform->modifyLimitQuery('SELECT * FROM (SELECT u.id as uid, u.name as uname) dctrn_result ORDER BY uname DESC, uid ASC', 10, 5); + $sql = $this->platform->modifyLimitQuery('SELECT * FROM (SELECT u.id as uid, u.name as uname) dctrn_result ORDER BY uname DESC, uid ASC', 10, 5); self::assertEquals('SELECT * FROM (SELECT u.id as uid, u.name as uname) dctrn_result ORDER BY uname DESC, uid ASC OFFSET 5 ROWS FETCH NEXT 10 ROWS ONLY', $sql); - $sql = $this->_platform->modifyLimitQuery('SELECT * FROM (SELECT u.id uid, u.name uname) dctrn_result ORDER BY uname DESC, uid ASC', 10, 5); + $sql = $this->platform->modifyLimitQuery('SELECT * FROM (SELECT u.id uid, u.name uname) dctrn_result ORDER BY uname DESC, uid ASC', 10, 5); self::assertEquals('SELECT * FROM (SELECT u.id uid, u.name uname) dctrn_result ORDER BY uname DESC, uid ASC OFFSET 5 ROWS FETCH NEXT 10 ROWS ONLY', $sql); - $sql = $this->_platform->modifyLimitQuery('SELECT * FROM (SELECT u.id, u.name) dctrn_result ORDER BY name DESC, id ASC', 10, 5); + $sql = $this->platform->modifyLimitQuery('SELECT * FROM (SELECT u.id, u.name) dctrn_result ORDER BY name DESC, id ASC', 10, 5); self::assertEquals('SELECT * FROM (SELECT u.id, u.name) dctrn_result ORDER BY name DESC, id ASC OFFSET 5 ROWS FETCH NEXT 10 ROWS ONLY', $sql); } public function testModifyLimitQueryWithFromColumnNames() { - $sql = $this->_platform->modifyLimitQuery('SELECT a.fromFoo, fromBar FROM foo', 10); + $sql = $this->platform->modifyLimitQuery('SELECT a.fromFoo, fromBar FROM foo', 10); self::assertEquals('SELECT a.fromFoo, fromBar FROM foo ORDER BY (SELECT 0) OFFSET 0 ROWS FETCH NEXT 10 ROWS ONLY', $sql); } @@ -129,7 +129,7 @@ public function testModifyLimitQueryWithExtraLongQuery() $query.= 'AND (table2.column2 = table7.column7) AND (table2.column2 = table8.column8) AND (table3.column3 = table4.column4) AND (table3.column3 = table5.column5) AND (table3.column3 = table6.column6) AND (table3.column3 = table7.column7) AND (table3.column3 = table8.column8) AND (table4.column4 = table5.column5) AND (table4.column4 = table6.column6) AND (table4.column4 = table7.column7) AND (table4.column4 = table8.column8) '; $query.= 'AND (table5.column5 = table6.column6) AND (table5.column5 = table7.column7) AND (table5.column5 = table8.column8) AND (table6.column6 = table7.column7) AND (table6.column6 = table8.column8) AND (table7.column7 = table8.column8)'; - $sql = $this->_platform->modifyLimitQuery($query, 10); + $sql = $this->platform->modifyLimitQuery($query, 10); $expected = 'SELECT table1.column1, table2.column2, table3.column3, table4.column4, table5.column5, table6.column6, table7.column7, table8.column8 FROM table1, table2, table3, table4, table5, table6, table7, table8 '; $expected.= 'WHERE (table1.column1 = table2.column2) AND (table1.column1 = table3.column3) AND (table1.column1 = table4.column4) AND (table1.column1 = table5.column5) AND (table1.column1 = table6.column6) AND (table1.column1 = table7.column7) AND (table1.column1 = table8.column8) AND (table2.column2 = table3.column3) AND (table2.column2 = table4.column4) AND (table2.column2 = table5.column5) AND (table2.column2 = table6.column6) '; @@ -148,7 +148,7 @@ public function testModifyLimitQueryWithOrderByClause() { $sql = 'SELECT m0_.NOMBRE AS NOMBRE0, m0_.FECHAINICIO AS FECHAINICIO1, m0_.FECHAFIN AS FECHAFIN2 FROM MEDICION m0_ WITH (NOLOCK) INNER JOIN ESTUDIO e1_ ON m0_.ESTUDIO_ID = e1_.ID INNER JOIN CLIENTE c2_ ON e1_.CLIENTE_ID = c2_.ID INNER JOIN USUARIO u3_ ON c2_.ID = u3_.CLIENTE_ID WHERE u3_.ID = ? ORDER BY m0_.FECHAINICIO DESC'; $expected = 'SELECT m0_.NOMBRE AS NOMBRE0, m0_.FECHAINICIO AS FECHAINICIO1, m0_.FECHAFIN AS FECHAFIN2 FROM MEDICION m0_ WITH (NOLOCK) INNER JOIN ESTUDIO e1_ ON m0_.ESTUDIO_ID = e1_.ID INNER JOIN CLIENTE c2_ ON e1_.CLIENTE_ID = c2_.ID INNER JOIN USUARIO u3_ ON c2_.ID = u3_.CLIENTE_ID WHERE u3_.ID = ? ORDER BY m0_.FECHAINICIO DESC OFFSET 5 ROWS FETCH NEXT 10 ROWS ONLY'; - $actual = $this->_platform->modifyLimitQuery($sql, 10, 5); + $actual = $this->platform->modifyLimitQuery($sql, 10, 5); self::assertEquals($expected, $actual); } @@ -158,7 +158,7 @@ public function testModifyLimitQueryWithOrderByClause() */ public function testModifyLimitQueryWithSubSelectInSelectList() { - $sql = $this->_platform->modifyLimitQuery( + $sql = $this->platform->modifyLimitQuery( "SELECT " . "u.id, " . "(u.foo/2) foodiv, " . @@ -188,7 +188,7 @@ public function testModifyLimitQueryWithSubSelectInSelectList() */ public function testModifyLimitQueryWithSubSelectInSelectListAndOrderByClause() { - $sql = $this->_platform->modifyLimitQuery( + $sql = $this->platform->modifyLimitQuery( "SELECT " . "u.id, " . "(u.foo/2) foodiv, " . @@ -220,7 +220,7 @@ public function testModifyLimitQueryWithSubSelectInSelectListAndOrderByClause() */ public function testModifyLimitQueryWithAggregateFunctionInOrderByClause() { - $sql = $this->_platform->modifyLimitQuery( + $sql = $this->platform->modifyLimitQuery( "SELECT " . "MAX(heading_id) aliased, " . "code " . @@ -245,7 +245,7 @@ public function testModifyLimitQueryWithAggregateFunctionInOrderByClause() public function testModifyLimitQueryWithFromSubquery() { - $sql = $this->_platform->modifyLimitQuery("SELECT DISTINCT id_0 FROM (SELECT k0_.id AS id_0 FROM key_measure k0_ WHERE (k0_.id_zone in(2))) dctrn_result", 10); + $sql = $this->platform->modifyLimitQuery("SELECT DISTINCT id_0 FROM (SELECT k0_.id AS id_0 FROM key_measure k0_ WHERE (k0_.id_zone in(2))) dctrn_result", 10); $expected = "SELECT DISTINCT id_0 FROM (SELECT k0_.id AS id_0 FROM key_measure k0_ WHERE (k0_.id_zone in(2))) dctrn_result ORDER BY 1 OFFSET 0 ROWS FETCH NEXT 10 ROWS ONLY"; @@ -254,7 +254,7 @@ public function testModifyLimitQueryWithFromSubquery() public function testModifyLimitQueryWithFromSubqueryAndOrder() { - $sql = $this->_platform->modifyLimitQuery("SELECT DISTINCT id_0, value_1 FROM (SELECT k0_.id AS id_0, k0_.value AS value_1 FROM key_measure k0_ WHERE (k0_.id_zone in(2))) dctrn_result ORDER BY value_1 DESC", 10); + $sql = $this->platform->modifyLimitQuery("SELECT DISTINCT id_0, value_1 FROM (SELECT k0_.id AS id_0, k0_.value AS value_1 FROM key_measure k0_ WHERE (k0_.id_zone in(2))) dctrn_result ORDER BY value_1 DESC", 10); $expected = "SELECT DISTINCT id_0, value_1 FROM (SELECT k0_.id AS id_0, k0_.value AS value_1 FROM key_measure k0_ WHERE (k0_.id_zone in(2))) dctrn_result ORDER BY value_1 DESC OFFSET 0 ROWS FETCH NEXT 10 ROWS ONLY"; @@ -263,7 +263,7 @@ public function testModifyLimitQueryWithFromSubqueryAndOrder() public function testModifyLimitQueryWithComplexOrderByExpression() { - $sql = $this->_platform->modifyLimitQuery("SELECT * FROM table ORDER BY (table.x * table.y) DESC", 10); + $sql = $this->platform->modifyLimitQuery("SELECT * FROM table ORDER BY (table.x * table.y) DESC", 10); $expected = "SELECT * FROM table ORDER BY (table.x * table.y) DESC OFFSET 0 ROWS FETCH NEXT 10 ROWS ONLY"; @@ -290,7 +290,7 @@ public function testModifyLimitSubqueryWithJoinAndSubqueryOrderedByColumnFromBas . "LEFT JOIN join_table t2 ON t1.id = t2.table_id" . ") dctrn_result " . "ORDER BY id_0 ASC OFFSET 0 ROWS FETCH NEXT 5 ROWS ONLY"; - $sql = $this->_platform->modifyLimitQuery($querySql, 5); + $sql = $this->platform->modifyLimitQuery($querySql, 5); self::assertEquals($alteredSql, $sql); } @@ -313,7 +313,7 @@ public function testModifyLimitSubqueryWithJoinAndSubqueryOrderedByColumnFromJoi . "LEFT JOIN join_table t2 ON t1.id = t2.table_id" . ") dctrn_result " . "ORDER BY name_1 ASC OFFSET 0 ROWS FETCH NEXT 5 ROWS ONLY"; - $sql = $this->_platform->modifyLimitQuery($querySql, 5); + $sql = $this->platform->modifyLimitQuery($querySql, 5); self::assertEquals($alteredSql, $sql); } @@ -336,7 +336,7 @@ public function testModifyLimitSubqueryWithJoinAndSubqueryOrderedByColumnsFromBo . "LEFT JOIN join_table t2 ON t1.id = t2.table_id" . ") dctrn_result " . "ORDER BY name_1 ASC, foo_2 DESC OFFSET 0 ROWS FETCH NEXT 5 ROWS ONLY"; - $sql = $this->_platform->modifyLimitQuery($querySql, 5); + $sql = $this->platform->modifyLimitQuery($querySql, 5); self::assertEquals($alteredSql, $sql); } @@ -347,7 +347,7 @@ public function testModifyLimitSubquerySimple() . "FROM key_table k0_ WHERE (k0_.where_field IN (1))) dctrn_result"; $alteredSql = "SELECT DISTINCT id_0 FROM (SELECT k0_.id AS id_0, k0_.field AS field_1 " . "FROM key_table k0_ WHERE (k0_.where_field IN (1))) dctrn_result ORDER BY 1 OFFSET 0 ROWS FETCH NEXT 20 ROWS ONLY"; - $sql = $this->_platform->modifyLimitQuery($querySql, 20); + $sql = $this->platform->modifyLimitQuery($querySql, 20); self::assertEquals($alteredSql, $sql); } @@ -355,12 +355,12 @@ public function testModifyLimitQueryWithTopNSubQueryWithOrderBy() { $querySql = 'SELECT * FROM test t WHERE t.id = (SELECT TOP 1 t2.id FROM test t2 ORDER BY t2.data DESC)'; $expectedSql = 'SELECT * FROM test t WHERE t.id = (SELECT TOP 1 t2.id FROM test t2 ORDER BY t2.data DESC) ORDER BY (SELECT 0) OFFSET 0 ROWS FETCH NEXT 10 ROWS ONLY'; - $sql = $this->_platform->modifyLimitQuery($querySql, 10); + $sql = $this->platform->modifyLimitQuery($querySql, 10); self::assertEquals($expectedSql, $sql); $querySql = 'SELECT * FROM test t WHERE t.id = (SELECT TOP 1 t2.id FROM test t2 ORDER BY t2.data DESC) ORDER BY t.data2 DESC'; $expectedSql = 'SELECT * FROM test t WHERE t.id = (SELECT TOP 1 t2.id FROM test t2 ORDER BY t2.data DESC) ORDER BY t.data2 DESC OFFSET 0 ROWS FETCH NEXT 10 ROWS ONLY'; - $sql = $this->_platform->modifyLimitQuery($querySql, 10); + $sql = $this->platform->modifyLimitQuery($querySql, 10); self::assertEquals($expectedSql, $sql); } @@ -368,7 +368,7 @@ public function testModifyLimitQueryWithNewlineBeforeOrderBy() { $querySql = "SELECT * FROM test\nORDER BY col DESC"; $expectedSql = "SELECT * FROM test\nORDER BY col DESC OFFSET 0 ROWS FETCH NEXT 10 ROWS ONLY"; - $sql = $this->_platform->modifyLimitQuery($querySql, 10); + $sql = $this->platform->modifyLimitQuery($querySql, 10); self::assertEquals($expectedSql, $sql); } } diff --git a/tests/Doctrine/Tests/DBAL/Platforms/SQLServerPlatformTest.php b/tests/Doctrine/Tests/DBAL/Platforms/SQLServerPlatformTest.php index c3f9b6f4023..8054d2271e0 100644 --- a/tests/Doctrine/Tests/DBAL/Platforms/SQLServerPlatformTest.php +++ b/tests/Doctrine/Tests/DBAL/Platforms/SQLServerPlatformTest.php @@ -22,7 +22,7 @@ public function testAppendsLockHint($lockMode, $lockHint) $fromClause = 'FROM users'; $expectedResult = $fromClause . $lockHint; - self::assertSame($expectedResult, $this->_platform->appendLockHint($fromClause, $lockMode)); + self::assertSame($expectedResult, $this->platform->appendLockHint($fromClause, $lockMode)); } /** @@ -31,7 +31,7 @@ public function testAppendsLockHint($lockMode, $lockHint) */ public function testScrubInnerOrderBy($query, $limit, $offset, $expectedResult) { - self::assertSame($expectedResult, $this->_platform->modifyLimitQuery($query, $limit, $offset)); + self::assertSame($expectedResult, $this->platform->modifyLimitQuery($query, $limit, $offset)); } public function getLockHints() diff --git a/tests/Doctrine/Tests/DBAL/Platforms/SqlitePlatformTest.php b/tests/Doctrine/Tests/DBAL/Platforms/SqlitePlatformTest.php index cb39baefb1a..565331b270b 100644 --- a/tests/Doctrine/Tests/DBAL/Platforms/SqlitePlatformTest.php +++ b/tests/Doctrine/Tests/DBAL/Platforms/SqlitePlatformTest.php @@ -31,41 +31,41 @@ public function getGenerateTableWithMultiColumnUniqueIndexSql() public function testGeneratesSqlSnippets() { - self::assertEquals('REGEXP', $this->_platform->getRegexpExpression(), 'Regular expression operator is not correct'); - self::assertEquals('SUBSTR(column, 5, LENGTH(column))', $this->_platform->getSubstringExpression('column', 5), 'Substring expression without length is not correct'); - self::assertEquals('SUBSTR(column, 0, 5)', $this->_platform->getSubstringExpression('column', 0, 5), 'Substring expression with length is not correct'); + self::assertEquals('REGEXP', $this->platform->getRegexpExpression(), 'Regular expression operator is not correct'); + self::assertEquals('SUBSTR(column, 5, LENGTH(column))', $this->platform->getSubstringExpression('column', 5), 'Substring expression without length is not correct'); + self::assertEquals('SUBSTR(column, 0, 5)', $this->platform->getSubstringExpression('column', 0, 5), 'Substring expression with length is not correct'); } public function testGeneratesTransactionCommands() { self::assertEquals( 'PRAGMA read_uncommitted = 0', - $this->_platform->getSetTransactionIsolationSQL(\Doctrine\DBAL\Connection::TRANSACTION_READ_UNCOMMITTED) + $this->platform->getSetTransactionIsolationSQL(\Doctrine\DBAL\Connection::TRANSACTION_READ_UNCOMMITTED) ); self::assertEquals( 'PRAGMA read_uncommitted = 1', - $this->_platform->getSetTransactionIsolationSQL(\Doctrine\DBAL\Connection::TRANSACTION_READ_COMMITTED) + $this->platform->getSetTransactionIsolationSQL(\Doctrine\DBAL\Connection::TRANSACTION_READ_COMMITTED) ); self::assertEquals( 'PRAGMA read_uncommitted = 1', - $this->_platform->getSetTransactionIsolationSQL(\Doctrine\DBAL\Connection::TRANSACTION_REPEATABLE_READ) + $this->platform->getSetTransactionIsolationSQL(\Doctrine\DBAL\Connection::TRANSACTION_REPEATABLE_READ) ); self::assertEquals( 'PRAGMA read_uncommitted = 1', - $this->_platform->getSetTransactionIsolationSQL(\Doctrine\DBAL\Connection::TRANSACTION_SERIALIZABLE) + $this->platform->getSetTransactionIsolationSQL(\Doctrine\DBAL\Connection::TRANSACTION_SERIALIZABLE) ); } public function testPrefersIdentityColumns() { - self::assertTrue($this->_platform->prefersIdentityColumns()); + self::assertTrue($this->platform->prefersIdentityColumns()); } public function testIgnoresUnsignedIntegerDeclarationForAutoIncrementalIntegers() { self::assertSame( 'INTEGER', - $this->_platform->getIntegerTypeDeclarationSQL(array('autoincrement' => true, 'unsigned' => true)) + $this->platform->getIntegerTypeDeclarationSQL(array('autoincrement' => true, 'unsigned' => true)) ); } @@ -77,24 +77,24 @@ public function testGeneratesTypeDeclarationForTinyIntegers() { self::assertEquals( 'TINYINT', - $this->_platform->getTinyIntTypeDeclarationSQL(array()) + $this->platform->getTinyIntTypeDeclarationSQL(array()) ); self::assertEquals( 'INTEGER', - $this->_platform->getTinyIntTypeDeclarationSQL(array('autoincrement' => true)) + $this->platform->getTinyIntTypeDeclarationSQL(array('autoincrement' => true)) ); self::assertEquals( 'INTEGER', - $this->_platform->getTinyIntTypeDeclarationSQL( + $this->platform->getTinyIntTypeDeclarationSQL( array('autoincrement' => true, 'primary' => true)) ); self::assertEquals( 'TINYINT', - $this->_platform->getTinyIntTypeDeclarationSQL(array('unsigned' => false)) + $this->platform->getTinyIntTypeDeclarationSQL(array('unsigned' => false)) ); self::assertEquals( 'TINYINT UNSIGNED', - $this->_platform->getTinyIntTypeDeclarationSQL(array('unsigned' => true)) + $this->platform->getTinyIntTypeDeclarationSQL(array('unsigned' => true)) ); } @@ -106,28 +106,28 @@ public function testGeneratesTypeDeclarationForSmallIntegers() { self::assertEquals( 'SMALLINT', - $this->_platform->getSmallIntTypeDeclarationSQL(array()) + $this->platform->getSmallIntTypeDeclarationSQL(array()) ); self::assertEquals( 'INTEGER', - $this->_platform->getSmallIntTypeDeclarationSQL(array('autoincrement' => true)) + $this->platform->getSmallIntTypeDeclarationSQL(array('autoincrement' => true)) ); self::assertEquals( 'INTEGER', - $this->_platform->getTinyIntTypeDeclarationSQL(array('autoincrement' => true, 'unsigned' => true)) + $this->platform->getTinyIntTypeDeclarationSQL(array('autoincrement' => true, 'unsigned' => true)) ); self::assertEquals( 'INTEGER', - $this->_platform->getSmallIntTypeDeclarationSQL( + $this->platform->getSmallIntTypeDeclarationSQL( array('autoincrement' => true, 'primary' => true)) ); self::assertEquals( 'SMALLINT', - $this->_platform->getSmallIntTypeDeclarationSQL(array('unsigned' => false)) + $this->platform->getSmallIntTypeDeclarationSQL(array('unsigned' => false)) ); self::assertEquals( 'SMALLINT UNSIGNED', - $this->_platform->getSmallIntTypeDeclarationSQL(array('unsigned' => true)) + $this->platform->getSmallIntTypeDeclarationSQL(array('unsigned' => true)) ); } @@ -139,28 +139,28 @@ public function testGeneratesTypeDeclarationForMediumIntegers() { self::assertEquals( 'MEDIUMINT', - $this->_platform->getMediumIntTypeDeclarationSQL(array()) + $this->platform->getMediumIntTypeDeclarationSQL(array()) ); self::assertEquals( 'INTEGER', - $this->_platform->getMediumIntTypeDeclarationSQL(array('autoincrement' => true)) + $this->platform->getMediumIntTypeDeclarationSQL(array('autoincrement' => true)) ); self::assertEquals( 'INTEGER', - $this->_platform->getMediumIntTypeDeclarationSQL(array('autoincrement' => true, 'unsigned' => true)) + $this->platform->getMediumIntTypeDeclarationSQL(array('autoincrement' => true, 'unsigned' => true)) ); self::assertEquals( 'INTEGER', - $this->_platform->getMediumIntTypeDeclarationSQL( + $this->platform->getMediumIntTypeDeclarationSQL( array('autoincrement' => true, 'primary' => true)) ); self::assertEquals( 'MEDIUMINT', - $this->_platform->getMediumIntTypeDeclarationSQL(array('unsigned' => false)) + $this->platform->getMediumIntTypeDeclarationSQL(array('unsigned' => false)) ); self::assertEquals( 'MEDIUMINT UNSIGNED', - $this->_platform->getMediumIntTypeDeclarationSQL(array('unsigned' => true)) + $this->platform->getMediumIntTypeDeclarationSQL(array('unsigned' => true)) ); } @@ -168,28 +168,28 @@ public function testGeneratesTypeDeclarationForIntegers() { self::assertEquals( 'INTEGER', - $this->_platform->getIntegerTypeDeclarationSQL(array()) + $this->platform->getIntegerTypeDeclarationSQL(array()) ); self::assertEquals( 'INTEGER', - $this->_platform->getIntegerTypeDeclarationSQL(array('autoincrement' => true)) + $this->platform->getIntegerTypeDeclarationSQL(array('autoincrement' => true)) ); self::assertEquals( 'INTEGER', - $this->_platform->getIntegerTypeDeclarationSQL(array('autoincrement' => true, 'unsigned' => true)) + $this->platform->getIntegerTypeDeclarationSQL(array('autoincrement' => true, 'unsigned' => true)) ); self::assertEquals( 'INTEGER', - $this->_platform->getIntegerTypeDeclarationSQL( + $this->platform->getIntegerTypeDeclarationSQL( array('autoincrement' => true, 'primary' => true)) ); self::assertEquals( 'INTEGER', - $this->_platform->getIntegerTypeDeclarationSQL(array('unsigned' => false)) + $this->platform->getIntegerTypeDeclarationSQL(array('unsigned' => false)) ); self::assertEquals( 'INTEGER UNSIGNED', - $this->_platform->getIntegerTypeDeclarationSQL(array('unsigned' => true)) + $this->platform->getIntegerTypeDeclarationSQL(array('unsigned' => true)) ); } @@ -201,28 +201,28 @@ public function testGeneratesTypeDeclarationForBigIntegers() { self::assertEquals( 'BIGINT', - $this->_platform->getBigIntTypeDeclarationSQL(array()) + $this->platform->getBigIntTypeDeclarationSQL(array()) ); self::assertEquals( 'INTEGER', - $this->_platform->getBigIntTypeDeclarationSQL(array('autoincrement' => true)) + $this->platform->getBigIntTypeDeclarationSQL(array('autoincrement' => true)) ); self::assertEquals( 'INTEGER', - $this->_platform->getBigIntTypeDeclarationSQL(array('autoincrement' => true, 'unsigned' => true)) + $this->platform->getBigIntTypeDeclarationSQL(array('autoincrement' => true, 'unsigned' => true)) ); self::assertEquals( 'INTEGER', - $this->_platform->getBigIntTypeDeclarationSQL( + $this->platform->getBigIntTypeDeclarationSQL( array('autoincrement' => true, 'primary' => true)) ); self::assertEquals( 'BIGINT', - $this->_platform->getBigIntTypeDeclarationSQL(array('unsigned' => false)) + $this->platform->getBigIntTypeDeclarationSQL(array('unsigned' => false)) ); self::assertEquals( 'BIGINT UNSIGNED', - $this->_platform->getBigIntTypeDeclarationSQL(array('unsigned' => true)) + $this->platform->getBigIntTypeDeclarationSQL(array('unsigned' => true)) ); } @@ -230,17 +230,17 @@ public function testGeneratesTypeDeclarationForStrings() { self::assertEquals( 'CHAR(10)', - $this->_platform->getVarcharTypeDeclarationSQL( + $this->platform->getVarcharTypeDeclarationSQL( array('length' => 10, 'fixed' => true)) ); self::assertEquals( 'VARCHAR(50)', - $this->_platform->getVarcharTypeDeclarationSQL(array('length' => 50)), + $this->platform->getVarcharTypeDeclarationSQL(array('length' => 50)), 'Variable string declaration is not correct' ); self::assertEquals( 'VARCHAR(255)', - $this->_platform->getVarcharTypeDeclarationSQL(array()), + $this->platform->getVarcharTypeDeclarationSQL(array()), 'Long string declaration is not correct' ); } @@ -278,19 +278,19 @@ public function getGenerateForeignKeySql() public function testModifyLimitQuery() { - $sql = $this->_platform->modifyLimitQuery('SELECT * FROM user', 10, 0); + $sql = $this->platform->modifyLimitQuery('SELECT * FROM user', 10, 0); self::assertEquals('SELECT * FROM user LIMIT 10 OFFSET 0', $sql); } public function testModifyLimitQueryWithEmptyOffset() { - $sql = $this->_platform->modifyLimitQuery('SELECT * FROM user', 10); + $sql = $this->platform->modifyLimitQuery('SELECT * FROM user', 10); self::assertEquals('SELECT * FROM user LIMIT 10', $sql); } public function testModifyLimitQueryWithOffsetAndEmptyLimit() { - $sql = $this->_platform->modifyLimitQuery('SELECT * FROM user', null, 10); + $sql = $this->platform->modifyLimitQuery('SELECT * FROM user', null, 10); self::assertEquals('SELECT * FROM user LIMIT -1 OFFSET 10', $sql); } @@ -315,7 +315,7 @@ public function testGenerateTableSqlShouldNotAutoQuotePrimaryKey() $table->addColumn('"like"', 'integer', array('notnull' => true, 'autoincrement' => true)); $table->setPrimaryKey(array('"like"')); - $createTableSQL = $this->_platform->getCreateTableSQL($table); + $createTableSQL = $this->platform->getCreateTableSQL($table); self::assertEquals( 'CREATE TABLE test ("like" INTEGER NOT NULL, PRIMARY KEY("like"))', $createTableSQL[0] @@ -333,7 +333,7 @@ public function testAlterTableAddColumns() 'ALTER TABLE user ADD COLUMN count INTEGER DEFAULT 1', ); - self::assertEquals($expected, $this->_platform->getAlterTableSQL($diff)); + self::assertEquals($expected, $this->platform->getAlterTableSQL($diff)); } /** @@ -343,7 +343,7 @@ public function testAlterTableAddComplexColumns(TableDiff $diff) : void { $this->expectException(DBALException::class); - $this->_platform->getAlterTableSQL($diff); + $this->platform->getAlterTableSQL($diff); } public function complexDiffProvider() : array @@ -386,7 +386,7 @@ public function testCreateTableWithDeferredForeignKeys() 'CREATE INDEX IDX_8D93D6493D8E604F ON user (parent)', ); - self::assertEquals($sql, $this->_platform->getCreateTableSQL($table)); + self::assertEquals($sql, $this->platform->getCreateTableSQL($table)); } public function testAlterTable() @@ -430,7 +430,7 @@ public function testAlterTable() 'CREATE INDEX IDX_8D93D6495A8A6C8D ON client (comment)', ); - self::assertEquals($sql, $this->_platform->getAlterTableSQL($diff)); + self::assertEquals($sql, $this->platform->getAlterTableSQL($diff)); } protected function getQuotedColumnInPrimaryKeySQL() @@ -479,13 +479,13 @@ protected function getBinaryMaxLength() public function testReturnsBinaryTypeDeclarationSQL() { - self::assertSame('BLOB', $this->_platform->getBinaryTypeDeclarationSQL(array())); - self::assertSame('BLOB', $this->_platform->getBinaryTypeDeclarationSQL(array('length' => 0))); - self::assertSame('BLOB', $this->_platform->getBinaryTypeDeclarationSQL(array('length' => 9999999))); + self::assertSame('BLOB', $this->platform->getBinaryTypeDeclarationSQL(array())); + self::assertSame('BLOB', $this->platform->getBinaryTypeDeclarationSQL(array('length' => 0))); + self::assertSame('BLOB', $this->platform->getBinaryTypeDeclarationSQL(array('length' => 9999999))); - self::assertSame('BLOB', $this->_platform->getBinaryTypeDeclarationSQL(array('fixed' => true))); - self::assertSame('BLOB', $this->_platform->getBinaryTypeDeclarationSQL(array('fixed' => true, 'length' => 0))); - self::assertSame('BLOB', $this->_platform->getBinaryTypeDeclarationSQL(array('fixed' => true, 'length' => 9999999))); + self::assertSame('BLOB', $this->platform->getBinaryTypeDeclarationSQL(array('fixed' => true))); + self::assertSame('BLOB', $this->platform->getBinaryTypeDeclarationSQL(array('fixed' => true, 'length' => 0))); + self::assertSame('BLOB', $this->platform->getBinaryTypeDeclarationSQL(array('fixed' => true, 'length' => 9999999))); } /** @@ -589,7 +589,7 @@ public function testQuotesAlterTableRenameIndexInSchema() */ public function testReturnsGuidTypeDeclarationSQL() { - self::assertSame('CHAR(36)', $this->_platform->getGuidTypeDeclarationSQL(array())); + self::assertSame('CHAR(36)', $this->platform->getGuidTypeDeclarationSQL(array())); } /** @@ -722,7 +722,7 @@ protected function getGeneratesAlterTableRenameIndexUsedByForeignKeySQL() */ public function testQuotesTableNameInListTableConstraintsSQL() { - self::assertContains("'Foo''Bar\\'", $this->_platform->getListTableConstraintsSQL("Foo'Bar\\"), '', true); + self::assertContains("'Foo''Bar\\'", $this->platform->getListTableConstraintsSQL("Foo'Bar\\"), '', true); } /** @@ -730,7 +730,7 @@ public function testQuotesTableNameInListTableConstraintsSQL() */ public function testQuotesTableNameInListTableColumnsSQL() { - self::assertContains("'Foo''Bar\\'", $this->_platform->getListTableColumnsSQL("Foo'Bar\\"), '', true); + self::assertContains("'Foo''Bar\\'", $this->platform->getListTableColumnsSQL("Foo'Bar\\"), '', true); } /** @@ -738,7 +738,7 @@ public function testQuotesTableNameInListTableColumnsSQL() */ public function testQuotesTableNameInListTableIndexesSQL() { - self::assertContains("'Foo''Bar\\'", $this->_platform->getListTableIndexesSQL("Foo'Bar\\"), '', true); + self::assertContains("'Foo''Bar\\'", $this->platform->getListTableIndexesSQL("Foo'Bar\\"), '', true); } /** @@ -746,6 +746,6 @@ public function testQuotesTableNameInListTableIndexesSQL() */ public function testQuotesTableNameInListTableForeignKeysSQL() { - self::assertContains("'Foo''Bar\\'", $this->_platform->getListTableForeignKeysSQL("Foo'Bar\\"), '', true); + self::assertContains("'Foo''Bar\\'", $this->platform->getListTableForeignKeysSQL("Foo'Bar\\"), '', true); } } diff --git a/tests/Doctrine/Tests/DBAL/Schema/SchemaTest.php b/tests/Doctrine/Tests/DBAL/Schema/SchemaTest.php index b5129fcefbc..cca689f9126 100644 --- a/tests/Doctrine/Tests/DBAL/Schema/SchemaTest.php +++ b/tests/Doctrine/Tests/DBAL/Schema/SchemaTest.php @@ -204,7 +204,7 @@ public function testDeepClone() $fk = $schemaNew->getTable('bar')->getForeignKeys(); $fk = current($fk); - self::assertSame($schemaNew->getTable('bar'), $this->readAttribute($fk, '_localTable')); + self::assertSame($schemaNew->getTable('bar'), $this->readAttribute($fk, 'localTable')); } /** diff --git a/tests/Doctrine/Tests/DBAL/Types/ArrayTest.php b/tests/Doctrine/Tests/DBAL/Types/ArrayTest.php index 1ec3d5f121e..098d639b496 100644 --- a/tests/Doctrine/Tests/DBAL/Types/ArrayTest.php +++ b/tests/Doctrine/Tests/DBAL/Types/ArrayTest.php @@ -8,13 +8,13 @@ class ArrayTest extends \Doctrine\Tests\DbalTestCase { protected - $_platform, - $_type; + $platform, + $type; protected function setUp() { - $this->_platform = new MockPlatform(); - $this->_type = Type::getType('array'); + $this->platform = new MockPlatform(); + $this->type = Type::getType('array'); } protected function tearDown() @@ -27,7 +27,7 @@ public function testArrayConvertsToDatabaseValue() { self::assertInternalType( 'string', - $this->_type->convertToDatabaseValue(array(), $this->_platform) + $this->type->convertToDatabaseValue(array(), $this->platform) ); } @@ -35,7 +35,7 @@ public function testArrayConvertsToPHPValue() { self::assertInternalType( 'array', - $this->_type->convertToPHPValue(serialize(array()), $this->_platform) + $this->type->convertToPHPValue(serialize(array()), $this->platform) ); } @@ -43,12 +43,12 @@ public function testConversionFailure() { error_reporting( (E_ALL | E_STRICT) - \E_NOTICE ); $this->expectException('Doctrine\DBAL\Types\ConversionException'); - $this->_type->convertToPHPValue('abcdefg', $this->_platform); + $this->type->convertToPHPValue('abcdefg', $this->platform); } public function testNullConversion() { - self::assertNull($this->_type->convertToPHPValue(null, $this->_platform)); + self::assertNull($this->type->convertToPHPValue(null, $this->platform)); } /** @@ -56,6 +56,6 @@ public function testNullConversion() */ public function testFalseConversion() { - self::assertFalse($this->_type->convertToPHPValue(serialize(false), $this->_platform)); + self::assertFalse($this->type->convertToPHPValue(serialize(false), $this->platform)); } } diff --git a/tests/Doctrine/Tests/DBAL/Types/BooleanTest.php b/tests/Doctrine/Tests/DBAL/Types/BooleanTest.php index 30b0874874a..af520b01647 100644 --- a/tests/Doctrine/Tests/DBAL/Types/BooleanTest.php +++ b/tests/Doctrine/Tests/DBAL/Types/BooleanTest.php @@ -8,27 +8,27 @@ class BooleanTest extends \Doctrine\Tests\DbalTestCase { protected - $_platform, - $_type; + $platform, + $type; protected function setUp() { - $this->_platform = new MockPlatform(); - $this->_type = Type::getType('boolean'); + $this->platform = new MockPlatform(); + $this->type = Type::getType('boolean'); } public function testBooleanConvertsToDatabaseValue() { - self::assertInternalType('integer', $this->_type->convertToDatabaseValue(1, $this->_platform)); + self::assertInternalType('integer', $this->type->convertToDatabaseValue(1, $this->platform)); } public function testBooleanConvertsToPHPValue() { - self::assertInternalType('bool', $this->_type->convertToPHPValue(0, $this->_platform)); + self::assertInternalType('bool', $this->type->convertToPHPValue(0, $this->platform)); } public function testBooleanNullConvertsToPHPValue() { - self::assertNull($this->_type->convertToPHPValue(null, $this->_platform)); + self::assertNull($this->type->convertToPHPValue(null, $this->platform)); } } diff --git a/tests/Doctrine/Tests/DBAL/Types/DecimalTest.php b/tests/Doctrine/Tests/DBAL/Types/DecimalTest.php index 49c75845509..faa79e5879c 100644 --- a/tests/Doctrine/Tests/DBAL/Types/DecimalTest.php +++ b/tests/Doctrine/Tests/DBAL/Types/DecimalTest.php @@ -8,22 +8,22 @@ class DecimalTest extends \Doctrine\Tests\DbalTestCase { protected - $_platform, - $_type; + $platform, + $type; protected function setUp() { - $this->_platform = new MockPlatform(); - $this->_type = Type::getType('decimal'); + $this->platform = new MockPlatform(); + $this->type = Type::getType('decimal'); } public function testDecimalConvertsToPHPValue() { - self::assertInternalType('string', $this->_type->convertToPHPValue('5.5', $this->_platform)); + self::assertInternalType('string', $this->type->convertToPHPValue('5.5', $this->platform)); } public function testDecimalNullConvertsToPHPValue() { - self::assertNull($this->_type->convertToPHPValue(null, $this->_platform)); + self::assertNull($this->type->convertToPHPValue(null, $this->platform)); } } diff --git a/tests/Doctrine/Tests/DBAL/Types/FloatTest.php b/tests/Doctrine/Tests/DBAL/Types/FloatTest.php index d4e58b505cc..099048275e8 100644 --- a/tests/Doctrine/Tests/DBAL/Types/FloatTest.php +++ b/tests/Doctrine/Tests/DBAL/Types/FloatTest.php @@ -7,31 +7,31 @@ class FloatTest extends \Doctrine\Tests\DbalTestCase { - protected $_platform, $_type; + protected $platform, $type; protected function setUp() { - $this->_platform = new MockPlatform(); - $this->_type = Type::getType('float'); + $this->platform = new MockPlatform(); + $this->type = Type::getType('float'); } public function testFloatConvertsToPHPValue() { - self::assertInternalType('float', $this->_type->convertToPHPValue('5.5', $this->_platform)); + self::assertInternalType('float', $this->type->convertToPHPValue('5.5', $this->platform)); } public function testFloatNullConvertsToPHPValue() { - self::assertNull($this->_type->convertToPHPValue(null, $this->_platform)); + self::assertNull($this->type->convertToPHPValue(null, $this->platform)); } public function testFloatConvertToDatabaseValue() { - self::assertInternalType('float', $this->_type->convertToDatabaseValue(5.5, $this->_platform)); + self::assertInternalType('float', $this->type->convertToDatabaseValue(5.5, $this->platform)); } public function testFloatNullConvertToDatabaseValue() { - self::assertNull($this->_type->convertToDatabaseValue(null, $this->_platform)); + self::assertNull($this->type->convertToDatabaseValue(null, $this->platform)); } } diff --git a/tests/Doctrine/Tests/DBAL/Types/GuidTypeTest.php b/tests/Doctrine/Tests/DBAL/Types/GuidTypeTest.php index 63b7bc5c43e..d361882df19 100644 --- a/tests/Doctrine/Tests/DBAL/Types/GuidTypeTest.php +++ b/tests/Doctrine/Tests/DBAL/Types/GuidTypeTest.php @@ -8,35 +8,35 @@ class GuidTest extends \Doctrine\Tests\DbalTestCase { protected - $_platform, - $_type; + $platform, + $type; protected function setUp() { - $this->_platform = new MockPlatform(); - $this->_type = Type::getType('guid'); + $this->platform = new MockPlatform(); + $this->type = Type::getType('guid'); } public function testConvertToPHPValue() { - self::assertInternalType("string", $this->_type->convertToPHPValue("foo", $this->_platform)); - self::assertInternalType("string", $this->_type->convertToPHPValue("", $this->_platform)); + self::assertInternalType("string", $this->type->convertToPHPValue("foo", $this->platform)); + self::assertInternalType("string", $this->type->convertToPHPValue("", $this->platform)); } public function testNullConversion() { - self::assertNull($this->_type->convertToPHPValue(null, $this->_platform)); + self::assertNull($this->type->convertToPHPValue(null, $this->platform)); } public function testNativeGuidSupport() { - self::assertTrue($this->_type->requiresSQLCommentHint($this->_platform)); + self::assertTrue($this->type->requiresSQLCommentHint($this->platform)); - $mock = $this->createMock(get_class($this->_platform)); + $mock = $this->createMock(get_class($this->platform)); $mock->expects($this->any()) ->method('hasNativeGuidType') ->will($this->returnValue(true)); - self::assertFalse($this->_type->requiresSQLCommentHint($mock)); + self::assertFalse($this->type->requiresSQLCommentHint($mock)); } } diff --git a/tests/Doctrine/Tests/DBAL/Types/IntegerTest.php b/tests/Doctrine/Tests/DBAL/Types/IntegerTest.php index e4c7b475293..cf3bd606cd7 100644 --- a/tests/Doctrine/Tests/DBAL/Types/IntegerTest.php +++ b/tests/Doctrine/Tests/DBAL/Types/IntegerTest.php @@ -8,23 +8,23 @@ class IntegerTest extends \Doctrine\Tests\DbalTestCase { protected - $_platform, - $_type; + $platform, + $type; protected function setUp() { - $this->_platform = new MockPlatform(); - $this->_type = Type::getType('integer'); + $this->platform = new MockPlatform(); + $this->type = Type::getType('integer'); } public function testIntegerConvertsToPHPValue() { - self::assertInternalType('integer', $this->_type->convertToPHPValue('1', $this->_platform)); - self::assertInternalType('integer', $this->_type->convertToPHPValue('0', $this->_platform)); + self::assertInternalType('integer', $this->type->convertToPHPValue('1', $this->platform)); + self::assertInternalType('integer', $this->type->convertToPHPValue('0', $this->platform)); } public function testIntegerNullConvertsToPHPValue() { - self::assertNull($this->_type->convertToPHPValue(null, $this->_platform)); + self::assertNull($this->type->convertToPHPValue(null, $this->platform)); } } diff --git a/tests/Doctrine/Tests/DBAL/Types/ObjectTest.php b/tests/Doctrine/Tests/DBAL/Types/ObjectTest.php index a314adcf0aa..cd51791792a 100644 --- a/tests/Doctrine/Tests/DBAL/Types/ObjectTest.php +++ b/tests/Doctrine/Tests/DBAL/Types/ObjectTest.php @@ -8,13 +8,13 @@ class ObjectTest extends \Doctrine\Tests\DbalTestCase { protected - $_platform, - $_type; + $platform, + $type; protected function setUp() { - $this->_platform = new MockPlatform(); - $this->_type = Type::getType('object'); + $this->platform = new MockPlatform(); + $this->type = Type::getType('object'); } protected function tearDown() @@ -24,24 +24,24 @@ protected function tearDown() public function testObjectConvertsToDatabaseValue() { - self::assertInternalType('string', $this->_type->convertToDatabaseValue(new \stdClass(), $this->_platform)); + self::assertInternalType('string', $this->type->convertToDatabaseValue(new \stdClass(), $this->platform)); } public function testObjectConvertsToPHPValue() { - self::assertInternalType('object', $this->_type->convertToPHPValue(serialize(new \stdClass), $this->_platform)); + self::assertInternalType('object', $this->type->convertToPHPValue(serialize(new \stdClass), $this->platform)); } public function testConversionFailure() { error_reporting( (E_ALL | E_STRICT) - \E_NOTICE ); $this->expectException('Doctrine\DBAL\Types\ConversionException'); - $this->_type->convertToPHPValue('abcdefg', $this->_platform); + $this->type->convertToPHPValue('abcdefg', $this->platform); } public function testNullConversion() { - self::assertNull($this->_type->convertToPHPValue(null, $this->_platform)); + self::assertNull($this->type->convertToPHPValue(null, $this->platform)); } /** @@ -49,6 +49,6 @@ public function testNullConversion() */ public function testFalseConversion() { - self::assertFalse($this->_type->convertToPHPValue(serialize(false), $this->_platform)); + self::assertFalse($this->type->convertToPHPValue(serialize(false), $this->platform)); } } diff --git a/tests/Doctrine/Tests/DBAL/Types/SmallIntTest.php b/tests/Doctrine/Tests/DBAL/Types/SmallIntTest.php index eb0f381de5a..0905731f9dd 100644 --- a/tests/Doctrine/Tests/DBAL/Types/SmallIntTest.php +++ b/tests/Doctrine/Tests/DBAL/Types/SmallIntTest.php @@ -8,23 +8,23 @@ class SmallIntTest extends \Doctrine\Tests\DbalTestCase { protected - $_platform, - $_type; + $platform, + $type; protected function setUp() { - $this->_platform = new MockPlatform(); - $this->_type = Type::getType('smallint'); + $this->platform = new MockPlatform(); + $this->type = Type::getType('smallint'); } public function testSmallIntConvertsToPHPValue() { - self::assertInternalType('integer', $this->_type->convertToPHPValue('1', $this->_platform)); - self::assertInternalType('integer', $this->_type->convertToPHPValue('0', $this->_platform)); + self::assertInternalType('integer', $this->type->convertToPHPValue('1', $this->platform)); + self::assertInternalType('integer', $this->type->convertToPHPValue('0', $this->platform)); } public function testSmallIntNullConvertsToPHPValue() { - self::assertNull($this->_type->convertToPHPValue(null, $this->_platform)); + self::assertNull($this->type->convertToPHPValue(null, $this->platform)); } } diff --git a/tests/Doctrine/Tests/DBAL/Types/StringTest.php b/tests/Doctrine/Tests/DBAL/Types/StringTest.php index 4c20268f0a5..db5ea8a1d3b 100644 --- a/tests/Doctrine/Tests/DBAL/Types/StringTest.php +++ b/tests/Doctrine/Tests/DBAL/Types/StringTest.php @@ -8,40 +8,40 @@ class StringTest extends \Doctrine\Tests\DbalTestCase { protected - $_platform, - $_type; + $platform, + $type; protected function setUp() { - $this->_platform = new MockPlatform(); - $this->_type = Type::getType('string'); + $this->platform = new MockPlatform(); + $this->type = Type::getType('string'); } public function testReturnsSqlDeclarationFromPlatformVarchar() { - self::assertEquals("DUMMYVARCHAR()", $this->_type->getSqlDeclaration(array(), $this->_platform)); + self::assertEquals("DUMMYVARCHAR()", $this->type->getSqlDeclaration(array(), $this->platform)); } public function testReturnsDefaultLengthFromPlatformVarchar() { - self::assertEquals(255, $this->_type->getDefaultLength($this->_platform)); + self::assertEquals(255, $this->type->getDefaultLength($this->platform)); } public function testConvertToPHPValue() { - self::assertInternalType("string", $this->_type->convertToPHPValue("foo", $this->_platform)); - self::assertInternalType("string", $this->_type->convertToPHPValue("", $this->_platform)); + self::assertInternalType("string", $this->type->convertToPHPValue("foo", $this->platform)); + self::assertInternalType("string", $this->type->convertToPHPValue("", $this->platform)); } public function testNullConversion() { - self::assertNull($this->_type->convertToPHPValue(null, $this->_platform)); + self::assertNull($this->type->convertToPHPValue(null, $this->platform)); } public function testSQLConversion() { - self::assertFalse($this->_type->canRequireSQLConversion(), "String type can never require SQL conversion to work."); - self::assertEquals('t.foo', $this->_type->convertToDatabaseValueSQL('t.foo', $this->_platform)); - self::assertEquals('t.foo', $this->_type->convertToPHPValueSQL('t.foo', $this->_platform)); + self::assertFalse($this->type->canRequireSQLConversion(), "String type can never require SQL conversion to work."); + self::assertEquals('t.foo', $this->type->convertToDatabaseValueSQL('t.foo', $this->platform)); + self::assertEquals('t.foo', $this->type->convertToPHPValueSQL('t.foo', $this->platform)); } } diff --git a/tests/Doctrine/Tests/DBAL/Types/VarDateTimeTest.php b/tests/Doctrine/Tests/DBAL/Types/VarDateTimeTest.php index d9c47b02f86..1fb7830b5fb 100644 --- a/tests/Doctrine/Tests/DBAL/Types/VarDateTimeTest.php +++ b/tests/Doctrine/Tests/DBAL/Types/VarDateTimeTest.php @@ -8,24 +8,24 @@ class VarDateTimeTest extends \Doctrine\Tests\DbalTestCase { protected - $_platform, - $_type; + $platform, + $type; protected function setUp() { - $this->_platform = new MockPlatform(); + $this->platform = new MockPlatform(); if (!Type::hasType('vardatetime')) { Type::addType('vardatetime', 'Doctrine\DBAL\Types\VarDateTimeType'); } - $this->_type = Type::getType('vardatetime'); + $this->type = Type::getType('vardatetime'); } public function testDateTimeConvertsToDatabaseValue() { $date = new \DateTime('1985-09-01 10:10:10'); - $expected = $date->format($this->_platform->getDateTimeTzFormatString()); - $actual = $this->_type->convertToDatabaseValue($date, $this->_platform); + $expected = $date->format($this->platform->getDateTimeTzFormatString()); + $actual = $this->type->convertToDatabaseValue($date, $this->platform); self::assertEquals($expected, $actual); } @@ -33,7 +33,7 @@ public function testDateTimeConvertsToDatabaseValue() public function testDateTimeConvertsToPHPValue() { // Birthday of jwage and also birthday of Doctrine. Send him a present ;) - $date = $this->_type->convertToPHPValue('1985-09-01 00:00:00', $this->_platform); + $date = $this->type->convertToPHPValue('1985-09-01 00:00:00', $this->platform); self::assertInstanceOf('DateTime', $date); self::assertEquals('1985-09-01 00:00:00', $date->format('Y-m-d H:i:s')); self::assertEquals('000000', $date->format('u')); @@ -42,12 +42,12 @@ public function testDateTimeConvertsToPHPValue() public function testInvalidDateTimeFormatConversion() { $this->expectException('Doctrine\DBAL\Types\ConversionException'); - $this->_type->convertToPHPValue('abcdefg', $this->_platform); + $this->type->convertToPHPValue('abcdefg', $this->platform); } public function testConversionWithMicroseconds() { - $date = $this->_type->convertToPHPValue('1985-09-01 00:00:00.123456', $this->_platform); + $date = $this->type->convertToPHPValue('1985-09-01 00:00:00.123456', $this->platform); self::assertInstanceOf('DateTime', $date); self::assertEquals('1985-09-01 00:00:00', $date->format('Y-m-d H:i:s')); self::assertEquals('123456', $date->format('u')); @@ -55,12 +55,12 @@ public function testConversionWithMicroseconds() public function testNullConversion() { - self::assertNull($this->_type->convertToPHPValue(null, $this->_platform)); + self::assertNull($this->type->convertToPHPValue(null, $this->platform)); } public function testConvertDateTimeToPHPValue() { $date = new \DateTime("now"); - self::assertSame($date, $this->_type->convertToPHPValue($date, $this->_platform)); + self::assertSame($date, $this->type->convertToPHPValue($date, $this->platform)); } } diff --git a/tests/Doctrine/Tests/DbalFunctionalTestCase.php b/tests/Doctrine/Tests/DbalFunctionalTestCase.php index ea28c8d1ea1..64abb1c1eff 100644 --- a/tests/Doctrine/Tests/DbalFunctionalTestCase.php +++ b/tests/Doctrine/Tests/DbalFunctionalTestCase.php @@ -9,41 +9,41 @@ class DbalFunctionalTestCase extends DbalTestCase * * @var \Doctrine\DBAL\Connection */ - private static $_sharedConn; + private static $sharedConn; /** * @var \Doctrine\DBAL\Connection */ - protected $_conn; + protected $conn; /** * @var \Doctrine\DBAL\Logging\DebugStack */ - protected $_sqlLoggerStack; + protected $sqlLoggerStack; protected function resetSharedConn() { - if (self::$_sharedConn) { - self::$_sharedConn->close(); - self::$_sharedConn = null; + if (self::$sharedConn) { + self::$sharedConn->close(); + self::$sharedConn = null; } } protected function setUp() { - if ( ! isset(self::$_sharedConn)) { - self::$_sharedConn = TestUtil::getConnection(); + if ( ! isset(self::$sharedConn)) { + self::$sharedConn = TestUtil::getConnection(); } - $this->_conn = self::$_sharedConn; + $this->conn = self::$sharedConn; - $this->_sqlLoggerStack = new \Doctrine\DBAL\Logging\DebugStack(); - $this->_conn->getConfiguration()->setSQLLogger($this->_sqlLoggerStack); + $this->sqlLoggerStack = new \Doctrine\DBAL\Logging\DebugStack(); + $this->conn->getConfiguration()->setSQLLogger($this->sqlLoggerStack); } protected function tearDown() { - while ($this->_conn->isTransactionActive()) { - $this->_conn->rollBack(); + while ($this->conn->isTransactionActive()) { + $this->conn->rollBack(); } } @@ -53,10 +53,10 @@ protected function onNotSuccessfulTest(\Throwable $t) throw $t; } - if(isset($this->_sqlLoggerStack->queries) && count($this->_sqlLoggerStack->queries)) { + if(isset($this->sqlLoggerStack->queries) && count($this->sqlLoggerStack->queries)) { $queries = ""; - $i = count($this->_sqlLoggerStack->queries); - foreach (array_reverse($this->_sqlLoggerStack->queries) as $query) { + $i = count($this->sqlLoggerStack->queries); + foreach (array_reverse($this->sqlLoggerStack->queries) as $query) { $params = array_map(function($p) { if (is_object($p)) { return get_class($p); diff --git a/tests/Doctrine/Tests/Mocks/ConnectionMock.php b/tests/Doctrine/Tests/Mocks/ConnectionMock.php index 6694d19f4d4..de6558ca745 100644 --- a/tests/Doctrine/Tests/Mocks/ConnectionMock.php +++ b/tests/Doctrine/Tests/Mocks/ConnectionMock.php @@ -4,19 +4,19 @@ class ConnectionMock extends \Doctrine\DBAL\Connection { - private $_fetchOneResult; - private $_platformMock; - private $_lastInsertId = 0; - private $_inserts = array(); + private $fetchOneResult; + private $platformMock; + private $lastInsertId = 0; + private $inserts = array(); public function __construct(array $params, $driver, $config = null, $eventManager = null) { - $this->_platformMock = new DatabasePlatformMock(); + $this->platformMock = new DatabasePlatformMock(); parent::__construct($params, $driver, $config, $eventManager); // Override possible assignment of platform to database platform mock - $this->_platform = $this->_platformMock; + $this->platform = $this->platformMock; } /** @@ -24,7 +24,7 @@ public function __construct(array $params, $driver, $config = null, $eventManage */ public function getDatabasePlatform() { - return $this->_platformMock; + return $this->platformMock; } /** @@ -32,7 +32,7 @@ public function getDatabasePlatform() */ public function insert($tableName, array $data, array $types = array()) { - $this->_inserts[$tableName][] = $data; + $this->inserts[$tableName][] = $data; } /** @@ -40,7 +40,7 @@ public function insert($tableName, array $data, array $types = array()) */ public function lastInsertId($seqName = null) { - return $this->_lastInsertId; + return $this->lastInsertId; } /** @@ -48,7 +48,7 @@ public function lastInsertId($seqName = null) */ public function fetchColumn($statement, array $params = array(), $colnum = 0, array $types = array()) { - return $this->_fetchOneResult; + return $this->fetchOneResult; } /** @@ -66,22 +66,22 @@ public function quote($input, $type = null) public function setFetchOneResult($fetchOneResult) { - $this->_fetchOneResult = $fetchOneResult; + $this->fetchOneResult = $fetchOneResult; } public function setLastInsertId($id) { - $this->_lastInsertId = $id; + $this->lastInsertId = $id; } public function getInserts() { - return $this->_inserts; + return $this->inserts; } public function reset() { - $this->_inserts = array(); - $this->_lastInsertId = 0; + $this->inserts = array(); + $this->lastInsertId = 0; } } \ No newline at end of file diff --git a/tests/Doctrine/Tests/Mocks/DatabasePlatformMock.php b/tests/Doctrine/Tests/Mocks/DatabasePlatformMock.php index aeca0fd6dde..5a5ecf054c8 100644 --- a/tests/Doctrine/Tests/Mocks/DatabasePlatformMock.php +++ b/tests/Doctrine/Tests/Mocks/DatabasePlatformMock.php @@ -6,16 +6,16 @@ class DatabasePlatformMock extends \Doctrine\DBAL\Platforms\AbstractPlatform { - private $_sequenceNextValSql = ""; - private $_prefersIdentityColumns = true; - private $_prefersSequences = false; + private $sequenceNextValSql = ""; + private $prefersIdentityColumns = true; + private $prefersSequences = false; /** * @override */ public function prefersIdentityColumns() { - return $this->_prefersIdentityColumns; + return $this->prefersIdentityColumns; } /** @@ -23,13 +23,13 @@ public function prefersIdentityColumns() */ public function prefersSequences() { - return $this->_prefersSequences; + return $this->prefersSequences; } /** @override */ public function getSequenceNextValSQL($sequenceName) { - return $this->_sequenceNextValSql; + return $this->sequenceNextValSql; } /** @override */ @@ -45,7 +45,7 @@ public function getBigIntTypeDeclarationSQL(array $field) {} public function getSmallIntTypeDeclarationSQL(array $field) {} /** @override */ - protected function _getCommonIntegerTypeDeclarationSQL(array $columnDef) {} + protected function getCommonIntegerTypeDeclarationSQL(array $columnDef) {} /** @override */ public function getVarcharTypeDeclarationSQL(array $field) {} @@ -57,17 +57,17 @@ public function getClobTypeDeclarationSQL(array $field) {} public function setPrefersIdentityColumns($bool) { - $this->_prefersIdentityColumns = $bool; + $this->prefersIdentityColumns = $bool; } public function setPrefersSequences($bool) { - $this->_prefersSequences = $bool; + $this->prefersSequences = $bool; } public function setSequenceNextValSql($sql) { - $this->_sequenceNextValSql = $sql; + $this->sequenceNextValSql = $sql; } public function getName() diff --git a/tests/Doctrine/Tests/Mocks/DriverMock.php b/tests/Doctrine/Tests/Mocks/DriverMock.php index f115a0067e8..8e9d45aad9b 100644 --- a/tests/Doctrine/Tests/Mocks/DriverMock.php +++ b/tests/Doctrine/Tests/Mocks/DriverMock.php @@ -5,9 +5,9 @@ class DriverMock implements \Doctrine\DBAL\Driver { - private $_platformMock; + private $platformMock; - private $_schemaManagerMock; + private $schemaManagerMock; public function connect(array $params, $username = null, $password = null, array $driverOptions = array()) { @@ -20,7 +20,7 @@ public function connect(array $params, $username = null, $password = null, array * @return string The DSN. * @override */ - protected function _constructPdoDsn(array $params) + protected function constructPdoDsn(array $params) { return ""; } @@ -30,10 +30,10 @@ protected function _constructPdoDsn(array $params) */ public function getDatabasePlatform() { - if ( ! $this->_platformMock) { - $this->_platformMock = new DatabasePlatformMock; + if ( ! $this->platformMock) { + $this->platformMock = new DatabasePlatformMock; } - return $this->_platformMock; + return $this->platformMock; } /** @@ -41,23 +41,23 @@ public function getDatabasePlatform() */ public function getSchemaManager(\Doctrine\DBAL\Connection $conn) { - if($this->_schemaManagerMock == null) { + if($this->schemaManagerMock == null) { return new SchemaManagerMock($conn); } - return $this->_schemaManagerMock; + return $this->schemaManagerMock; } /* MOCK API */ public function setDatabasePlatform(\Doctrine\DBAL\Platforms\AbstractPlatform $platform) { - $this->_platformMock = $platform; + $this->platformMock = $platform; } public function setSchemaManager(\Doctrine\DBAL\Schema\AbstractSchemaManager $sm) { - $this->_schemaManagerMock = $sm; + $this->schemaManagerMock = $sm; } public function getName() diff --git a/tests/Doctrine/Tests/Mocks/SchemaManagerMock.php b/tests/Doctrine/Tests/Mocks/SchemaManagerMock.php index d4c3c28c004..49647bf5196 100644 --- a/tests/Doctrine/Tests/Mocks/SchemaManagerMock.php +++ b/tests/Doctrine/Tests/Mocks/SchemaManagerMock.php @@ -9,5 +9,5 @@ public function __construct(\Doctrine\DBAL\Connection $conn) parent::__construct($conn); } - protected function _getPortableTableColumnDefinition($tableColumn) {} + protected function getPortableTableColumnDefinition($tableColumn) {} } \ No newline at end of file