Manual fixes

parent 73bd82a3
<?php
/*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the MIT license. For more information, see
* <http://www.doctrine-project.org>.
*/
namespace Doctrine\Tests\DBAL;
......
......@@ -3,6 +3,7 @@
namespace Doctrine\Tests\DBAL\Driver;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Driver\AbstractDB2Driver;
use Doctrine\DBAL\Platforms\DB2Platform;
use Doctrine\DBAL\Schema\DB2SchemaManager;
......@@ -10,7 +11,7 @@ class AbstractDB2DriverTest extends AbstractDriverTest
{
protected function createDriver()
{
return $this->getMockForAbstractClass('Doctrine\DBAL\Driver\AbstractDB2Driver');
return $this->getMockForAbstractClass(AbstractDB2Driver::class);
}
protected function createPlatform()
......
......@@ -4,8 +4,25 @@ namespace Doctrine\Tests\DBAL\Driver;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Driver;
use Doctrine\DBAL\Driver\DriverException;
use Doctrine\DBAL\Driver\DriverException as DriverExceptionInterface;
use Doctrine\DBAL\Driver\ExceptionConverterDriver;
use Doctrine\DBAL\Exception\ConnectionException;
use Doctrine\DBAL\Exception\ConstraintViolationException;
use Doctrine\DBAL\Exception\DatabaseObjectExistsException;
use Doctrine\DBAL\Exception\DatabaseObjectNotFoundException;
use Doctrine\DBAL\Exception\DeadlockException;
use Doctrine\DBAL\Exception\DriverException;
use Doctrine\DBAL\Exception\ForeignKeyConstraintViolationException;
use Doctrine\DBAL\Exception\InvalidFieldNameException;
use Doctrine\DBAL\Exception\LockWaitTimeoutException;
use Doctrine\DBAL\Exception\NonUniqueFieldNameException;
use Doctrine\DBAL\Exception\NotNullConstraintViolationException;
use Doctrine\DBAL\Exception\ReadOnlyException;
use Doctrine\DBAL\Exception\ServerException;
use Doctrine\DBAL\Exception\SyntaxErrorException;
use Doctrine\DBAL\Exception\TableExistsException;
use Doctrine\DBAL\Exception\TableNotFoundException;
use Doctrine\DBAL\Exception\UniqueConstraintViolationException;
use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Schema\AbstractSchemaManager;
use Doctrine\DBAL\VersionAwarePlatformDriver;
......@@ -16,23 +33,23 @@ use function sprintf;
abstract class AbstractDriverTest extends DbalTestCase
{
public const EXCEPTION_CONNECTION = 'Doctrine\DBAL\Exception\ConnectionException';
public const EXCEPTION_CONSTRAINT_VIOLATION = 'Doctrine\DBAL\Exception\ConstraintViolationException';
public const EXCEPTION_DATABASE_OBJECT_EXISTS = 'Doctrine\DBAL\Exception\DatabaseObjectExistsException';
public const EXCEPTION_DATABASE_OBJECT_NOT_FOUND = 'Doctrine\DBAL\Exception\DatabaseObjectNotFoundException';
public const EXCEPTION_DRIVER = 'Doctrine\DBAL\Exception\DriverException';
public const EXCEPTION_FOREIGN_KEY_CONSTRAINT_VIOLATION = 'Doctrine\DBAL\Exception\ForeignKeyConstraintViolationException';
public const EXCEPTION_INVALID_FIELD_NAME = 'Doctrine\DBAL\Exception\InvalidFieldNameException';
public const EXCEPTION_NON_UNIQUE_FIELD_NAME = 'Doctrine\DBAL\Exception\NonUniqueFieldNameException';
public const EXCEPTION_NOT_NULL_CONSTRAINT_VIOLATION = 'Doctrine\DBAL\Exception\NotNullConstraintViolationException';
public const EXCEPTION_READ_ONLY = 'Doctrine\DBAL\Exception\ReadOnlyException';
public const EXCEPTION_SERVER = 'Doctrine\DBAL\Exception\ServerException';
public const EXCEPTION_SYNTAX_ERROR = 'Doctrine\DBAL\Exception\SyntaxErrorException';
public const EXCEPTION_TABLE_EXISTS = 'Doctrine\DBAL\Exception\TableExistsException';
public const EXCEPTION_TABLE_NOT_FOUND = 'Doctrine\DBAL\Exception\TableNotFoundException';
public const EXCEPTION_UNIQUE_CONSTRAINT_VIOLATION = 'Doctrine\DBAL\Exception\UniqueConstraintViolationException';
public const EXCEPTION_DEADLOCK = 'Doctrine\DBAL\Exception\DeadlockException';
public const EXCEPTION_LOCK_WAIT_TIMEOUT = 'Doctrine\DBAL\Exception\LockWaitTimeoutException';
public const EXCEPTION_CONNECTION = ConnectionException::class;
public const EXCEPTION_CONSTRAINT_VIOLATION = ConstraintViolationException::class;
public const EXCEPTION_DATABASE_OBJECT_EXISTS = DatabaseObjectExistsException::class;
public const EXCEPTION_DATABASE_OBJECT_NOT_FOUND = DatabaseObjectNotFoundException::class;
public const EXCEPTION_DRIVER = DriverException::class;
public const EXCEPTION_FOREIGN_KEY_CONSTRAINT_VIOLATION = ForeignKeyConstraintViolationException::class;
public const EXCEPTION_INVALID_FIELD_NAME = InvalidFieldNameException::class;
public const EXCEPTION_NON_UNIQUE_FIELD_NAME = NonUniqueFieldNameException::class;
public const EXCEPTION_NOT_NULL_CONSTRAINT_VIOLATION = NotNullConstraintViolationException::class;
public const EXCEPTION_READ_ONLY = ReadOnlyException::class;
public const EXCEPTION_SERVER = ServerException::class;
public const EXCEPTION_SYNTAX_ERROR = SyntaxErrorException::class;
public const EXCEPTION_TABLE_EXISTS = TableExistsException::class;
public const EXCEPTION_TABLE_NOT_FOUND = TableNotFoundException::class;
public const EXCEPTION_UNIQUE_CONSTRAINT_VIOLATION = UniqueConstraintViolationException::class;
public const EXCEPTION_DEADLOCK = DeadlockException::class;
public const EXCEPTION_LOCK_WAIT_TIMEOUT = LockWaitTimeoutException::class;
/**
* The driver mock under test.
......@@ -66,7 +83,7 @@ abstract class AbstractDriverTest extends DbalTestCase
);
}
$driverException = new class extends Exception implements DriverException
$driverException = new class extends Exception implements DriverExceptionInterface
{
public function __construct()
{
......@@ -215,7 +232,7 @@ abstract class AbstractDriverTest extends DbalTestCase
protected function getConnectionMock()
{
return $this->getMockBuilder('Doctrine\DBAL\Connection')
return $this->getMockBuilder(Connection::class)
->disableOriginalConstructor()
->getMock();
}
......@@ -238,7 +255,7 @@ abstract class AbstractDriverTest extends DbalTestCase
foreach ($errors as $error) {
$driverException = new class ($error[0], $error[1], $error[2])
extends Exception
implements DriverException
implements DriverExceptionInterface
{
/** @var mixed */
private $errorCode;
......
......@@ -3,11 +3,13 @@
namespace Doctrine\Tests\DBAL\Driver;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Driver\AbstractMySQLDriver;
use Doctrine\DBAL\Platforms\MariaDb1027Platform;
use Doctrine\DBAL\Platforms\MySQL57Platform;
use Doctrine\DBAL\Platforms\MySQL80Platform;
use Doctrine\DBAL\Platforms\MySqlPlatform;
use Doctrine\DBAL\Schema\MySqlSchemaManager;
use Doctrine\Tests\Mocks\DriverResultStatementMock;
class AbstractMySQLDriverTest extends AbstractDriverTest
{
......@@ -21,7 +23,7 @@ class AbstractMySQLDriverTest extends AbstractDriverTest
'password' => 'bar',
];
$statement = $this->createMock('Doctrine\Tests\Mocks\DriverResultStatementMock');
$statement = $this->createMock(DriverResultStatementMock::class);
$statement->expects($this->once())
->method('fetchColumn')
......@@ -42,7 +44,7 @@ class AbstractMySQLDriverTest extends AbstractDriverTest
protected function createDriver()
{
return $this->getMockForAbstractClass('Doctrine\DBAL\Driver\AbstractMySQLDriver');
return $this->getMockForAbstractClass(AbstractMySQLDriver::class);
}
protected function createPlatform()
......@@ -55,6 +57,9 @@ class AbstractMySQLDriverTest extends AbstractDriverTest
return new MySqlSchemaManager($connection);
}
/**
* @return mixed[][]
*/
protected function getDatabasePlatformsForVersions() : array
{
return [
......
......@@ -3,6 +3,7 @@
namespace Doctrine\Tests\DBAL\Driver;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Driver\AbstractOracleDriver;
use Doctrine\DBAL\Platforms\OraclePlatform;
use Doctrine\DBAL\Schema\OracleSchemaManager;
......@@ -46,7 +47,7 @@ class AbstractOracleDriverTest extends AbstractDriverTest
protected function createDriver()
{
return $this->getMockForAbstractClass('Doctrine\DBAL\Driver\AbstractOracleDriver');
return $this->getMockForAbstractClass(AbstractOracleDriver::class);
}
protected function createPlatform()
......
......@@ -3,9 +3,14 @@
namespace Doctrine\Tests\DBAL\Driver;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Driver\AbstractPostgreSQLDriver;
use Doctrine\DBAL\Platforms\PostgreSQL100Platform;
use Doctrine\DBAL\Platforms\PostgreSQL91Platform;
use Doctrine\DBAL\Platforms\PostgreSQL92Platform;
use Doctrine\DBAL\Platforms\PostgreSQL94Platform;
use Doctrine\DBAL\Platforms\PostgreSqlPlatform;
use Doctrine\DBAL\Schema\PostgreSqlSchemaManager;
use Doctrine\Tests\Mocks\DriverResultStatementMock;
class AbstractPostgreSQLDriverTest extends AbstractDriverTest
{
......@@ -19,7 +24,7 @@ class AbstractPostgreSQLDriverTest extends AbstractDriverTest
'password' => 'bar',
];
$statement = $this->createMock('Doctrine\Tests\Mocks\DriverResultStatementMock');
$statement = $this->createMock(DriverResultStatementMock::class);
$statement->expects($this->once())
->method('fetchColumn')
......@@ -40,7 +45,7 @@ class AbstractPostgreSQLDriverTest extends AbstractDriverTest
protected function createDriver()
{
return $this->getMockForAbstractClass('Doctrine\DBAL\Driver\AbstractPostgreSQLDriver');
return $this->getMockForAbstractClass(AbstractPostgreSQLDriver::class);
}
protected function createPlatform()
......@@ -56,18 +61,18 @@ class AbstractPostgreSQLDriverTest extends AbstractDriverTest
protected function getDatabasePlatformsForVersions()
{
return [
['9.0.9', 'Doctrine\DBAL\Platforms\PostgreSqlPlatform'],
['9.1', 'Doctrine\DBAL\Platforms\PostgreSQL91Platform'],
['9.1.0', 'Doctrine\DBAL\Platforms\PostgreSQL91Platform'],
['9.1.1', 'Doctrine\DBAL\Platforms\PostgreSQL91Platform'],
['9.1.9', 'Doctrine\DBAL\Platforms\PostgreSQL91Platform'],
['9.2', 'Doctrine\DBAL\Platforms\PostgreSQL92Platform'],
['9.2.0', 'Doctrine\DBAL\Platforms\PostgreSQL92Platform'],
['9.2.1', 'Doctrine\DBAL\Platforms\PostgreSQL92Platform'],
['9.3.6', 'Doctrine\DBAL\Platforms\PostgreSQL92Platform'],
['9.4', 'Doctrine\DBAL\Platforms\PostgreSQL94Platform'],
['9.4.0', 'Doctrine\DBAL\Platforms\PostgreSQL94Platform'],
['9.4.1', 'Doctrine\DBAL\Platforms\PostgreSQL94Platform'],
['9.0.9', PostgreSqlPlatform::class],
['9.1', PostgreSQL91Platform::class],
['9.1.0', PostgreSQL91Platform::class],
['9.1.1', PostgreSQL91Platform::class],
['9.1.9', PostgreSQL91Platform::class],
['9.2', PostgreSQL92Platform::class],
['9.2.0', PostgreSQL92Platform::class],
['9.2.1', PostgreSQL92Platform::class],
['9.3.6', PostgreSQL92Platform::class],
['9.4', PostgreSQL94Platform::class],
['9.4.0', PostgreSQL94Platform::class],
['9.4.1', PostgreSQL94Platform::class],
['10', PostgreSQL100Platform::class],
];
}
......
......@@ -3,14 +3,18 @@
namespace Doctrine\Tests\DBAL\Driver;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Driver\AbstractSQLAnywhereDriver;
use Doctrine\DBAL\Platforms\SQLAnywhere11Platform;
use Doctrine\DBAL\Platforms\SQLAnywhere12Platform;
use Doctrine\DBAL\Platforms\SQLAnywhere16Platform;
use Doctrine\DBAL\Platforms\SQLAnywherePlatform;
use Doctrine\DBAL\Schema\SQLAnywhereSchemaManager;
class AbstractSQLAnywhereDriverTest extends AbstractDriverTest
{
protected function createDriver()
{
return $this->getMockForAbstractClass('Doctrine\DBAL\Driver\AbstractSQLAnywhereDriver');
return $this->getMockForAbstractClass(AbstractSQLAnywhereDriver::class);
}
protected function createPlatform()
......@@ -26,35 +30,35 @@ class AbstractSQLAnywhereDriverTest extends AbstractDriverTest
protected function getDatabasePlatformsForVersions()
{
return [
['10', 'Doctrine\DBAL\Platforms\SQLAnywherePlatform'],
['10.0', 'Doctrine\DBAL\Platforms\SQLAnywherePlatform'],
['10.0.0', 'Doctrine\DBAL\Platforms\SQLAnywherePlatform'],
['10.0.0.0', 'Doctrine\DBAL\Platforms\SQLAnywherePlatform'],
['10.1.2.3', 'Doctrine\DBAL\Platforms\SQLAnywherePlatform'],
['10.9.9.9', 'Doctrine\DBAL\Platforms\SQLAnywherePlatform'],
['11', 'Doctrine\DBAL\Platforms\SQLAnywhere11Platform'],
['11.0', 'Doctrine\DBAL\Platforms\SQLAnywhere11Platform'],
['11.0.0', 'Doctrine\DBAL\Platforms\SQLAnywhere11Platform'],
['11.0.0.0', 'Doctrine\DBAL\Platforms\SQLAnywhere11Platform'],
['11.1.2.3', 'Doctrine\DBAL\Platforms\SQLAnywhere11Platform'],
['11.9.9.9', 'Doctrine\DBAL\Platforms\SQLAnywhere11Platform'],
['12', 'Doctrine\DBAL\Platforms\SQLAnywhere12Platform'],
['12.0', 'Doctrine\DBAL\Platforms\SQLAnywhere12Platform'],
['12.0.0', 'Doctrine\DBAL\Platforms\SQLAnywhere12Platform'],
['12.0.0.0', 'Doctrine\DBAL\Platforms\SQLAnywhere12Platform'],
['12.1.2.3', 'Doctrine\DBAL\Platforms\SQLAnywhere12Platform'],
['12.9.9.9', 'Doctrine\DBAL\Platforms\SQLAnywhere12Platform'],
['13', 'Doctrine\DBAL\Platforms\SQLAnywhere12Platform'],
['14', 'Doctrine\DBAL\Platforms\SQLAnywhere12Platform'],
['15', 'Doctrine\DBAL\Platforms\SQLAnywhere12Platform'],
['15.9.9.9', 'Doctrine\DBAL\Platforms\SQLAnywhere12Platform'],
['16', 'Doctrine\DBAL\Platforms\SQLAnywhere16Platform'],
['16.0', 'Doctrine\DBAL\Platforms\SQLAnywhere16Platform'],
['16.0.0', 'Doctrine\DBAL\Platforms\SQLAnywhere16Platform'],
['16.0.0.0', 'Doctrine\DBAL\Platforms\SQLAnywhere16Platform'],
['16.1.2.3', 'Doctrine\DBAL\Platforms\SQLAnywhere16Platform'],
['16.9.9.9', 'Doctrine\DBAL\Platforms\SQLAnywhere16Platform'],
['17', 'Doctrine\DBAL\Platforms\SQLAnywhere16Platform'],
['10', SQLAnywherePlatform::class],
['10.0', SQLAnywherePlatform::class],
['10.0.0', SQLAnywherePlatform::class],
['10.0.0.0', SQLAnywherePlatform::class],
['10.1.2.3', SQLAnywherePlatform::class],
['10.9.9.9', SQLAnywherePlatform::class],
['11', SQLAnywhere11Platform::class],
['11.0', SQLAnywhere11Platform::class],
['11.0.0', SQLAnywhere11Platform::class],
['11.0.0.0', SQLAnywhere11Platform::class],
['11.1.2.3', SQLAnywhere11Platform::class],
['11.9.9.9', SQLAnywhere11Platform::class],
['12', SQLAnywhere12Platform::class],
['12.0', SQLAnywhere12Platform::class],
['12.0.0', SQLAnywhere12Platform::class],
['12.0.0.0', SQLAnywhere12Platform::class],
['12.1.2.3', SQLAnywhere12Platform::class],
['12.9.9.9', SQLAnywhere12Platform::class],
['13', SQLAnywhere12Platform::class],
['14', SQLAnywhere12Platform::class],
['15', SQLAnywhere12Platform::class],
['15.9.9.9', SQLAnywhere12Platform::class],
['16', SQLAnywhere16Platform::class],
['16.0', SQLAnywhere16Platform::class],
['16.0.0', SQLAnywhere16Platform::class],
['16.0.0.0', SQLAnywhere16Platform::class],
['16.1.2.3', SQLAnywhere16Platform::class],
['16.9.9.9', SQLAnywhere16Platform::class],
['17', SQLAnywhere16Platform::class],
];
}
......
......@@ -3,14 +3,18 @@
namespace Doctrine\Tests\DBAL\Driver;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Driver\AbstractSQLServerDriver;
use Doctrine\DBAL\Platforms\SQLServer2005Platform;
use Doctrine\DBAL\Platforms\SQLServer2008Platform;
use Doctrine\DBAL\Platforms\SQLServer2012Platform;
use Doctrine\DBAL\Platforms\SQLServerPlatform;
use Doctrine\DBAL\Schema\SQLServerSchemaManager;
class AbstractSQLServerDriverTest extends AbstractDriverTest
{
protected function createDriver()
{
return $this->getMockForAbstractClass('Doctrine\DBAL\Driver\AbstractSQLServerDriver');
return $this->getMockForAbstractClass(AbstractSQLServerDriver::class);
}
protected function createPlatform()
......@@ -26,32 +30,32 @@ class AbstractSQLServerDriverTest extends AbstractDriverTest
protected function getDatabasePlatformsForVersions()
{
return [
['9', 'Doctrine\DBAL\Platforms\SQLServerPlatform'],
['9.00', 'Doctrine\DBAL\Platforms\SQLServerPlatform'],
['9.00.0', 'Doctrine\DBAL\Platforms\SQLServerPlatform'],
['9.00.1398', 'Doctrine\DBAL\Platforms\SQLServerPlatform'],
['9.00.1398.99', 'Doctrine\DBAL\Platforms\SQLServerPlatform'],
['9.00.1399', 'Doctrine\DBAL\Platforms\SQLServer2005Platform'],
['9.00.1399.0', 'Doctrine\DBAL\Platforms\SQLServer2005Platform'],
['9.00.1399.99', 'Doctrine\DBAL\Platforms\SQLServer2005Platform'],
['9.00.1400', 'Doctrine\DBAL\Platforms\SQLServer2005Platform'],
['9.10', 'Doctrine\DBAL\Platforms\SQLServer2005Platform'],
['9.10.9999', 'Doctrine\DBAL\Platforms\SQLServer2005Platform'],
['10.00.1599', 'Doctrine\DBAL\Platforms\SQLServer2005Platform'],
['10.00.1599.99', 'Doctrine\DBAL\Platforms\SQLServer2005Platform'],
['10.00.1600', 'Doctrine\DBAL\Platforms\SQLServer2008Platform'],
['10.00.1600.0', 'Doctrine\DBAL\Platforms\SQLServer2008Platform'],
['10.00.1600.99', 'Doctrine\DBAL\Platforms\SQLServer2008Platform'],
['10.00.1601', 'Doctrine\DBAL\Platforms\SQLServer2008Platform'],
['10.10', 'Doctrine\DBAL\Platforms\SQLServer2008Platform'],
['10.10.9999', 'Doctrine\DBAL\Platforms\SQLServer2008Platform'],
['11.00.2099', 'Doctrine\DBAL\Platforms\SQLServer2008Platform'],
['11.00.2099.99', 'Doctrine\DBAL\Platforms\SQLServer2008Platform'],
['11.00.2100', 'Doctrine\DBAL\Platforms\SQLServer2012Platform'],
['11.00.2100.0', 'Doctrine\DBAL\Platforms\SQLServer2012Platform'],
['11.00.2100.99', 'Doctrine\DBAL\Platforms\SQLServer2012Platform'],
['11.00.2101', 'Doctrine\DBAL\Platforms\SQLServer2012Platform'],
['12', 'Doctrine\DBAL\Platforms\SQLServer2012Platform'],
['9', SQLServerPlatform::class],
['9.00', SQLServerPlatform::class],
['9.00.0', SQLServerPlatform::class],
['9.00.1398', SQLServerPlatform::class],
['9.00.1398.99', SQLServerPlatform::class],
['9.00.1399', SQLServer2005Platform::class],
['9.00.1399.0', SQLServer2005Platform::class],
['9.00.1399.99', SQLServer2005Platform::class],
['9.00.1400', SQLServer2005Platform::class],
['9.10', SQLServer2005Platform::class],
['9.10.9999', SQLServer2005Platform::class],
['10.00.1599', SQLServer2005Platform::class],
['10.00.1599.99', SQLServer2005Platform::class],
['10.00.1600', SQLServer2008Platform::class],
['10.00.1600.0', SQLServer2008Platform::class],
['10.00.1600.99', SQLServer2008Platform::class],
['10.00.1601', SQLServer2008Platform::class],
['10.10', SQLServer2008Platform::class],
['10.10.9999', SQLServer2008Platform::class],
['11.00.2099', SQLServer2008Platform::class],
['11.00.2099.99', SQLServer2008Platform::class],
['11.00.2100', SQLServer2012Platform::class],
['11.00.2100.0', SQLServer2012Platform::class],
['11.00.2100.99', SQLServer2012Platform::class],
['11.00.2101', SQLServer2012Platform::class],
['12', SQLServer2012Platform::class],
];
}
}
......@@ -3,6 +3,7 @@
namespace Doctrine\Tests\DBAL\Driver;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Driver\AbstractSQLiteDriver;
use Doctrine\DBAL\Platforms\SqlitePlatform;
use Doctrine\DBAL\Schema\SqliteSchemaManager;
......@@ -28,7 +29,7 @@ class AbstractSQLiteDriverTest extends AbstractDriverTest
protected function createDriver()
{
return $this->getMockForAbstractClass('Doctrine\DBAL\Driver\AbstractSQLiteDriver');
return $this->getMockForAbstractClass(AbstractSQLiteDriver::class);
}
protected function createPlatform()
......
......@@ -35,12 +35,15 @@ class DriverTest extends PDOMySQLDriverTest
return new DrizzleSchemaManager($connection);
}
/**
* @return mixed[][]
*/
protected function getDatabasePlatformsForVersions() : array
{
return [
['foo', 'Doctrine\DBAL\Platforms\DrizzlePlatform'],
['bar', 'Doctrine\DBAL\Platforms\DrizzlePlatform'],
['baz', 'Doctrine\DBAL\Platforms\DrizzlePlatform'],
['foo', DrizzlePlatform::class],
['bar', DrizzlePlatform::class],
['baz', DrizzlePlatform::class],
];
}
}
......@@ -24,7 +24,7 @@ class DB2ConnectionTest extends DbalTestCase
parent::setUp();
$this->connectionMock = $this->getMockBuilder('Doctrine\DBAL\Driver\IBMDB2\DB2Connection')
$this->connectionMock = $this->getMockBuilder(DB2Connection::class)
->disableOriginalConstructor()
->getMockForAbstractClass();
}
......
......@@ -28,7 +28,7 @@ class MysqliConnectionTest extends DbalFunctionalTestCase
parent::setUp();
if (! $this->_conn->getDatabasePlatform() instanceof MySqlPlatform) {
if (! $this->connection->getDatabasePlatform() instanceof MySqlPlatform) {
$this->markTestSkipped('MySQL only test.');
}
......
......@@ -24,7 +24,7 @@ class OCI8ConnectionTest extends DbalTestCase
parent::setUp();
$this->connectionMock = $this->getMockBuilder('Doctrine\DBAL\Driver\OCI8\OCI8Connection')
$this->connectionMock = $this->getMockBuilder(OCI8Connection::class)
->disableOriginalConstructor()
->getMockForAbstractClass();
}
......
......@@ -2,6 +2,7 @@
namespace Doctrine\Tests\DBAL\Driver\OCI8;
use Doctrine\DBAL\Driver\OCI8\OCI8Connection;
use Doctrine\DBAL\Driver\OCI8\OCI8Exception;
use Doctrine\DBAL\Driver\OCI8\OCI8Statement;
use Doctrine\Tests\DbalTestCase;
......@@ -28,12 +29,14 @@ class OCI8StatementTest extends DbalTestCase
*
* The expected exception is due to oci_execute failing due to no valid connection.
*
* @param mixed[] $params
*
* @dataProvider executeDataProvider
* @expectedException \Doctrine\DBAL\Driver\OCI8\OCI8Exception
*/
public function testExecute(array $params)
{
$statement = $this->getMockBuilder('\Doctrine\DBAL\Driver\OCI8\OCI8Statement')
$statement = $this->getMockBuilder(OCI8Statement::class)
->setMethods(['bindValue', 'errorInfo'])
->disableOriginalConstructor()
->getMock();
......@@ -59,7 +62,7 @@ class OCI8StatementTest extends DbalTestCase
// can't pass to constructor since we don't have a real database handle,
// but execute must check the connection for the executeMode
$conn = $this->getMockBuilder('\Doctrine\DBAL\Driver\OCI8\OCI8Connection')
$conn = $this->getMockBuilder(OCI8Connection::class)
->setMethods(['getExecuteMode'])
->disableOriginalConstructor()
->getMock();
......
......@@ -2,6 +2,7 @@
namespace Doctrine\Tests\DBAL\Driver\PDOPgSql;
use Doctrine\DBAL\Driver\PDOConnection;
use Doctrine\DBAL\Driver\PDOPgSql\Driver;
use Doctrine\Tests\DBAL\Driver\AbstractPostgreSQLDriverTest;
use PDO;
......@@ -32,7 +33,7 @@ class DriverTest extends AbstractPostgreSQLDriverTest
$GLOBALS['db_password']
);
self::assertInstanceOf('Doctrine\DBAL\Driver\PDOConnection', $connection);
self::assertInstanceOf(PDOConnection::class, $connection);
try {
self::assertTrue($connection->getAttribute(PDO::PGSQL_ATTR_DISABLE_PREPARES));
......@@ -59,7 +60,7 @@ class DriverTest extends AbstractPostgreSQLDriverTest
[PDO::PGSQL_ATTR_DISABLE_PREPARES => false]
);
self::assertInstanceOf('Doctrine\DBAL\Driver\PDOConnection', $connection);
self::assertInstanceOf(PDOConnection::class, $connection);
try {
self::assertNotSame(true, $connection->getAttribute(PDO::PGSQL_ATTR_DISABLE_PREPARES));
......@@ -86,7 +87,7 @@ class DriverTest extends AbstractPostgreSQLDriverTest
[PDO::PGSQL_ATTR_DISABLE_PREPARES => true]
);
self::assertInstanceOf('Doctrine\DBAL\Driver\PDOConnection', $connection);
self::assertInstanceOf(PDOConnection::class, $connection);
try {
self::assertTrue($connection->getAttribute(PDO::PGSQL_ATTR_DISABLE_PREPARES));
......
......@@ -24,7 +24,7 @@ class SQLAnywhereConnectionTest extends DbalTestCase
parent::setUp();
$this->connectionMock = $this->getMockBuilder('Doctrine\DBAL\Driver\SQLAnywhere\SQLAnywhereConnection')
$this->connectionMock = $this->getMockBuilder(SQLAnywhereConnection::class)
->disableOriginalConstructor()
->getMockForAbstractClass();
}
......
......@@ -24,7 +24,7 @@ class SQLSrvConnectionTest extends DbalTestCase
parent::setUp();
$this->connectionMock = $this->getMockBuilder('Doctrine\DBAL\Driver\SQLSrv\SQLSrvConnection')
$this->connectionMock = $this->getMockBuilder(SQLSrvConnection::class)
->disableOriginalConstructor()
->getMockForAbstractClass();
}
......
......@@ -2,6 +2,7 @@
namespace Doctrine\Tests\DBAL\Events;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Event\ConnectionEventArgs;
use Doctrine\DBAL\Event\Listeners\MysqlSessionInit;
use Doctrine\DBAL\Events;
......@@ -11,7 +12,7 @@ class MysqlSessionInitTest extends DbalTestCase
{
public function testPostConnect()
{
$connectionMock = $this->createMock('Doctrine\DBAL\Connection');
$connectionMock = $this->createMock(Connection::class);
$connectionMock->expects($this->once())
->method('executeUpdate')
->with($this->equalTo('SET NAMES foo COLLATE bar'));
......
......@@ -2,6 +2,7 @@
namespace Doctrine\Tests\DBAL\Events;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Event\ConnectionEventArgs;
use Doctrine\DBAL\Event\Listeners\OracleSessionInit;
use Doctrine\DBAL\Events;
......@@ -12,7 +13,7 @@ class OracleSessionInitTest extends DbalTestCase
{
public function testPostConnect()
{
$connectionMock = $this->createMock('Doctrine\DBAL\Connection');
$connectionMock = $this->createMock(Connection::class);
$connectionMock->expects($this->once())
->method('executeUpdate')
->with($this->isType('string'));
......@@ -29,7 +30,7 @@ class OracleSessionInitTest extends DbalTestCase
*/
public function testPostConnectQuotesSessionParameterValues($name, $value)
{
$connectionMock = $this->getMockBuilder('Doctrine\DBAL\Connection')
$connectionMock = $this->getMockBuilder(Connection::class)
->disableOriginalConstructor()
->getMock();
$connectionMock->expects($this->once())
......
......@@ -2,6 +2,7 @@
namespace Doctrine\Tests\DBAL\Events;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Event\ConnectionEventArgs;
use Doctrine\DBAL\Event\Listeners\SQLSessionInit;
use Doctrine\DBAL\Events;
......@@ -14,7 +15,7 @@ class SQLSessionInitTest extends DbalTestCase
{
public function testPostConnect()
{
$connectionMock = $this->createMock('Doctrine\DBAL\Connection');
$connectionMock = $this->createMock(Connection::class);
$connectionMock->expects($this->once())
->method('exec')
->with($this->equalTo("SET SEARCH_PATH TO foo, public, TIMEZONE TO 'Europe/Berlin'"));
......
<?php
/*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the MIT license. For more information, see
* <http://www.doctrine-project.org>.
*/
namespace Doctrine\Tests\DBAL\Exception;
......@@ -33,7 +16,7 @@ class InvalidArgumentExceptionTest extends TestCase
{
$exception = InvalidArgumentException::fromEmptyCriteria();
self::assertInstanceOf('Doctrine\DBAL\Exception\InvalidArgumentException', $exception);
self::assertInstanceOf(InvalidArgumentException::class, $exception);
self::assertSame('Empty criteria was used, expected non-empty criteria', $exception->getMessage());
}
}
......@@ -23,7 +23,7 @@ class BlobTest extends DbalFunctionalTestCase
{
parent::setUp();
if ($this->_conn->getDriver() instanceof PDOSQLSrvDriver) {
if ($this->connection->getDriver() instanceof PDOSQLSrvDriver) {
$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');
}
......@@ -34,13 +34,13 @@ class BlobTest extends DbalFunctionalTestCase
$table->addColumn('blobfield', 'blob');
$table->setPrimaryKey(['id']);
$sm = $this->_conn->getSchemaManager();
$sm = $this->connection->getSchemaManager();
$sm->dropAndCreateTable($table);
}
public function testInsert()
{
$ret = $this->_conn->insert('blob_table', [
$ret = $this->connection->insert('blob_table', [
'id' => 1,
'clobfield' => 'test',
'blobfield' => 'test',
......@@ -55,14 +55,14 @@ class BlobTest extends DbalFunctionalTestCase
public function testInsertProcessesStream()
{
if (in_array($this->_conn->getDatabasePlatform()->getName(), ['oracle', 'db2'], true)) {
if (in_array($this->connection->getDatabasePlatform()->getName(), ['oracle', 'db2'], true)) {
// https://github.com/doctrine/dbal/issues/3288 for DB2
// https://github.com/doctrine/dbal/issues/3290 for Oracle
$this->markTestIncomplete('Platform does not support stream resources as parameters');
}
$longBlob = str_repeat('x', 4 * 8192); // send 4 chunks
$this->_conn->insert('blob_table', [
$this->connection->insert('blob_table', [
'id' => 1,
'clobfield' => 'ignored',
'blobfield' => fopen('data://text/plain,' . $longBlob, 'r'),
......@@ -77,7 +77,7 @@ class BlobTest extends DbalFunctionalTestCase
public function testSelect()
{
$this->_conn->insert('blob_table', [
$this->connection->insert('blob_table', [
'id' => 1,
'clobfield' => 'test',
'blobfield' => 'test',
......@@ -92,7 +92,7 @@ class BlobTest extends DbalFunctionalTestCase
public function testUpdate()
{
$this->_conn->insert('blob_table', [
$this->connection->insert('blob_table', [
'id' => 1,
'clobfield' => 'test',
'blobfield' => 'test',
......@@ -102,7 +102,7 @@ class BlobTest extends DbalFunctionalTestCase
ParameterType::LARGE_OBJECT,
]);
$this->_conn->update('blob_table', ['blobfield' => 'test2'], ['id' => 1], [
$this->connection->update('blob_table', ['blobfield' => 'test2'], ['id' => 1], [
ParameterType::LARGE_OBJECT,
ParameterType::INTEGER,
]);
......@@ -112,13 +112,13 @@ class BlobTest extends DbalFunctionalTestCase
public function testUpdateProcessesStream()
{
if (in_array($this->_conn->getDatabasePlatform()->getName(), ['oracle', 'db2'], true)) {
if (in_array($this->connection->getDatabasePlatform()->getName(), ['oracle', 'db2'], true)) {
// https://github.com/doctrine/dbal/issues/3288 for DB2
// https://github.com/doctrine/dbal/issues/3290 for Oracle
$this->markTestIncomplete('Platform does not support stream resources as parameters');
}
$this->_conn->insert('blob_table', [
$this->connection->insert('blob_table', [
'id' => 1,
'clobfield' => 'ignored',
'blobfield' => 'test',
......@@ -128,7 +128,7 @@ class BlobTest extends DbalFunctionalTestCase
ParameterType::LARGE_OBJECT,
]);
$this->_conn->update('blob_table', [
$this->connection->update('blob_table', [
'id' => 1,
'blobfield' => fopen('data://text/plain,test2', 'r'),
], ['id' => 1], [
......@@ -141,13 +141,13 @@ class BlobTest extends DbalFunctionalTestCase
public function testBindParamProcessesStream()
{
if (in_array($this->_conn->getDatabasePlatform()->getName(), ['oracle', 'db2'], true)) {
if (in_array($this->connection->getDatabasePlatform()->getName(), ['oracle', 'db2'], true)) {
// https://github.com/doctrine/dbal/issues/3288 for DB2
// https://github.com/doctrine/dbal/issues/3290 for Oracle
$this->markTestIncomplete('Platform does not support stream resources as parameters');
}
$stmt = $this->_conn->prepare("INSERT INTO blob_table(id, clobfield, blobfield) VALUES (1, 'ignored', ?)");
$stmt = $this->connection->prepare("INSERT INTO blob_table(id, clobfield, blobfield) VALUES (1, 'ignored', ?)");
$stream = null;
$stmt->bindParam(1, $stream, ParameterType::LARGE_OBJECT);
......@@ -162,11 +162,11 @@ class BlobTest extends DbalFunctionalTestCase
private function assertBlobContains($text)
{
$rows = $this->_conn->query('SELECT blobfield FROM blob_table')->fetchAll(FetchMode::COLUMN);
$rows = $this->connection->query('SELECT blobfield FROM blob_table')->fetchAll(FetchMode::COLUMN);
self::assertCount(1, $rows);
$blobValue = Type::getType('blob')->convertToPHPValue($rows[0], $this->_conn->getDatabasePlatform());
$blobValue = Type::getType('blob')->convertToPHPValue($rows[0], $this->connection->getDatabasePlatform());
self::assertInternalType('resource', $blobValue);
self::assertEquals($text, stream_get_contents($blobValue));
......
......@@ -4,6 +4,7 @@ namespace Doctrine\Tests\DBAL\Functional\Driver;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Driver;
use Doctrine\DBAL\Driver\Connection as DriverConnection;
use Doctrine\Tests\DbalFunctionalTestCase;
abstract class AbstractDriverTest extends DbalFunctionalTestCase
......@@ -27,7 +28,7 @@ abstract class AbstractDriverTest extends DbalFunctionalTestCase
*/
public function testConnectsWithoutDatabaseNameParameter()
{
$params = $this->_conn->getParams();
$params = $this->connection->getParams();
unset($params['dbname']);
$user = $params['user'] ?? null;
......@@ -35,7 +36,7 @@ abstract class AbstractDriverTest extends DbalFunctionalTestCase
$connection = $this->driver->connect($params, $user, $password);
self::assertInstanceOf('Doctrine\DBAL\Driver\Connection', $connection);
self::assertInstanceOf(DriverConnection::class, $connection);
}
/**
......@@ -43,14 +44,14 @@ abstract class AbstractDriverTest extends DbalFunctionalTestCase
*/
public function testReturnsDatabaseNameWithoutDatabaseNameParameter()
{
$params = $this->_conn->getParams();
$params = $this->connection->getParams();
unset($params['dbname']);
$connection = new Connection(
$params,
$this->_conn->getDriver(),
$this->_conn->getConfiguration(),
$this->_conn->getEventManager()
$this->connection->getDriver(),
$this->connection->getConfiguration(),
$this->connection->getEventManager()
);
self::assertSame(
......
......@@ -16,7 +16,7 @@ class DB2DriverTest extends AbstractDriverTest
parent::setUp();
if ($this->_conn->getDriver() instanceof DB2Driver) {
if ($this->connection->getDriver() instanceof DB2Driver) {
return;
}
......
......@@ -19,7 +19,7 @@ class DB2StatementTest extends DbalFunctionalTestCase
parent::setUp();
if ($this->_conn->getDriver() instanceof DB2Driver) {
if ($this->connection->getDriver() instanceof DB2Driver) {
return;
}
......@@ -28,7 +28,7 @@ class DB2StatementTest extends DbalFunctionalTestCase
public function testExecutionErrorsAreNotSuppressed()
{
$stmt = $this->_conn->prepare('SELECT * FROM SYSIBM.SYSDUMMY1 WHERE \'foo\' = ?');
$stmt = $this->connection->prepare('SELECT * FROM SYSIBM.SYSDUMMY1 WHERE \'foo\' = ?');
// unwrap the statement to prevent the wrapper from handling the PHPUnit-originated exception
$wrappedStmt = $stmt->getWrappedStatement();
......
......@@ -18,7 +18,7 @@ class ConnectionTest extends DbalFunctionalTestCase
parent::setUp();
if ($this->_conn->getDriver() instanceof Driver) {
if ($this->connection->getDriver() instanceof Driver) {
return;
}
......@@ -35,7 +35,7 @@ class ConnectionTest extends DbalFunctionalTestCase
$driverOptions = [MYSQLI_OPT_CONNECT_TIMEOUT => 1];
$connection = $this->getConnection($driverOptions);
self::assertInstanceOf('\Doctrine\DBAL\Driver\Mysqli\MysqliConnection', $connection);
self::assertInstanceOf(MysqliConnection::class, $connection);
}
/**
......@@ -52,6 +52,9 @@ class ConnectionTest extends DbalFunctionalTestCase
self::assertTrue($conn->ping());
}
/**
* @param mixed[] $driverOptions
*/
private function getConnection(array $driverOptions)
{
return new MysqliConnection(
......
......@@ -16,7 +16,7 @@ class DriverTest extends AbstractDriverTest
parent::setUp();
if ($this->_conn->getDriver() instanceof Driver) {
if ($this->connection->getDriver() instanceof Driver) {
return;
}
......
......@@ -16,7 +16,7 @@ class DriverTest extends AbstractDriverTest
parent::setUp();
if ($this->_conn->getDriver() instanceof Driver) {
if ($this->connection->getDriver() instanceof Driver) {
return;
}
......
......@@ -21,11 +21,11 @@ class OCI8ConnectionTest extends DbalFunctionalTestCase
parent::setUp();
if (! $this->_conn->getDriver() instanceof Driver) {
if (! $this->connection->getDriver() instanceof Driver) {
$this->markTestSkipped('oci8 only test.');
}
$this->driverConnection = $this->_conn->getWrappedConnection();
$this->driverConnection = $this->connection->getWrappedConnection();
}
/**
......@@ -33,8 +33,8 @@ class OCI8ConnectionTest extends DbalFunctionalTestCase
*/
public function testLastInsertIdAcceptsFqn()
{
$platform = $this->_conn->getDatabasePlatform();
$schemaManager = $this->_conn->getSchemaManager();
$platform = $this->connection->getDatabasePlatform();
$schemaManager = $this->connection->getSchemaManager();
$table = new Table('DBAL2595');
$table->addColumn('id', 'integer', ['autoincrement' => true]);
......@@ -42,9 +42,9 @@ class OCI8ConnectionTest extends DbalFunctionalTestCase
$schemaManager->dropAndCreateTable($table);
$this->_conn->executeUpdate('INSERT INTO DBAL2595 (foo) VALUES (1)');
$this->connection->executeUpdate('INSERT INTO DBAL2595 (foo) VALUES (1)');
$schema = $this->_conn->getDatabase();
$schema = $this->connection->getDatabase();
$sequence = $platform->getIdentitySequenceName($schema . '.DBAL2595', 'id');
self::assertSame(1, $this->driverConnection->lastInsertId($sequence));
......
......@@ -16,7 +16,7 @@ class StatementTest extends DbalFunctionalTestCase
parent::setUp();
if ($this->_conn->getDriver() instanceof Driver) {
if ($this->connection->getDriver() instanceof Driver) {
return;
}
......@@ -24,13 +24,16 @@ class StatementTest extends DbalFunctionalTestCase
}
/**
* @param mixed[] $params
* @param mixed[] $expected
*
* @dataProvider queryConversionProvider
*/
public function testQueryConversion($query, array $params, array $expected)
{
self::assertEquals(
$expected,
$this->_conn->executeQuery($query, $params)->fetch()
$this->connection->executeQuery($query, $params)->fetch()
);
}
......
......@@ -25,7 +25,7 @@ class PDOConnectionTest extends DbalFunctionalTestCase
parent::setUp();
$this->driverConnection = $this->_conn->getWrappedConnection();
$this->driverConnection = $this->connection->getWrappedConnection();
if ($this->driverConnection instanceof PDOConnection) {
return;
......@@ -68,7 +68,7 @@ class PDOConnectionTest extends DbalFunctionalTestCase
*/
public function testThrowsWrappedExceptionOnPrepare()
{
if ($this->_conn->getDriver()->getName() === 'pdo_sqlsrv') {
if ($this->connection->getDriver()->getName() === 'pdo_sqlsrv') {
$this->markTestSkipped('pdo_sqlsrv does not allow setting PDO::ATTR_EMULATE_PREPARES at connection level.');
}
......@@ -86,7 +86,7 @@ class PDOConnectionTest extends DbalFunctionalTestCase
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->connection->getDriver()->getName()
)
);
}
......
......@@ -16,7 +16,7 @@ class DriverTest extends AbstractDriverTest
parent::setUp();
if ($this->_conn->getDriver() instanceof Driver) {
if ($this->connection->getDriver() instanceof Driver) {
return;
}
......
......@@ -16,7 +16,7 @@ class DriverTest extends AbstractDriverTest
parent::setUp();
if ($this->_conn->getDriver() instanceof Driver) {
if ($this->connection->getDriver() instanceof Driver) {
return;
}
......
......@@ -21,7 +21,7 @@ class DriverTest extends AbstractDriverTest
parent::setUp();
if ($this->_conn->getDriver() instanceof Driver) {
if ($this->connection->getDriver() instanceof Driver) {
return;
}
......@@ -33,15 +33,15 @@ class DriverTest extends AbstractDriverTest
*/
public function testDatabaseParameters($databaseName, $defaultDatabaseName, $expectedDatabaseName)
{
$params = $this->_conn->getParams();
$params = $this->connection->getParams();
$params['dbname'] = $databaseName;
$params['default_dbname'] = $defaultDatabaseName;
$connection = new Connection(
$params,
$this->_conn->getDriver(),
$this->_conn->getConfiguration(),
$this->_conn->getEventManager()
$this->connection->getDriver(),
$this->connection->getConfiguration(),
$this->connection->getEventManager()
);
self::assertSame(
......@@ -70,7 +70,7 @@ class DriverTest extends AbstractDriverTest
*/
public function testConnectsWithApplicationNameParameter()
{
$parameters = $this->_conn->getParams();
$parameters = $this->connection->getParams();
$parameters['application_name'] = 'doctrine';
$user = $parameters['user'] ?? null;
......
......@@ -18,7 +18,7 @@ class PDOPgsqlConnectionTest extends DbalFunctionalTestCase
parent::setUp();
if ($this->_conn->getDatabasePlatform() instanceof PostgreSqlPlatform) {
if ($this->connection->getDatabasePlatform() instanceof PostgreSqlPlatform) {
return;
}
......@@ -34,13 +34,13 @@ class PDOPgsqlConnectionTest extends DbalFunctionalTestCase
*/
public function testConnectsWithValidCharsetOption($charset)
{
$params = $this->_conn->getParams();
$params = $this->connection->getParams();
$params['charset'] = $charset;
$connection = DriverManager::getConnection(
$params,
$this->_conn->getConfiguration(),
$this->_conn->getEventManager()
$this->connection->getConfiguration(),
$this->connection->getEventManager()
);
self::assertEquals(
......@@ -51,7 +51,7 @@ class PDOPgsqlConnectionTest extends DbalFunctionalTestCase
}
/**
* @return array
* @return mixed[][]
*/
public function getValidCharsets()
{
......
......@@ -16,7 +16,7 @@ class DriverTest extends AbstractDriverTest
parent::setUp();
if ($this->_conn->getDriver() instanceof Driver) {
if ($this->connection->getDriver() instanceof Driver) {
return;
}
......
......@@ -18,7 +18,7 @@ class DriverTest extends AbstractDriverTest
parent::setUp();
if ($this->_conn->getDriver() instanceof Driver) {
if ($this->connection->getDriver() instanceof Driver) {
return;
}
......@@ -46,7 +46,7 @@ class DriverTest extends AbstractDriverTest
*/
protected function getConnection(array $driverOptions) : Connection
{
return $this->_conn->getDriver()->connect(
return $this->connection->getDriver()->connect(
[
'host' => $GLOBALS['db_host'],
'port' => $GLOBALS['db_port'],
......
......@@ -17,7 +17,7 @@ class ConnectionTest extends DbalFunctionalTestCase
parent::setUp();
if ($this->_conn->getDriver() instanceof Driver) {
if ($this->connection->getDriver() instanceof Driver) {
return;
}
......@@ -26,7 +26,7 @@ class ConnectionTest extends DbalFunctionalTestCase
public function testNonPersistentConnection()
{
$params = $this->_conn->getParams();
$params = $this->connection->getParams();
$params['persistent'] = false;
$conn = DriverManager::getConnection($params);
......@@ -38,7 +38,7 @@ class ConnectionTest extends DbalFunctionalTestCase
public function testPersistentConnection()
{
$params = $this->_conn->getParams();
$params = $this->connection->getParams();
$params['persistent'] = true;
$conn = DriverManager::getConnection($params);
......
......@@ -17,7 +17,7 @@ class DriverTest extends AbstractDriverTest
parent::setUp();
if ($this->_conn->getDriver() instanceof Driver) {
if ($this->connection->getDriver() instanceof Driver) {
return;
}
......@@ -26,14 +26,14 @@ class DriverTest extends AbstractDriverTest
public function testReturnsDatabaseNameWithoutDatabaseNameParameter()
{
$params = $this->_conn->getParams();
$params = $this->connection->getParams();
unset($params['dbname']);
$connection = new Connection(
$params,
$this->_conn->getDriver(),
$this->_conn->getConfiguration(),
$this->_conn->getEventManager()
$this->connection->getDriver(),
$this->connection->getConfiguration(),
$this->connection->getEventManager()
);
// SQL Anywhere has no "default" database. The name of the default database
......
......@@ -17,7 +17,7 @@ class StatementTest extends DbalFunctionalTestCase
parent::setUp();
if ($this->_conn->getDriver() instanceof Driver) {
if ($this->connection->getDriver() instanceof Driver) {
return;
}
......@@ -26,7 +26,7 @@ class StatementTest extends DbalFunctionalTestCase
public function testNonPersistentStatement()
{
$params = $this->_conn->getParams();
$params = $this->connection->getParams();
$params['persistent'] = false;
$conn = DriverManager::getConnection($params);
......@@ -41,7 +41,7 @@ class StatementTest extends DbalFunctionalTestCase
public function testPersistentStatement()
{
$params = $this->_conn->getParams();
$params = $this->connection->getParams();
$params['persistent'] = true;
$conn = DriverManager::getConnection($params);
......
......@@ -16,7 +16,7 @@ class DriverTest extends AbstractDriverTest
parent::setUp();
if ($this->_conn->getDriver() instanceof Driver) {
if ($this->connection->getDriver() instanceof Driver) {
return;
}
......
......@@ -17,7 +17,7 @@ class StatementTest extends DbalFunctionalTestCase
parent::setUp();
if ($this->_conn->getDriver() instanceof Driver) {
if ($this->connection->getDriver() instanceof Driver) {
return;
}
......@@ -27,7 +27,7 @@ class StatementTest extends DbalFunctionalTestCase
public function testFailureToPrepareResultsInException()
{
// use the driver connection directly to avoid having exception wrapped
$stmt = $this->_conn->getWrappedConnection()->prepare(null);
$stmt = $this->connection->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
......
......@@ -11,8 +11,8 @@ final class LikeWildcardsEscapingTest extends DbalFunctionalTestCase
{
$string = '_25% off_ your next purchase \o/ [$̲̅(̲̅5̲̅)̲̅$̲̅] (^̮^)';
$escapeChar = '!';
$databasePlatform = $this->_conn->getDatabasePlatform();
$stmt = $this->_conn->prepare(
$databasePlatform = $this->connection->getDatabasePlatform();
$stmt = $this->connection->prepare(
$databasePlatform->getDummySelectSQL(
sprintf(
"(CASE WHEN '%s' LIKE '%s' ESCAPE '%s' THEN 1 ELSE 0 END)",
......
......@@ -2,53 +2,54 @@
namespace Doctrine\Tests\DBAL\Functional;
use Doctrine\DBAL\Logging\SQLLogger;
use Doctrine\Tests\DbalFunctionalTestCase;
class LoggingTest extends DbalFunctionalTestCase
{
public function testLogExecuteQuery()
{
$sql = $this->_conn->getDatabasePlatform()->getDummySelectSQL();
$sql = $this->connection->getDatabasePlatform()->getDummySelectSQL();
$logMock = $this->createMock('Doctrine\DBAL\Logging\SQLLogger');
$logMock = $this->createMock(SQLLogger::class);
$logMock->expects($this->at(0))
->method('startQuery')
->with($this->equalTo($sql), $this->equalTo([]), $this->equalTo([]));
$logMock->expects($this->at(1))
->method('stopQuery');
$this->_conn->getConfiguration()->setSQLLogger($logMock);
$this->_conn->executeQuery($sql, []);
$this->connection->getConfiguration()->setSQLLogger($logMock);
$this->connection->executeQuery($sql, []);
}
public function testLogExecuteUpdate()
{
$this->markTestSkipped('Test breaks MySQL but works on all other platforms (Unbuffered Queries stuff).');
$sql = $this->_conn->getDatabasePlatform()->getDummySelectSQL();
$sql = $this->connection->getDatabasePlatform()->getDummySelectSQL();
$logMock = $this->createMock('Doctrine\DBAL\Logging\SQLLogger');
$logMock = $this->createMock(SQLLogger::class);
$logMock->expects($this->at(0))
->method('startQuery')
->with($this->equalTo($sql), $this->equalTo([]), $this->equalTo([]));
$logMock->expects($this->at(1))
->method('stopQuery');
$this->_conn->getConfiguration()->setSQLLogger($logMock);
$this->_conn->executeUpdate($sql, []);
$this->connection->getConfiguration()->setSQLLogger($logMock);
$this->connection->executeUpdate($sql, []);
}
public function testLogPrepareExecute()
{
$sql = $this->_conn->getDatabasePlatform()->getDummySelectSQL();
$sql = $this->connection->getDatabasePlatform()->getDummySelectSQL();
$logMock = $this->createMock('Doctrine\DBAL\Logging\SQLLogger');
$logMock = $this->createMock(SQLLogger::class);
$logMock->expects($this->once())
->method('startQuery')
->with($this->equalTo($sql), $this->equalTo([]));
$logMock->expects($this->at(1))
->method('stopQuery');
$this->_conn->getConfiguration()->setSQLLogger($logMock);
$this->connection->getConfiguration()->setSQLLogger($logMock);
$stmt = $this->_conn->prepare($sql);
$stmt = $this->connection->prepare($sql);
$stmt->execute();
}
}
......@@ -24,7 +24,7 @@ class MasterSlaveConnectionTest extends DbalFunctionalTestCase
{
parent::setUp();
$platformName = $this->_conn->getDatabasePlatform()->getName();
$platformName = $this->connection->getDatabasePlatform()->getName();
// This is a MySQL specific test, skip other vendors.
if ($platformName !== 'mysql') {
......@@ -37,13 +37,13 @@ class MasterSlaveConnectionTest extends DbalFunctionalTestCase
$table->addColumn('test_int', 'integer');
$table->setPrimaryKey(['test_int']);
$sm = $this->_conn->getSchemaManager();
$sm = $this->connection->getSchemaManager();
$sm->createTable($table);
} catch (Throwable $e) {
}
$this->_conn->executeUpdate('DELETE FROM master_slave_table');
$this->_conn->insert('master_slave_table', ['test_int' => 1]);
$this->connection->executeUpdate('DELETE FROM master_slave_table');
$this->connection->insert('master_slave_table', ['test_int' => 1]);
}
private function createMasterSlaveConnection(bool $keepSlave = false) : MasterSlaveConnection
......@@ -51,9 +51,12 @@ class MasterSlaveConnectionTest extends DbalFunctionalTestCase
return DriverManager::getConnection($this->createMasterSlaveConnectionParams($keepSlave));
}
/**
* @return mixed[]
*/
private function createMasterSlaveConnectionParams(bool $keepSlave = false) : array
{
$params = $this->_conn->getParams();
$params = $this->connection->getParams();
$params['master'] = $params;
$params['slaves'] = [$params, $params];
$params['keepSlave'] = $keepSlave;
......
......@@ -29,21 +29,21 @@ class ModifyLimitQueryTest extends DbalFunctionalTestCase
$table2->addColumn('test_int', 'integer');
$table2->setPrimaryKey(['id']);
$sm = $this->_conn->getSchemaManager();
$sm = $this->connection->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->connection->exec($this->connection->getDatabasePlatform()->getTruncateTableSQL('modify_limit_table'));
$this->connection->exec($this->connection->getDatabasePlatform()->getTruncateTableSQL('modify_limit_table2'));
}
public function testModifyLimitQuerySimpleQuery()
{
$this->_conn->insert('modify_limit_table', ['test_int' => 1]);
$this->_conn->insert('modify_limit_table', ['test_int' => 2]);
$this->_conn->insert('modify_limit_table', ['test_int' => 3]);
$this->_conn->insert('modify_limit_table', ['test_int' => 4]);
$this->connection->insert('modify_limit_table', ['test_int' => 1]);
$this->connection->insert('modify_limit_table', ['test_int' => 2]);
$this->connection->insert('modify_limit_table', ['test_int' => 3]);
$this->connection->insert('modify_limit_table', ['test_int' => 4]);
$sql = 'SELECT * FROM modify_limit_table ORDER BY test_int ASC';
......@@ -55,14 +55,14 @@ class ModifyLimitQueryTest extends DbalFunctionalTestCase
public function testModifyLimitQueryJoinQuery()
{
$this->_conn->insert('modify_limit_table', ['test_int' => 1]);
$this->_conn->insert('modify_limit_table', ['test_int' => 2]);
$this->connection->insert('modify_limit_table', ['test_int' => 1]);
$this->connection->insert('modify_limit_table', ['test_int' => 2]);
$this->_conn->insert('modify_limit_table2', ['test_int' => 1]);
$this->_conn->insert('modify_limit_table2', ['test_int' => 1]);
$this->_conn->insert('modify_limit_table2', ['test_int' => 1]);
$this->_conn->insert('modify_limit_table2', ['test_int' => 2]);
$this->_conn->insert('modify_limit_table2', ['test_int' => 2]);
$this->connection->insert('modify_limit_table2', ['test_int' => 1]);
$this->connection->insert('modify_limit_table2', ['test_int' => 1]);
$this->connection->insert('modify_limit_table2', ['test_int' => 1]);
$this->connection->insert('modify_limit_table2', ['test_int' => 2]);
$this->connection->insert('modify_limit_table2', ['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';
......@@ -73,10 +73,10 @@ class ModifyLimitQueryTest extends DbalFunctionalTestCase
public function testModifyLimitQueryNonDeterministic()
{
$this->_conn->insert('modify_limit_table', ['test_int' => 1]);
$this->_conn->insert('modify_limit_table', ['test_int' => 2]);
$this->_conn->insert('modify_limit_table', ['test_int' => 3]);
$this->_conn->insert('modify_limit_table', ['test_int' => 4]);
$this->connection->insert('modify_limit_table', ['test_int' => 1]);
$this->connection->insert('modify_limit_table', ['test_int' => 2]);
$this->connection->insert('modify_limit_table', ['test_int' => 3]);
$this->connection->insert('modify_limit_table', ['test_int' => 4]);
$sql = 'SELECT * FROM modify_limit_table';
......@@ -87,14 +87,14 @@ class ModifyLimitQueryTest extends DbalFunctionalTestCase
public function testModifyLimitQueryGroupBy()
{
$this->_conn->insert('modify_limit_table', ['test_int' => 1]);
$this->_conn->insert('modify_limit_table', ['test_int' => 2]);
$this->connection->insert('modify_limit_table', ['test_int' => 1]);
$this->connection->insert('modify_limit_table', ['test_int' => 2]);
$this->_conn->insert('modify_limit_table2', ['test_int' => 1]);
$this->_conn->insert('modify_limit_table2', ['test_int' => 1]);
$this->_conn->insert('modify_limit_table2', ['test_int' => 1]);
$this->_conn->insert('modify_limit_table2', ['test_int' => 2]);
$this->_conn->insert('modify_limit_table2', ['test_int' => 2]);
$this->connection->insert('modify_limit_table2', ['test_int' => 1]);
$this->connection->insert('modify_limit_table2', ['test_int' => 1]);
$this->connection->insert('modify_limit_table2', ['test_int' => 1]);
$this->connection->insert('modify_limit_table2', ['test_int' => 2]);
$this->connection->insert('modify_limit_table2', ['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 ' .
......@@ -107,10 +107,10 @@ class ModifyLimitQueryTest extends DbalFunctionalTestCase
public function testModifyLimitQuerySubSelect()
{
$this->_conn->insert('modify_limit_table', ['test_int' => 1]);
$this->_conn->insert('modify_limit_table', ['test_int' => 2]);
$this->_conn->insert('modify_limit_table', ['test_int' => 3]);
$this->_conn->insert('modify_limit_table', ['test_int' => 4]);
$this->connection->insert('modify_limit_table', ['test_int' => 1]);
$this->connection->insert('modify_limit_table', ['test_int' => 2]);
$this->connection->insert('modify_limit_table', ['test_int' => 3]);
$this->connection->insert('modify_limit_table', ['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';
......@@ -121,10 +121,10 @@ class ModifyLimitQueryTest extends DbalFunctionalTestCase
public function testModifyLimitQueryFromSubSelect()
{
$this->_conn->insert('modify_limit_table', ['test_int' => 1]);
$this->_conn->insert('modify_limit_table', ['test_int' => 2]);
$this->_conn->insert('modify_limit_table', ['test_int' => 3]);
$this->_conn->insert('modify_limit_table', ['test_int' => 4]);
$this->connection->insert('modify_limit_table', ['test_int' => 1]);
$this->connection->insert('modify_limit_table', ['test_int' => 2]);
$this->connection->insert('modify_limit_table', ['test_int' => 3]);
$this->connection->insert('modify_limit_table', ['test_int' => 4]);
$sql = 'SELECT * FROM (SELECT * FROM modify_limit_table) sub ORDER BY test_int DESC';
......@@ -135,9 +135,9 @@ class ModifyLimitQueryTest extends DbalFunctionalTestCase
public function testModifyLimitQueryLineBreaks()
{
$this->_conn->insert('modify_limit_table', ['test_int' => 1]);
$this->_conn->insert('modify_limit_table', ['test_int' => 2]);
$this->_conn->insert('modify_limit_table', ['test_int' => 3]);
$this->connection->insert('modify_limit_table', ['test_int' => 1]);
$this->connection->insert('modify_limit_table', ['test_int' => 2]);
$this->connection->insert('modify_limit_table', ['test_int' => 3]);
$sql = <<<SQL
SELECT
......@@ -155,8 +155,8 @@ SQL;
public function testModifyLimitQueryZeroOffsetNoLimit()
{
$this->_conn->insert('modify_limit_table', ['test_int' => 1]);
$this->_conn->insert('modify_limit_table', ['test_int' => 2]);
$this->connection->insert('modify_limit_table', ['test_int' => 1]);
$this->connection->insert('modify_limit_table', ['test_int' => 2]);
$sql = 'SELECT test_int FROM modify_limit_table ORDER BY test_int ASC';
......@@ -165,9 +165,9 @@ SQL;
public function assertLimitResult($expectedResults, $sql, $limit, $offset, $deterministic = true)
{
$p = $this->_conn->getDatabasePlatform();
$p = $this->connection->getDatabasePlatform();
$data = [];
foreach ($this->_conn->fetchAll($p->modifyLimitQuery($sql, $limit, $offset)) as $row) {
foreach ($this->connection->fetchAll($p->modifyLimitQuery($sql, $limit, $offset)) as $row) {
$row = array_change_key_case($row, CASE_LOWER);
$data[] = $row['test_int'];
}
......
......@@ -151,7 +151,7 @@ class NamedParametersTest extends DbalFunctionalTestCase
{
parent::setUp();
if ($this->_conn->getSchemaManager()->tablesExist('ddc1372_foobar')) {
if ($this->connection->getSchemaManager()->tablesExist('ddc1372_foobar')) {
return;
}
......@@ -162,35 +162,35 @@ class NamedParametersTest extends DbalFunctionalTestCase
$table->addColumn('bar', 'string');
$table->setPrimaryKey(['id']);
$sm = $this->_conn->getSchemaManager();
$sm = $this->connection->getSchemaManager();
$sm->createTable($table);
$this->_conn->insert('ddc1372_foobar', [
$this->connection->insert('ddc1372_foobar', [
'id' => 1,
'foo' => 1,
'bar' => 1,
]);
$this->_conn->insert('ddc1372_foobar', [
$this->connection->insert('ddc1372_foobar', [
'id' => 2,
'foo' => 1,
'bar' => 2,
]);
$this->_conn->insert('ddc1372_foobar', [
$this->connection->insert('ddc1372_foobar', [
'id' => 3,
'foo' => 1,
'bar' => 3,
]);
$this->_conn->insert('ddc1372_foobar', [
$this->connection->insert('ddc1372_foobar', [
'id' => 4,
'foo' => 1,
'bar' => 4,
]);
$this->_conn->insert('ddc1372_foobar', [
$this->connection->insert('ddc1372_foobar', [
'id' => 5,
'foo' => 2,
'bar' => 1,
]);
$this->_conn->insert('ddc1372_foobar', [
$this->connection->insert('ddc1372_foobar', [
'id' => 6,
'foo' => 2,
'bar' => 2,
......@@ -201,16 +201,16 @@ class NamedParametersTest extends DbalFunctionalTestCase
}
/**
* @param string $query
* @param array $params
* @param array $types
* @param array $expected
* @param string $query
* @param mixed[] $params
* @param int[] $types
* @param int[] $expected
*
* @dataProvider ticketProvider
*/
public function testTicket($query, $params, $types, $expected)
{
$stmt = $this->_conn->executeQuery($query, $params, $types);
$stmt = $this->connection->executeQuery($query, $params, $types);
$result = $stmt->fetchAll(FetchMode::ASSOCIATIVE);
foreach ($result as $k => $v) {
......
......@@ -18,14 +18,14 @@ class PDOStatementTest extends DbalFunctionalTestCase
parent::setUp();
if (! $this->_conn->getWrappedConnection() instanceof PDOConnection) {
if (! $this->connection->getWrappedConnection() instanceof PDOConnection) {
$this->markTestSkipped('PDO-only test');
}
$table = new Table('stmt_test');
$table->addColumn('id', 'integer');
$table->addColumn('name', 'text');
$this->_conn->getSchemaManager()->dropAndCreateTable($table);
$this->connection->getSchemaManager()->dropAndCreateTable($table);
}
/**
......@@ -34,16 +34,16 @@ class PDOStatementTest extends DbalFunctionalTestCase
*/
public function testPDOSpecificModeIsAccepted()
{
$this->_conn->insert('stmt_test', [
$this->connection->insert('stmt_test', [
'id' => 1,
'name' => 'Alice',
]);
$this->_conn->insert('stmt_test', [
$this->connection->insert('stmt_test', [
'id' => 2,
'name' => 'Bob',
]);
$data = $this->_conn->query('SELECT id, name FROM stmt_test ORDER BY id')
$data = $this->connection->query('SELECT id, name FROM stmt_test ORDER BY id')
->fetchAll(PDO::FETCH_KEY_PAIR);
self::assertSame([
......
......@@ -17,16 +17,16 @@ class DateExpressionTest extends DbalFunctionalTestCase
$table = new Table('date_expr_test');
$table->addColumn('date1', 'datetime');
$table->addColumn('date2', 'datetime');
$this->_conn->getSchemaManager()->dropAndCreateTable($table);
$this->_conn->insert('date_expr_test', [
$this->connection->getSchemaManager()->dropAndCreateTable($table);
$this->connection->insert('date_expr_test', [
'date1' => $date1,
'date2' => $date2,
]);
$platform = $this->_conn->getDatabasePlatform();
$platform = $this->connection->getDatabasePlatform();
$sql = sprintf('SELECT %s FROM date_expr_test', $platform->getDateDiffExpression('date1', 'date2'));
$diff = $this->_conn->query($sql)->fetchColumn();
$diff = $this->connection->query($sql)->fetchColumn();
self::assertEquals($expected, $diff);
}
......
......@@ -4,6 +4,7 @@ namespace Doctrine\Tests\DBAL\Functional;
use Doctrine\DBAL\ColumnCase;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Driver\PDOSqlsrv\Driver;
use Doctrine\DBAL\DriverManager;
use Doctrine\DBAL\FetchMode;
use Doctrine\DBAL\Portability\Connection as ConnectionPortability;
......@@ -41,13 +42,13 @@ class PortabilityTest extends DbalFunctionalTestCase
$case = ColumnCase::LOWER
) {
if (! $this->portableConnection) {
$params = $this->_conn->getParams();
$params = $this->connection->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->connection->getConfiguration(), $this->connection->getEventManager());
try {
/** @var AbstractSchemaManager $sm */
......@@ -145,7 +146,7 @@ class PortabilityTest extends DbalFunctionalTestCase
$portability = ConnectionPortability::PORTABILITY_SQLSRV;
$params = ['portability' => $portability];
$driverMock = $this->getMockBuilder('Doctrine\\DBAL\\Driver\\PDOSqlsrv\\Driver')
$driverMock = $this->getMockBuilder(Driver::class)
->setMethods(['connect'])
->getMock();
......@@ -161,6 +162,9 @@ class PortabilityTest extends DbalFunctionalTestCase
}
/**
* @param string $field
* @param mixed[] $expected
*
* @dataProvider fetchAllColumnProvider
*/
public function testFetchAllColumn($field, array $expected)
......
......@@ -35,14 +35,14 @@ class ResultCacheTest extends DbalFunctionalTestCase
$table->addColumn('test_string', 'string', ['notnull' => false]);
$table->setPrimaryKey(['test_int']);
$sm = $this->_conn->getSchemaManager();
$sm = $this->connection->getSchemaManager();
$sm->createTable($table);
foreach ($this->expectedResult as $row) {
$this->_conn->insert('caching', $row);
$this->connection->insert('caching', $row);
}
$config = $this->_conn->getConfiguration();
$config = $this->connection->getConfiguration();
$config->setSQLLogger($this->sqlLogger = new DebugStack());
$cache = new ArrayCache();
......@@ -51,7 +51,7 @@ class ResultCacheTest extends DbalFunctionalTestCase
protected function tearDown()
{
$this->_conn->getSchemaManager()->dropTable('caching');
$this->connection->getSchemaManager()->dropTable('caching');
parent::tearDown();
}
......@@ -100,13 +100,13 @@ class ResultCacheTest extends DbalFunctionalTestCase
foreach ($this->expectedResult as $v) {
$numExpectedResult[] = array_values($v);
}
$stmt = $this->_conn->executeQuery('SELECT * FROM caching ORDER BY test_int ASC', [], [], new QueryCacheProfile(10, 'testcachekey'));
$stmt = $this->connection->executeQuery('SELECT * FROM caching ORDER BY test_int ASC', [], [], 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', [], [], new QueryCacheProfile(10, 'testcachekey'));
$stmt = $this->connection->executeQuery('SELECT * FROM caching ORDER BY test_int ASC', [], [], new QueryCacheProfile(10, 'testcachekey'));
$data = $this->hydrateStmt($stmt, FetchMode::NUMERIC);
......@@ -122,10 +122,10 @@ class ResultCacheTest extends DbalFunctionalTestCase
public function assertStandardAndIteratorFetchAreEqual($fetchMode)
{
$stmt = $this->_conn->executeQuery('SELECT * FROM caching ORDER BY test_int ASC', [], [], new QueryCacheProfile(10, 'testcachekey'));
$stmt = $this->connection->executeQuery('SELECT * FROM caching ORDER BY test_int ASC', [], [], new QueryCacheProfile(10, 'testcachekey'));
$data = $this->hydrateStmt($stmt, $fetchMode);
$stmt = $this->_conn->executeQuery('SELECT * FROM caching ORDER BY test_int ASC', [], [], new QueryCacheProfile(10, 'testcachekey'));
$stmt = $this->connection->executeQuery('SELECT * FROM caching ORDER BY test_int ASC', [], [], new QueryCacheProfile(10, 'testcachekey'));
$data_iterator = $this->hydrateStmtIterator($stmt, $fetchMode);
self::assertEquals($data, $data_iterator);
......@@ -133,7 +133,7 @@ class ResultCacheTest extends DbalFunctionalTestCase
public function testDontCloseNoCache()
{
$stmt = $this->_conn->executeQuery('SELECT * FROM caching ORDER BY test_int ASC', [], [], new QueryCacheProfile(10, 'testcachekey'));
$stmt = $this->connection->executeQuery('SELECT * FROM caching ORDER BY test_int ASC', [], [], new QueryCacheProfile(10, 'testcachekey'));
$data = [];
......@@ -141,7 +141,7 @@ class ResultCacheTest extends DbalFunctionalTestCase
$data[] = $row;
}
$stmt = $this->_conn->executeQuery('SELECT * FROM caching ORDER BY test_int ASC', [], [], new QueryCacheProfile(10, 'testcachekey'));
$stmt = $this->connection->executeQuery('SELECT * FROM caching ORDER BY test_int ASC', [], [], new QueryCacheProfile(10, 'testcachekey'));
$data = [];
......@@ -154,12 +154,12 @@ class ResultCacheTest extends DbalFunctionalTestCase
public function testDontFinishNoCache()
{
$stmt = $this->_conn->executeQuery('SELECT * FROM caching ORDER BY test_int ASC', [], [], new QueryCacheProfile(10, 'testcachekey'));
$stmt = $this->connection->executeQuery('SELECT * FROM caching ORDER BY test_int ASC', [], [], new QueryCacheProfile(10, 'testcachekey'));
$stmt->fetch(FetchMode::ASSOCIATIVE);
$stmt->closeCursor();
$stmt = $this->_conn->executeQuery('SELECT * FROM caching ORDER BY test_int ASC', [], [], new QueryCacheProfile(10, 'testcachekey'));
$stmt = $this->connection->executeQuery('SELECT * FROM caching ORDER BY test_int ASC', [], [], new QueryCacheProfile(10, 'testcachekey'));
$this->hydrateStmt($stmt, FetchMode::NUMERIC);
......@@ -168,13 +168,13 @@ class ResultCacheTest extends DbalFunctionalTestCase
public function assertCacheNonCacheSelectSameFetchModeAreEqual($expectedResult, $fetchMode)
{
$stmt = $this->_conn->executeQuery('SELECT * FROM caching ORDER BY test_int ASC', [], [], new QueryCacheProfile(10, 'testcachekey'));
$stmt = $this->connection->executeQuery('SELECT * FROM caching ORDER BY test_int ASC', [], [], 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', [], [], new QueryCacheProfile(10, 'testcachekey'));
$stmt = $this->connection->executeQuery('SELECT * FROM caching ORDER BY test_int ASC', [], [], new QueryCacheProfile(10, 'testcachekey'));
self::assertEquals(2, $stmt->columnCount());
$data = $this->hydrateStmt($stmt, $fetchMode);
......@@ -184,10 +184,10 @@ class ResultCacheTest extends DbalFunctionalTestCase
public function testEmptyResultCache()
{
$stmt = $this->_conn->executeQuery('SELECT * FROM caching WHERE test_int > 500', [], [], new QueryCacheProfile(10, 'emptycachekey'));
$stmt = $this->connection->executeQuery('SELECT * FROM caching WHERE test_int > 500', [], [], new QueryCacheProfile(10, 'emptycachekey'));
$data = $this->hydrateStmt($stmt);
$stmt = $this->_conn->executeQuery('SELECT * FROM caching WHERE test_int > 500', [], [], new QueryCacheProfile(10, 'emptycachekey'));
$stmt = $this->connection->executeQuery('SELECT * FROM caching WHERE test_int > 500', [], [], new QueryCacheProfile(10, 'emptycachekey'));
$data = $this->hydrateStmt($stmt);
self::assertCount(1, $this->sqlLogger->queries, 'just one dbal hit');
......@@ -195,11 +195,11 @@ class ResultCacheTest extends DbalFunctionalTestCase
public function testChangeCacheImpl()
{
$stmt = $this->_conn->executeQuery('SELECT * FROM caching WHERE test_int > 500', [], [], new QueryCacheProfile(10, 'emptycachekey'));
$stmt = $this->connection->executeQuery('SELECT * FROM caching WHERE test_int > 500', [], [], new QueryCacheProfile(10, 'emptycachekey'));
$data = $this->hydrateStmt($stmt);
$secondCache = new ArrayCache();
$stmt = $this->_conn->executeQuery('SELECT * FROM caching WHERE test_int > 500', [], [], new QueryCacheProfile(10, 'emptycachekey', $secondCache));
$stmt = $this->connection->executeQuery('SELECT * FROM caching WHERE test_int > 500', [], [], new QueryCacheProfile(10, 'emptycachekey', $secondCache));
$data = $this->hydrateStmt($stmt);
self::assertCount(2, $this->sqlLogger->queries, 'two hits');
......
......@@ -3,6 +3,7 @@
namespace Doctrine\Tests\DBAL\Functional\Schema;
use Doctrine\DBAL\Schema\Table;
use Doctrine\DBAL\Types\BooleanType;
class Db2SchemaManagerTest extends SchemaManagerFunctionalTestCase
{
......@@ -15,12 +16,12 @@ class Db2SchemaManagerTest extends SchemaManagerFunctionalTestCase
$table->addColumn('bool', 'boolean');
$table->addColumn('bool_commented', 'boolean', ['comment' => "That's a comment"]);
$this->_sm->createTable($table);
$this->schemaManager->createTable($table);
$columns = $this->_sm->listTableColumns('boolean_column_test');
$columns = $this->schemaManager->listTableColumns('boolean_column_test');
self::assertInstanceOf('Doctrine\DBAL\Types\BooleanType', $columns['bool']->getType());
self::assertInstanceOf('Doctrine\DBAL\Types\BooleanType', $columns['bool_commented']->getType());
self::assertInstanceOf(BooleanType::class, $columns['bool']->getType());
self::assertInstanceOf(BooleanType::class, $columns['bool_commented']->getType());
self::assertNull($columns['bool']->getComment());
self::assertSame("That's a comment", $columns['bool_commented']->getComment());
......
......@@ -3,6 +3,7 @@
namespace Doctrine\Tests\DBAL\Functional\Schema;
use Doctrine\DBAL\Schema\Table;
use Doctrine\DBAL\Types\BinaryType;
class DrizzleSchemaManagerTest extends SchemaManagerFunctionalTestCase
{
......@@ -16,14 +17,14 @@ class DrizzleSchemaManagerTest extends SchemaManagerFunctionalTestCase
$table->addColumn('column_binary', 'binary', ['fixed' => true]);
$table->setPrimaryKey(['id']);
$this->_sm->createTable($table);
$this->schemaManager->createTable($table);
$table = $this->_sm->listTableDetails($tableName);
$table = $this->schemaManager->listTableDetails($tableName);
self::assertInstanceOf('Doctrine\DBAL\Types\BinaryType', $table->getColumn('column_varbinary')->getType());
self::assertInstanceOf(BinaryType::class, $table->getColumn('column_varbinary')->getType());
self::assertFalse($table->getColumn('column_varbinary')->getFixed());
self::assertInstanceOf('Doctrine\DBAL\Types\BinaryType', $table->getColumn('column_binary')->getType());
self::assertInstanceOf(BinaryType::class, $table->getColumn('column_binary')->getType());
self::assertFalse($table->getColumn('column_binary')->getFixed());
}
......@@ -35,9 +36,9 @@ class DrizzleSchemaManagerTest extends SchemaManagerFunctionalTestCase
$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->schemaManager->dropAndCreateTable($table);
$columns = $this->_sm->listTableColumns('test_collation');
$columns = $this->schemaManager->listTableColumns('test_collation');
self::assertArrayNotHasKey('collation', $columns['id']->getPlatformOptions());
self::assertEquals('utf8_unicode_ci', $columns['text']->getPlatformOption('collation'));
......
......@@ -4,6 +4,7 @@ namespace Doctrine\Tests\DBAL\Functional\Schema;
use Doctrine\DBAL\Schema;
use Doctrine\DBAL\Schema\Table;
use Doctrine\DBAL\Types\BinaryType;
use Doctrine\DBAL\Types\Type;
use Doctrine\Tests\TestUtil;
use function array_map;
......@@ -28,13 +29,13 @@ class OracleSchemaManagerTest extends SchemaManagerFunctionalTestCase
public function testRenameTable()
{
$this->_sm->tryMethod('DropTable', 'list_tables_test');
$this->_sm->tryMethod('DropTable', 'list_tables_test_new_name');
$this->schemaManager->tryMethod('DropTable', 'list_tables_test');
$this->schemaManager->tryMethod('DropTable', 'list_tables_test_new_name');
$this->createTestTable('list_tables_test');
$this->_sm->renameTable('list_tables_test', 'list_tables_test_new_name');
$this->schemaManager->renameTable('list_tables_test', 'list_tables_test_new_name');
$tables = $this->_sm->listTables();
$tables = $this->schemaManager->listTables();
self::assertHasTable($tables, 'list_tables_test_new_name');
}
......@@ -49,14 +50,14 @@ class OracleSchemaManagerTest extends SchemaManagerFunctionalTestCase
$table->addColumn('column_binary', 'binary', ['fixed' => true]);
$table->setPrimaryKey(['id']);
$this->_sm->createTable($table);
$this->schemaManager->createTable($table);
$table = $this->_sm->listTableDetails($tableName);
$table = $this->schemaManager->listTableDetails($tableName);
self::assertInstanceOf('Doctrine\DBAL\Types\BinaryType', $table->getColumn('column_varbinary')->getType());
self::assertInstanceOf(BinaryType::class, $table->getColumn('column_varbinary')->getType());
self::assertFalse($table->getColumn('column_varbinary')->getFixed());
self::assertInstanceOf('Doctrine\DBAL\Types\BinaryType', $table->getColumn('column_binary')->getType());
self::assertInstanceOf(BinaryType::class, $table->getColumn('column_binary')->getType());
self::assertFalse($table->getColumn('column_binary')->getFixed());
}
......@@ -75,9 +76,9 @@ class OracleSchemaManagerTest extends SchemaManagerFunctionalTestCase
$table->addColumn('bar', 'string');
$table->setPrimaryKey(['id']);
$this->_sm->dropAndCreateTable($table);
$this->schemaManager->dropAndCreateTable($table);
$columns = $this->_sm->listTableColumns($tableName);
$columns = $this->schemaManager->listTableColumns($tableName);
self::assertTrue($columns['id']->getNotnull());
self::assertTrue($columns['foo']->getNotnull());
......@@ -87,9 +88,9 @@ class OracleSchemaManagerTest extends SchemaManagerFunctionalTestCase
$diffTable->changeColumn('foo', ['notnull' => false]);
$diffTable->changeColumn('bar', ['length' => 1024]);
$this->_sm->alterTable($comparator->diffTable($table, $diffTable));
$this->schemaManager->alterTable($comparator->diffTable($table, $diffTable));
$columns = $this->_sm->listTableColumns($tableName);
$columns = $this->schemaManager->listTableColumns($tableName);
self::assertTrue($columns['id']->getNotnull());
self::assertFalse($columns['foo']->getNotnull());
......@@ -103,7 +104,7 @@ class OracleSchemaManagerTest extends SchemaManagerFunctionalTestCase
$sm->dropAndCreateDatabase('c##test_create_database');
$databases = $this->_sm->listDatabases();
$databases = $this->schemaManager->listDatabases();
$databases = array_map('strtolower', $databases);
self::assertContains('c##test_create_database', $databases);
......@@ -145,16 +146,16 @@ class OracleSchemaManagerTest extends SchemaManagerFunctionalTestCase
);
$offlineForeignTable->setPrimaryKey(['id']);
$this->_sm->tryMethod('dropTable', $foreignTableName);
$this->_sm->tryMethod('dropTable', $primaryTableName);
$this->schemaManager->tryMethod('dropTable', $foreignTableName);
$this->schemaManager->tryMethod('dropTable', $primaryTableName);
$this->_sm->createTable($offlinePrimaryTable);
$this->_sm->createTable($offlineForeignTable);
$this->schemaManager->createTable($offlinePrimaryTable);
$this->schemaManager->createTable($offlineForeignTable);
$onlinePrimaryTable = $this->_sm->listTableDetails($primaryTableName);
$onlineForeignTable = $this->_sm->listTableDetails($foreignTableName);
$onlinePrimaryTable = $this->schemaManager->listTableDetails($primaryTableName);
$onlineForeignTable = $this->schemaManager->listTableDetails($foreignTableName);
$platform = $this->_sm->getDatabasePlatform();
$platform = $this->schemaManager->getDatabasePlatform();
// Primary table assertions
self::assertSame($primaryTableName, $onlinePrimaryTable->getQuotedName($platform));
......@@ -223,13 +224,13 @@ class OracleSchemaManagerTest extends SchemaManagerFunctionalTestCase
public function testListTableColumnsSameTableNamesInDifferentSchemas()
{
$table = $this->createListTableColumns();
$this->_sm->dropAndCreateTable($table);
$this->schemaManager->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->schemaManager->listTableColumns($table->getName(), $this->connection->getUsername());
self::assertCount(7, $columns);
}
......@@ -239,16 +240,16 @@ class OracleSchemaManagerTest extends SchemaManagerFunctionalTestCase
public function testListTableIndexesPrimaryKeyConstraintNameDiffersFromIndexName()
{
$table = new Table('list_table_indexes_pk_id_test');
$table->setSchemaConfig($this->_sm->createSchemaConfig());
$table->setSchemaConfig($this->schemaManager->createSchemaConfig());
$table->addColumn('id', 'integer', ['notnull' => true]);
$table->addUniqueIndex(['id'], 'id_unique_index');
$this->_sm->dropAndCreateTable($table);
$this->schemaManager->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', ['id'], true, true), 'list_table_indexes_pk_id_test');
$this->schemaManager->createConstraint(new Schema\Index('id_pk_id_index', ['id'], true, true), 'list_table_indexes_pk_id_test');
$tableIndexes = $this->_sm->listTableIndexes('list_table_indexes_pk_id_test');
$tableIndexes = $this->schemaManager->listTableIndexes('list_table_indexes_pk_id_test');
self::assertArrayHasKey('primary', $tableIndexes, 'listTableIndexes() has to return a "primary" array key.');
self::assertEquals(['id'], array_map('strtolower', $tableIndexes['primary']->getColumns()));
......@@ -266,9 +267,9 @@ class OracleSchemaManagerTest extends SchemaManagerFunctionalTestCase
$table->addColumn('col_datetime', 'datetime');
$table->addColumn('col_datetimetz', 'datetimetz');
$this->_sm->dropAndCreateTable($table);
$this->schemaManager->dropAndCreateTable($table);
$columns = $this->_sm->listTableColumns('tbl_date');
$columns = $this->schemaManager->listTableColumns('tbl_date');
self::assertSame('date', $columns['col_date']->getType()->getName());
self::assertSame('datetime', $columns['col_datetime']->getType()->getName());
......
......@@ -17,12 +17,12 @@ class SQLAnywhereSchemaManagerTest extends SchemaManagerFunctionalTestCase
$view = new View($name, $sql);
$this->_sm->dropAndCreateView($view);
$this->schemaManager->dropAndCreateView($view);
$views = $this->_sm->listViews();
$views = $this->schemaManager->listViews();
self::assertCount(1, $views, 'Database has to have one view.');
self::assertInstanceOf('Doctrine\DBAL\Schema\View', $views[$name]);
self::assertInstanceOf(View::class, $views[$name]);
self::assertEquals($name, $views[$name]->getName());
self::assertEquals($sql, $views[$name]->getSql());
}
......@@ -30,13 +30,13 @@ class SQLAnywhereSchemaManagerTest extends SchemaManagerFunctionalTestCase
public function testDropAndCreateAdvancedIndex()
{
$table = $this->getTestTable('test_create_advanced_index');
$this->_sm->dropAndCreateTable($table);
$this->_sm->dropAndCreateIndex(
$this->schemaManager->dropAndCreateTable($table);
$this->schemaManager->dropAndCreateIndex(
new Index('test', ['test'], true, false, ['clustered', 'with_nulls_not_distinct', 'for_olap_workload']),
$table->getName()
);
$tableIndexes = $this->_sm->listTableIndexes('test_create_advanced_index');
$tableIndexes = $this->schemaManager->listTableIndexes('test_create_advanced_index');
self::assertInternalType('array', $tableIndexes);
self::assertEquals('test', $tableIndexes['test']->getName());
self::assertEquals(['test'], $tableIndexes['test']->getColumns());
......@@ -54,9 +54,9 @@ class SQLAnywhereSchemaManagerTest extends SchemaManagerFunctionalTestCase
$table->addColumn('test', 'string', ['fixed' => true]);
$table->setPrimaryKey(['id']);
$this->_sm->dropAndCreateTable($table);
$this->schemaManager->dropAndCreateTable($table);
$columns = $this->_sm->listTableColumns('list_table_columns_char');
$columns = $this->schemaManager->listTableColumns('list_table_columns_char');
self::assertArrayHasKey('test', $columns);
self::assertTrue($columns['test']->getFixed());
......
......@@ -25,12 +25,12 @@ class SQLServerSchemaManagerTest extends SchemaManagerFunctionalTestCase
$table->addColumn('id', 'integer');
$table->addColumn('todrop', 'decimal', ['default' => 10.2]);
$this->_sm->createTable($table);
$this->schemaManager->createTable($table);
$diff = new TableDiff('sqlsrv_drop_column', [], [], [new Column('todrop', Type::getType('decimal'))]);
$this->_sm->alterTable($diff);
$this->schemaManager->alterTable($diff);
$columns = $this->_sm->listTableColumns('sqlsrv_drop_column');
$columns = $this->schemaManager->listTableColumns('sqlsrv_drop_column');
self::assertCount(1, $columns);
}
......@@ -39,22 +39,22 @@ class SQLServerSchemaManagerTest extends SchemaManagerFunctionalTestCase
$table = new Table($tableName = 'test_collation');
$column = $table->addColumn($columnName = 'test', 'string');
$this->_sm->dropAndCreateTable($table);
$columns = $this->_sm->listTableColumns($tableName);
$this->schemaManager->dropAndCreateTable($table);
$columns = $this->schemaManager->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->schemaManager->dropAndCreateTable($table);
$columns = $this->schemaManager->listTableColumns($tableName);
self::assertEquals($collation, $columns[$columnName]->getPlatformOption('collation'));
}
public function testDefaultConstraints()
{
$platform = $this->_sm->getDatabasePlatform();
$platform = $this->schemaManager->getDatabasePlatform();
$table = new Table('sqlsrv_default_constraints');
$table->addColumn('no_default', 'string');
$table->addColumn('df_integer', 'integer', ['default' => 666]);
......@@ -66,8 +66,8 @@ class SQLServerSchemaManagerTest extends SchemaManagerFunctionalTestCase
$table->addColumn('df_current_date', 'date', ['default' => $platform->getCurrentDateSQL()]);
$table->addColumn('df_current_time', 'time', ['default' => $platform->getCurrentTimeSQL()]);
$this->_sm->createTable($table);
$columns = $this->_sm->listTableColumns('sqlsrv_default_constraints');
$this->schemaManager->createTable($table);
$columns = $this->schemaManager->listTableColumns('sqlsrv_default_constraints');
self::assertNull($columns['no_default']->getDefault());
self::assertEquals(666, $columns['df_integer']->getDefault());
......@@ -122,8 +122,8 @@ class SQLServerSchemaManagerTest extends SchemaManagerFunctionalTestCase
['default' => 'column to rename']
);
$this->_sm->alterTable($diff);
$columns = $this->_sm->listTableColumns('sqlsrv_default_constraints');
$this->schemaManager->alterTable($diff);
$columns = $this->schemaManager->listTableColumns('sqlsrv_default_constraints');
self::assertNull($columns['no_default']->getDefault());
self::assertEquals('CURRENT_TIMESTAMP', $columns['df_current_timestamp']->getDefault());
......@@ -160,8 +160,8 @@ class SQLServerSchemaManagerTest extends SchemaManagerFunctionalTestCase
$table
);
$this->_sm->alterTable($diff);
$columns = $this->_sm->listTableColumns('sqlsrv_default_constraints');
$this->schemaManager->alterTable($diff);
$columns = $this->schemaManager->listTableColumns('sqlsrv_default_constraints');
self::assertNull($columns['df_current_timestamp']->getDefault());
self::assertEquals(666, $columns['df_integer']->getDefault());
......@@ -187,9 +187,9 @@ class SQLServerSchemaManagerTest extends SchemaManagerFunctionalTestCase
$table->addColumn('commented_type_with_comment', 'array', ['comment' => 'Doctrine array type.']);
$table->setPrimaryKey(['id']);
$this->_sm->createTable($table);
$this->schemaManager->createTable($table);
$columns = $this->_sm->listTableColumns('sqlsrv_column_comment');
$columns = $this->schemaManager->listTableColumns('sqlsrv_column_comment');
self::assertCount(12, $columns);
self::assertNull($columns['id']->getComment());
self::assertNull($columns['comment_null']->getComment());
......@@ -303,9 +303,9 @@ class SQLServerSchemaManagerTest extends SchemaManagerFunctionalTestCase
$tableDiff->removedColumns['comment_integer_0'] = new Column('comment_integer_0', Type::getType('integer'), ['comment' => 0]);
$this->_sm->alterTable($tableDiff);
$this->schemaManager->alterTable($tableDiff);
$columns = $this->_sm->listTableColumns('sqlsrv_column_comment');
$columns = $this->schemaManager->listTableColumns('sqlsrv_column_comment');
self::assertCount(23, $columns);
self::assertEquals('primary', $columns['id']->getComment());
self::assertNull($columns['comment_null']->getComment());
......@@ -345,9 +345,9 @@ class SQLServerSchemaManagerTest extends SchemaManagerFunctionalTestCase
$table->addColumn('colA', 'integer', ['notnull' => true]);
$table->addColumn('colB', 'integer', ['notnull' => true]);
$table->setPrimaryKey(['colB', 'colA']);
$this->_sm->createTable($table);
$this->schemaManager->createTable($table);
$indexes = $this->_sm->listTableIndexes('sqlsrv_pk_ordering');
$indexes = $this->schemaManager->listTableIndexes('sqlsrv_pk_ordering');
self::assertCount(1, $indexes);
......
......@@ -2,8 +2,10 @@
namespace Doctrine\Tests\DBAL\Functional\Schema;
use Doctrine\DBAL\Driver\Connection;
use Doctrine\DBAL\Schema;
use Doctrine\DBAL\Schema\Table;
use Doctrine\DBAL\Types\BlobType;
use Doctrine\DBAL\Types\Type;
use SQLite3;
use function array_map;
......@@ -20,16 +22,16 @@ class SqliteSchemaManagerTest extends SchemaManagerFunctionalTestCase
*/
public function testListDatabases()
{
$this->_sm->listDatabases();
$this->schemaManager->listDatabases();
}
public function testCreateAndDropDatabase()
{
$path = dirname(__FILE__) . '/test_create_and_drop_sqlite_database.sqlite';
$this->_sm->createDatabase($path);
$this->schemaManager->createDatabase($path);
self::assertFileExists($path);
$this->_sm->dropDatabase($path);
$this->schemaManager->dropDatabase($path);
self::assertFileNotExists($path);
}
......@@ -38,21 +40,21 @@ class SqliteSchemaManagerTest extends SchemaManagerFunctionalTestCase
*/
public function testDropsDatabaseWithActiveConnections()
{
$this->_sm->dropAndCreateDatabase('test_drop_database');
$this->schemaManager->dropAndCreateDatabase('test_drop_database');
self::assertFileExists('test_drop_database');
$params = $this->_conn->getParams();
$params = $this->connection->getParams();
$params['dbname'] = 'test_drop_database';
$user = $params['user'] ?? null;
$password = $params['password'] ?? null;
$connection = $this->_conn->getDriver()->connect($params, $user, $password);
$connection = $this->connection->getDriver()->connect($params, $user, $password);
self::assertInstanceOf('Doctrine\DBAL\Driver\Connection', $connection);
self::assertInstanceOf(Connection::class, $connection);
$this->_sm->dropDatabase('test_drop_database');
$this->schemaManager->dropDatabase('test_drop_database');
self::assertFileNotExists('test_drop_database');
......@@ -62,9 +64,9 @@ class SqliteSchemaManagerTest extends SchemaManagerFunctionalTestCase
public function testRenameTable()
{
$this->createTestTable('oldname');
$this->_sm->renameTable('oldname', 'newname');
$this->schemaManager->renameTable('oldname', 'newname');
$tables = $this->_sm->listTableNames();
$tables = $this->schemaManager->listTableNames();
self::assertContains('newname', $tables);
self::assertNotContains('oldname', $tables);
}
......@@ -79,7 +81,7 @@ class SqliteSchemaManagerTest extends SchemaManagerFunctionalTestCase
public function testListForeignKeysFromExistingDatabase()
{
$this->_conn->exec(<<<EOS
$this->connection->exec(<<<EOS
CREATE TABLE user (
id INTEGER PRIMARY KEY AUTOINCREMENT,
page INTEGER CONSTRAINT FK_1 REFERENCES page (key) DEFERRABLE INITIALLY DEFERRED,
......@@ -114,7 +116,7 @@ EOS
),
];
self::assertEquals($expected, $this->_sm->listTableForeignKeys('user'));
self::assertEquals($expected, $this->schemaManager->listTableForeignKeys('user'));
}
public function testColumnCollation()
......@@ -124,9 +126,9 @@ EOS
$table->addColumn('text', 'text');
$table->addColumn('foo', 'text')->setPlatformOption('collation', 'BINARY');
$table->addColumn('bar', 'text')->setPlatformOption('collation', 'NOCASE');
$this->_sm->dropAndCreateTable($table);
$this->schemaManager->dropAndCreateTable($table);
$columns = $this->_sm->listTableColumns('test_collation');
$columns = $this->schemaManager->listTableColumns('test_collation');
self::assertArrayNotHasKey('collation', $columns['id']->getPlatformOptions());
self::assertEquals('BINARY', $columns['text']->getPlatformOption('collation'));
......@@ -144,14 +146,14 @@ EOS
$table->addColumn('column_binary', 'binary', ['fixed' => true]);
$table->setPrimaryKey(['id']);
$this->_sm->createTable($table);
$this->schemaManager->createTable($table);
$table = $this->_sm->listTableDetails($tableName);
$table = $this->schemaManager->listTableDetails($tableName);
self::assertInstanceOf('Doctrine\DBAL\Types\BlobType', $table->getColumn('column_varbinary')->getType());
self::assertInstanceOf(BlobType::class, $table->getColumn('column_varbinary')->getType());
self::assertFalse($table->getColumn('column_varbinary')->getFixed());
self::assertInstanceOf('Doctrine\DBAL\Types\BlobType', $table->getColumn('column_binary')->getType());
self::assertInstanceOf(BlobType::class, $table->getColumn('column_binary')->getType());
self::assertFalse($table->getColumn('column_binary')->getFixed());
}
......@@ -165,7 +167,7 @@ EOS
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(<<<EOS
$this->connection->exec(<<<EOS
CREATE TABLE non_default_pk_order (
id INTEGER,
other_id INTEGER,
......@@ -174,7 +176,7 @@ CREATE TABLE non_default_pk_order (
EOS
);
$tableIndexes = $this->_sm->listTableIndexes('non_default_pk_order');
$tableIndexes = $this->schemaManager->listTableIndexes('non_default_pk_order');
self::assertCount(1, $tableIndexes);
......@@ -194,9 +196,9 @@ CREATE TABLE dbal_1779 (
)
SQL;
$this->_conn->exec($sql);
$this->connection->exec($sql);
$columns = $this->_sm->listTableColumns('dbal_1779');
$columns = $this->schemaManager->listTableColumns('dbal_1779');
self::assertCount(2, $columns);
......@@ -222,21 +224,21 @@ SQL;
$offlineTable->addColumn('id', $integerType, ['autoincrement' => true, 'unsigned' => $unsigned]);
$offlineTable->setPrimaryKey(['id']);
$this->_sm->dropAndCreateTable($offlineTable);
$this->schemaManager->dropAndCreateTable($offlineTable);
$onlineTable = $this->_sm->listTableDetails($tableName);
$onlineTable = $this->schemaManager->listTableDetails($tableName);
$comparator = new Schema\Comparator();
$diff = $comparator->diffTable($offlineTable, $onlineTable);
if ($expectedComparatorDiff) {
self::assertEmpty($this->_sm->getDatabasePlatform()->getAlterTableSQL($diff));
self::assertEmpty($this->schemaManager->getDatabasePlatform()->getAlterTableSQL($diff));
} else {
self::assertFalse($diff);
}
}
/**
* @return array
* @return mixed[][]
*/
public function getDiffListIntegerAutoincrementTableColumnsData()
{
......@@ -259,15 +261,15 @@ SQL;
$table->addColumn('id', 'integer');
$table->addColumn('text', 'text');
$table->setPrimaryKey(['id']);
$this->_sm->dropAndCreateTable($table);
$this->schemaManager->dropAndCreateTable($table);
$this->_conn->insert('test_pk_auto_increment', ['text' => '1']);
$this->connection->insert('test_pk_auto_increment', ['text' => '1']);
$this->_conn->query('DELETE FROM test_pk_auto_increment');
$this->connection->query('DELETE FROM test_pk_auto_increment');
$this->_conn->insert('test_pk_auto_increment', ['text' => '2']);
$this->connection->insert('test_pk_auto_increment', ['text' => '2']);
$query = $this->_conn->query('SELECT id FROM test_pk_auto_increment WHERE text = "2"');
$query = $this->connection->query('SELECT id FROM test_pk_auto_increment WHERE text = "2"');
$query->execute();
$lastUsedIdAfterDelete = (int) $query->fetchColumn();
......
......@@ -20,15 +20,15 @@ class StatementTest extends DbalFunctionalTestCase
$table = new Table('stmt_test');
$table->addColumn('id', 'integer');
$table->addColumn('name', 'text', ['notnull' => false]);
$this->_conn->getSchemaManager()->dropAndCreateTable($table);
$this->connection->getSchemaManager()->dropAndCreateTable($table);
}
public function testStatementIsReusableAfterClosingCursor()
{
$this->_conn->insert('stmt_test', ['id' => 1]);
$this->_conn->insert('stmt_test', ['id' => 2]);
$this->connection->insert('stmt_test', ['id' => 1]);
$this->connection->insert('stmt_test', ['id' => 2]);
$stmt = $this->_conn->prepare('SELECT id FROM stmt_test ORDER BY id');
$stmt = $this->connection->prepare('SELECT id FROM stmt_test ORDER BY id');
$stmt->execute();
......@@ -46,7 +46,7 @@ class StatementTest extends DbalFunctionalTestCase
public function testReuseStatementWithLongerResults()
{
$sm = $this->_conn->getSchemaManager();
$sm = $this->connection->getSchemaManager();
$table = new Table('stmt_longer_results');
$table->addColumn('param', 'string');
$table->addColumn('val', 'text');
......@@ -56,9 +56,9 @@ class StatementTest extends DbalFunctionalTestCase
'param' => 'param1',
'val' => 'X',
];
$this->_conn->insert('stmt_longer_results', $row1);
$this->connection->insert('stmt_longer_results', $row1);
$stmt = $this->_conn->prepare('SELECT param, val FROM stmt_longer_results ORDER BY param');
$stmt = $this->connection->prepare('SELECT param, val FROM stmt_longer_results ORDER BY param');
$stmt->execute();
self::assertArraySubset([
['param1', 'X'],
......@@ -68,7 +68,7 @@ class StatementTest extends DbalFunctionalTestCase
'param' => 'param2',
'val' => 'A bit longer value',
];
$this->_conn->insert('stmt_longer_results', $row2);
$this->connection->insert('stmt_longer_results', $row2);
$stmt->execute();
self::assertArraySubset([
......@@ -83,7 +83,7 @@ class StatementTest extends DbalFunctionalTestCase
// 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->connection->getSchemaManager();
$table = new Table('stmt_long_blob');
$table->addColumn('contents', 'blob', ['length' => 0xFFFFFFFF]);
$sm->createTable($table);
......@@ -105,15 +105,15 @@ d+N0hqezcjblboJ3Bj8ARJilHX4FAAA=
EOF
);
$this->_conn->insert('stmt_long_blob', ['contents' => $contents], [ParameterType::LARGE_OBJECT]);
$this->connection->insert('stmt_long_blob', ['contents' => $contents], [ParameterType::LARGE_OBJECT]);
$stmt = $this->_conn->prepare('SELECT contents FROM stmt_long_blob');
$stmt = $this->connection->prepare('SELECT contents FROM stmt_long_blob');
$stmt->execute();
$stream = Type::getType('blob')
->convertToPHPValue(
$stmt->fetchColumn(),
$this->_conn->getDatabasePlatform()
$this->connection->getDatabasePlatform()
);
self::assertSame($contents, stream_get_contents($stream));
......@@ -121,27 +121,27 @@ EOF
public function testIncompletelyFetchedStatementDoesNotBlockConnection()
{
$this->_conn->insert('stmt_test', ['id' => 1]);
$this->_conn->insert('stmt_test', ['id' => 2]);
$this->connection->insert('stmt_test', ['id' => 1]);
$this->connection->insert('stmt_test', ['id' => 2]);
$stmt1 = $this->_conn->prepare('SELECT id FROM stmt_test');
$stmt1 = $this->connection->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->connection->prepare('SELECT id FROM stmt_test WHERE id = ?');
$stmt2->execute([1]);
self::assertEquals(1, $stmt2->fetchColumn());
}
public function testReuseStatementAfterClosingCursor()
{
$this->_conn->insert('stmt_test', ['id' => 1]);
$this->_conn->insert('stmt_test', ['id' => 2]);
$this->connection->insert('stmt_test', ['id' => 1]);
$this->connection->insert('stmt_test', ['id' => 2]);
$stmt = $this->_conn->prepare('SELECT id FROM stmt_test WHERE id = ?');
$stmt = $this->connection->prepare('SELECT id FROM stmt_test WHERE id = ?');
$stmt->execute([1]);
$id = $stmt->fetchColumn();
......@@ -156,10 +156,10 @@ EOF
public function testReuseStatementWithParameterBoundByReference()
{
$this->_conn->insert('stmt_test', ['id' => 1]);
$this->_conn->insert('stmt_test', ['id' => 2]);
$this->connection->insert('stmt_test', ['id' => 1]);
$this->connection->insert('stmt_test', ['id' => 2]);
$stmt = $this->_conn->prepare('SELECT id FROM stmt_test WHERE id = ?');
$stmt = $this->connection->prepare('SELECT id FROM stmt_test WHERE id = ?');
$stmt->bindParam(1, $id);
$id = 1;
......@@ -173,10 +173,10 @@ EOF
public function testReuseStatementWithReboundValue()
{
$this->_conn->insert('stmt_test', ['id' => 1]);
$this->_conn->insert('stmt_test', ['id' => 2]);
$this->connection->insert('stmt_test', ['id' => 1]);
$this->connection->insert('stmt_test', ['id' => 2]);
$stmt = $this->_conn->prepare('SELECT id FROM stmt_test WHERE id = ?');
$stmt = $this->connection->prepare('SELECT id FROM stmt_test WHERE id = ?');
$stmt->bindValue(1, 1);
$stmt->execute();
......@@ -189,10 +189,10 @@ EOF
public function testReuseStatementWithReboundParam()
{
$this->_conn->insert('stmt_test', ['id' => 1]);
$this->_conn->insert('stmt_test', ['id' => 2]);
$this->connection->insert('stmt_test', ['id' => 1]);
$this->connection->insert('stmt_test', ['id' => 2]);
$stmt = $this->_conn->prepare('SELECT id FROM stmt_test WHERE id = ?');
$stmt = $this->connection->prepare('SELECT id FROM stmt_test WHERE id = ?');
$x = 1;
$stmt->bindParam(1, $x);
......@@ -210,14 +210,14 @@ EOF
*/
public function testFetchFromNonExecutedStatement(callable $fetch, $expected)
{
$stmt = $this->_conn->prepare('SELECT id FROM stmt_test');
$stmt = $this->connection->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->connection->prepare('SELECT id FROM stmt_test');
self::assertTrue($stmt->closeCursor());
}
......@@ -227,7 +227,7 @@ EOF
*/
public function testCloseCursorAfterCursorEnd()
{
$stmt = $this->_conn->prepare('SELECT name FROM stmt_test');
$stmt = $this->connection->prepare('SELECT name FROM stmt_test');
$stmt->execute();
$stmt->fetch();
......@@ -240,7 +240,7 @@ EOF
*/
public function testFetchFromNonExecutedStatementWithClosedCursor(callable $fetch, $expected)
{
$stmt = $this->_conn->prepare('SELECT id FROM stmt_test');
$stmt = $this->connection->prepare('SELECT id FROM stmt_test');
$stmt->closeCursor();
self::assertSame($expected, $fetch($stmt));
......@@ -251,9 +251,9 @@ EOF
*/
public function testFetchFromExecutedStatementWithClosedCursor(callable $fetch, $expected)
{
$this->_conn->insert('stmt_test', ['id' => 1]);
$this->connection->insert('stmt_test', ['id' => 1]);
$stmt = $this->_conn->prepare('SELECT id FROM stmt_test');
$stmt = $this->connection->prepare('SELECT id FROM stmt_test');
$stmt->execute();
$stmt->closeCursor();
......@@ -286,9 +286,9 @@ EOF
public function testFetchInColumnMode() : void
{
$platform = $this->_conn->getDatabasePlatform();
$platform = $this->connection->getDatabasePlatform();
$query = $platform->getDummySelectSQL();
$result = $this->_conn->executeQuery($query)->fetch(FetchMode::COLUMN);
$result = $this->connection->executeQuery($query)->fetch(FetchMode::COLUMN);
self::assertEquals(1, $result);
}
......
......@@ -20,7 +20,7 @@ class TableGeneratorTest extends DbalFunctionalTestCase
{
parent::setUp();
$platform = $this->_conn->getDatabasePlatform();
$platform = $this->connection->getDatabasePlatform();
if ($platform->getName() === 'sqlite') {
$this->markTestSkipped('TableGenerator does not work with SQLite');
}
......@@ -31,11 +31,11 @@ class TableGeneratorTest extends DbalFunctionalTestCase
$schema->visit($visitor);
foreach ($schema->toSql($platform) as $sql) {
$this->_conn->exec($sql);
$this->connection->exec($sql);
}
} catch (Throwable $e) {
}
$this->generator = new TableGenerator($this->_conn);
$this->generator = new TableGenerator($this->connection);
}
public function testNextVal()
......@@ -51,9 +51,9 @@ class TableGeneratorTest extends DbalFunctionalTestCase
public function testNextValNotAffectedByOuterTransactions()
{
$this->_conn->beginTransaction();
$this->connection->beginTransaction();
$id1 = $this->generator->nextValue('tbl1');
$this->_conn->rollBack();
$this->connection->rollBack();
$id2 = $this->generator->nextValue('tbl1');
self::assertGreaterThan(0, $id1, 'First id has to be larger than 0');
......
......@@ -13,17 +13,17 @@ class TemporaryTableTest extends DbalFunctionalTestCase
{
parent::setUp();
try {
$this->_conn->exec($this->_conn->getDatabasePlatform()->getDropTableSQL('nontemporary'));
$this->connection->exec($this->connection->getDatabasePlatform()->getDropTableSQL('nontemporary'));
} catch (Throwable $e) {
}
}
protected function tearDown()
{
if ($this->_conn) {
if ($this->connection) {
try {
$tempTable = $this->_conn->getDatabasePlatform()->getTemporaryTableName('my_temporary');
$this->_conn->exec($this->_conn->getDatabasePlatform()->getDropTemporaryTableSQL($tempTable));
$tempTable = $this->connection->getDatabasePlatform()->getTemporaryTableName('my_temporary');
$this->connection->exec($this->connection->getDatabasePlatform()->getDropTemporaryTableSQL($tempTable));
} catch (Throwable $e) {
}
}
......@@ -38,33 +38,33 @@ class TemporaryTableTest extends DbalFunctionalTestCase
*/
public function testDropTemporaryTableNotAutoCommitTransaction()
{
if ($this->_conn->getDatabasePlatform()->getName() === 'sqlanywhere' ||
$this->_conn->getDatabasePlatform()->getName() === 'oracle') {
if ($this->connection->getDatabasePlatform()->getName() === 'sqlanywhere' ||
$this->connection->getDatabasePlatform()->getName() === 'oracle') {
$this->markTestSkipped('Test does not work on Oracle and SQL Anywhere.');
}
$platform = $this->_conn->getDatabasePlatform();
$platform = $this->connection->getDatabasePlatform();
$columnDefinitions = ['id' => ['type' => Type::getType('integer'), 'notnull' => true]];
$tempTable = $platform->getTemporaryTableName('my_temporary');
$createTempTableSQL = $platform->getCreateTemporaryTableSnippetSQL() . ' ' . $tempTable . ' ('
. $platform->getColumnDeclarationListSQL($columnDefinitions) . ')';
$this->_conn->executeUpdate($createTempTableSQL);
$this->connection->executeUpdate($createTempTableSQL);
$table = new Table('nontemporary');
$table->addColumn('id', 'integer');
$table->setPrimaryKey(['id']);
$this->_conn->getSchemaManager()->createTable($table);
$this->connection->getSchemaManager()->createTable($table);
$this->_conn->beginTransaction();
$this->_conn->insert('nontemporary', ['id' => 1]);
$this->_conn->exec($platform->getDropTemporaryTableSQL($tempTable));
$this->_conn->insert('nontemporary', ['id' => 2]);
$this->connection->beginTransaction();
$this->connection->insert('nontemporary', ['id' => 1]);
$this->connection->exec($platform->getDropTemporaryTableSQL($tempTable));
$this->connection->insert('nontemporary', ['id' => 2]);
$this->_conn->rollBack();
$this->connection->rollBack();
$rows = $this->_conn->fetchAll('SELECT * FROM nontemporary');
$rows = $this->connection->fetchAll('SELECT * FROM nontemporary');
self::assertEquals([], $rows, 'In an event of an error this result has one row, because of an implicit commit.');
}
......@@ -75,12 +75,12 @@ class TemporaryTableTest extends DbalFunctionalTestCase
*/
public function testCreateTemporaryTableNotAutoCommitTransaction()
{
if ($this->_conn->getDatabasePlatform()->getName() === 'sqlanywhere' ||
$this->_conn->getDatabasePlatform()->getName() === 'oracle') {
if ($this->connection->getDatabasePlatform()->getName() === 'sqlanywhere' ||
$this->connection->getDatabasePlatform()->getName() === 'oracle') {
$this->markTestSkipped('Test does not work on Oracle and SQL Anywhere.');
}
$platform = $this->_conn->getDatabasePlatform();
$platform = $this->connection->getDatabasePlatform();
$columnDefinitions = ['id' => ['type' => Type::getType('integer'), 'notnull' => true]];
$tempTable = $platform->getTemporaryTableName('my_temporary');
......@@ -91,22 +91,22 @@ class TemporaryTableTest extends DbalFunctionalTestCase
$table->addColumn('id', 'integer');
$table->setPrimaryKey(['id']);
$this->_conn->getSchemaManager()->createTable($table);
$this->connection->getSchemaManager()->createTable($table);
$this->_conn->beginTransaction();
$this->_conn->insert('nontemporary', ['id' => 1]);
$this->connection->beginTransaction();
$this->connection->insert('nontemporary', ['id' => 1]);
$this->_conn->exec($createTempTableSQL);
$this->_conn->insert('nontemporary', ['id' => 2]);
$this->connection->exec($createTempTableSQL);
$this->connection->insert('nontemporary', ['id' => 2]);
$this->_conn->rollBack();
$this->connection->rollBack();
try {
$this->_conn->exec($platform->getDropTemporaryTableSQL($tempTable));
$this->connection->exec($platform->getDropTemporaryTableSQL($tempTable));
} catch (Throwable $e) {
}
$rows = $this->_conn->fetchAll('SELECT * FROM nontemporary');
$rows = $this->connection->fetchAll('SELECT * FROM nontemporary');
self::assertEquals([], $rows, 'In an event of an error this result has one row, because of an implicit commit.');
}
}
......@@ -12,7 +12,7 @@ class DBAL168Test extends DbalFunctionalTestCase
{
public function testDomainsTable()
{
if ($this->_conn->getDatabasePlatform()->getName() !== 'postgresql') {
if ($this->connection->getDatabasePlatform()->getName() !== 'postgresql') {
$this->markTestSkipped('PostgreSQL only test');
}
......@@ -22,8 +22,8 @@ class DBAL168Test extends DbalFunctionalTestCase
$table->setPrimaryKey(['id']);
$table->addForeignKeyConstraint('domains', ['parent_id'], ['id']);
$this->_conn->getSchemaManager()->createTable($table);
$table = $this->_conn->getSchemaManager()->listTableDetails('domains');
$this->connection->getSchemaManager()->createTable($table);
$table = $this->connection->getSchemaManager()->listTableDetails('domains');
self::assertEquals('domains', $table->getName());
}
......
......@@ -14,38 +14,38 @@ class DBAL202Test extends DbalFunctionalTestCase
{
parent::setUp();
if ($this->_conn->getDatabasePlatform()->getName() !== 'oracle') {
if ($this->connection->getDatabasePlatform()->getName() !== 'oracle') {
$this->markTestSkipped('OCI8 only test');
}
if ($this->_conn->getSchemaManager()->tablesExist('DBAL202')) {
$this->_conn->exec('DELETE FROM DBAL202');
if ($this->connection->getSchemaManager()->tablesExist('DBAL202')) {
$this->connection->exec('DELETE FROM DBAL202');
} else {
$table = new Table('DBAL202');
$table->addColumn('id', 'integer');
$table->setPrimaryKey(['id']);
$this->_conn->getSchemaManager()->createTable($table);
$this->connection->getSchemaManager()->createTable($table);
}
}
public function testStatementRollback()
{
$stmt = $this->_conn->prepare('INSERT INTO DBAL202 VALUES (8)');
$this->_conn->beginTransaction();
$stmt = $this->connection->prepare('INSERT INTO DBAL202 VALUES (8)');
$this->connection->beginTransaction();
$stmt->execute();
$this->_conn->rollBack();
$this->connection->rollBack();
self::assertEquals(0, $this->_conn->query('SELECT COUNT(1) FROM DBAL202')->fetchColumn());
self::assertEquals(0, $this->connection->query('SELECT COUNT(1) FROM DBAL202')->fetchColumn());
}
public function testStatementCommit()
{
$stmt = $this->_conn->prepare('INSERT INTO DBAL202 VALUES (8)');
$this->_conn->beginTransaction();
$stmt = $this->connection->prepare('INSERT INTO DBAL202 VALUES (8)');
$this->connection->beginTransaction();
$stmt->execute();
$this->_conn->commit();
$this->connection->commit();
self::assertEquals(1, $this->_conn->query('SELECT COUNT(1) FROM DBAL202')->fetchColumn());
self::assertEquals(1, $this->connection->query('SELECT COUNT(1) FROM DBAL202')->fetchColumn());
}
}
......@@ -15,7 +15,7 @@ class DBAL421Test extends DbalFunctionalTestCase
{
parent::setUp();
$platform = $this->_conn->getDatabasePlatform()->getName();
$platform = $this->connection->getDatabasePlatform()->getName();
if (in_array($platform, ['mysql', 'sqlite'])) {
return;
}
......@@ -25,7 +25,7 @@ class DBAL421Test extends DbalFunctionalTestCase
public function testGuidShouldMatchPattern()
{
$guid = $this->_conn->query($this->getSelectGuidSql())->fetchColumn();
$guid = $this->connection->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');
}
......@@ -36,7 +36,7 @@ class DBAL421Test extends DbalFunctionalTestCase
*/
public function testGuidShouldBeRandom()
{
$statement = $this->_conn->prepare($this->getSelectGuidSql());
$statement = $this->connection->prepare($this->getSelectGuidSql());
$guids = [];
for ($i = 0; $i < 99; $i++) {
......@@ -51,6 +51,6 @@ class DBAL421Test extends DbalFunctionalTestCase
private function getSelectGuidSql()
{
return 'SELECT ' . $this->_conn->getDatabasePlatform()->getGuidExpression();
return 'SELECT ' . $this->connection->getDatabasePlatform()->getGuidExpression();
}
}
......@@ -23,7 +23,7 @@ class TypeConversionPerformanceTest extends DbalPerformanceTestCase
{
$value = new DateTime();
$type = Type::getType('datetime');
$platform = $this->_conn->getDatabasePlatform();
$platform = $this->connection->getDatabasePlatform();
$this->startTiming();
for ($i = 0; $i < $count; $i++) {
$type->convertToDatabaseValue($value, $platform);
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment