Use `self::assert*()` instead of `$this->assert*()`

parent 48fa3958
......@@ -40,7 +40,7 @@ class QueryCacheProfileTest extends DbalTestCase
$connectionParams
);
$this->assertEquals(self::CACHE_KEY, $cacheKey, 'The returned cache key should match the given one');
self::assertEquals(self::CACHE_KEY, $cacheKey, 'The returned cache key should match the given one');
}
public function testShouldGenerateAnAutomaticKeyIfNoKeyHasBeenGiven()
......@@ -66,13 +66,13 @@ class QueryCacheProfileTest extends DbalTestCase
$connectionParams
);
$this->assertNotEquals(
self::assertNotEquals(
self::CACHE_KEY,
$cacheKey,
'The returned cache key should be generated automatically'
);
$this->assertNotEmpty($cacheKey, 'The generated cache key should not be empty');
self::assertNotEmpty($cacheKey, 'The generated cache key should not be empty');
}
public function testShouldGenerateDifferentKeysForSameQueryAndParamsAndDifferentConnections()
......@@ -107,7 +107,7 @@ class QueryCacheProfileTest extends DbalTestCase
$connectionParams
);
$this->assertNotEquals($firstCacheKey, $secondCacheKey, 'Cache keys should be different');
self::assertNotEquals($firstCacheKey, $secondCacheKey, 'Cache keys should be different');
}
public function testShouldGenerateSameKeysIfNoneOfTheParamsChanges()
......@@ -140,6 +140,6 @@ class QueryCacheProfileTest extends DbalTestCase
$connectionParams
);
$this->assertEquals($firstCacheKey, $secondCacheKey, 'Cache keys should be the same');
self::assertEquals($firstCacheKey, $secondCacheKey, 'Cache keys should be the same');
}
}
......@@ -51,7 +51,7 @@ class ConfigurationTest extends DbalTestCase
*/
public function testReturnsDefaultConnectionAutoCommitMode()
{
$this->assertTrue($this->config->getAutoCommit());
self::assertTrue($this->config->getAutoCommit());
}
/**
......@@ -63,10 +63,10 @@ class ConfigurationTest extends DbalTestCase
{
$this->config->setAutoCommit(false);
$this->assertFalse($this->config->getAutoCommit());
self::assertFalse($this->config->getAutoCommit());
$this->config->setAutoCommit(0);
$this->assertFalse($this->config->getAutoCommit());
self::assertFalse($this->config->getAutoCommit());
}
}
......@@ -56,12 +56,12 @@ class ConnectionTest extends \Doctrine\Tests\DbalTestCase
public function testIsConnected()
{
$this->assertFalse($this->_conn->isConnected());
self::assertFalse($this->_conn->isConnected());
}
public function testNoTransactionActiveByDefault()
{
$this->assertFalse($this->_conn->isTransactionActive());
self::assertFalse($this->_conn->isTransactionActive());
}
public function testCommitWithNoActiveTransaction_ThrowsException()
......@@ -92,37 +92,37 @@ class ConnectionTest extends \Doctrine\Tests\DbalTestCase
{
$config = $this->_conn->getConfiguration();
$this->assertInstanceOf('Doctrine\DBAL\Configuration', $config);
self::assertInstanceOf('Doctrine\DBAL\Configuration', $config);
}
public function testGetHost()
{
$this->assertEquals('localhost', $this->_conn->getHost());
self::assertEquals('localhost', $this->_conn->getHost());
}
public function testGetPort()
{
$this->assertEquals('1234', $this->_conn->getPort());
self::assertEquals('1234', $this->_conn->getPort());
}
public function testGetUsername()
{
$this->assertEquals('root', $this->_conn->getUsername());
self::assertEquals('root', $this->_conn->getUsername());
}
public function testGetPassword()
{
$this->assertEquals('password', $this->_conn->getPassword());
self::assertEquals('password', $this->_conn->getPassword());
}
public function testGetDriver()
{
$this->assertInstanceOf('Doctrine\DBAL\Driver\PDOMySql\Driver', $this->_conn->getDriver());
self::assertInstanceOf('Doctrine\DBAL\Driver\PDOMySql\Driver', $this->_conn->getDriver());
}
public function testGetEventManager()
{
$this->assertInstanceOf('Doctrine\Common\EventManager', $this->_conn->getEventManager());
self::assertInstanceOf('Doctrine\Common\EventManager', $this->_conn->getEventManager());
}
public function testConnectDispatchEvent()
......@@ -148,8 +148,8 @@ class ConnectionTest extends \Doctrine\Tests\DbalTestCase
{
$driverMock = new DriverMock();
$connection = new Connection($this->params, $driverMock);
$this->assertInstanceOf('Doctrine\Common\EventManager', $connection->getDatabasePlatform()->getEventManager());
$this->assertSame($connection->getEventManager(), $connection->getDatabasePlatform()->getEventManager());
self::assertInstanceOf('Doctrine\Common\EventManager', $connection->getDatabasePlatform()->getEventManager());
self::assertSame($connection->getEventManager(), $connection->getDatabasePlatform()->getEventManager());
}
/**
......@@ -189,7 +189,7 @@ class ConnectionTest extends \Doctrine\Tests\DbalTestCase
{
$logger = new \Doctrine\DBAL\Logging\EchoSQLLogger();
$this->_conn->getConfiguration()->setSQLLogger($logger);
$this->assertSame($logger, $this->_conn->getConfiguration()->getSQLLogger());
self::assertSame($logger, $this->_conn->getConfiguration()->getSQLLogger());
}
/**
......@@ -201,7 +201,7 @@ class ConnectionTest extends \Doctrine\Tests\DbalTestCase
{
$logger = new \Doctrine\DBAL\Logging\DebugStack();
$this->_conn->getConfiguration()->setSQLLogger($logger);
$this->assertSame($logger, $this->_conn->getConfiguration()->getSQLLogger());
self::assertSame($logger, $this->_conn->getConfiguration()->getSQLLogger());
}
/**
......@@ -209,7 +209,7 @@ class ConnectionTest extends \Doctrine\Tests\DbalTestCase
*/
public function testIsAutoCommit()
{
$this->assertTrue($this->_conn->isAutoCommit());
self::assertTrue($this->_conn->isAutoCommit());
}
/**
......@@ -218,9 +218,9 @@ class ConnectionTest extends \Doctrine\Tests\DbalTestCase
public function testSetAutoCommit()
{
$this->_conn->setAutoCommit(false);
$this->assertFalse($this->_conn->isAutoCommit());
self::assertFalse($this->_conn->isAutoCommit());
$this->_conn->setAutoCommit(0);
$this->assertFalse($this->_conn->isAutoCommit());
self::assertFalse($this->_conn->isAutoCommit());
}
/**
......@@ -236,11 +236,11 @@ class ConnectionTest extends \Doctrine\Tests\DbalTestCase
$conn->setAutoCommit(false);
$this->assertFalse($conn->isTransactionActive());
self::assertFalse($conn->isTransactionActive());
$conn->connect();
$this->assertTrue($conn->isTransactionActive());
self::assertTrue($conn->isTransactionActive());
}
/**
......@@ -258,7 +258,7 @@ class ConnectionTest extends \Doctrine\Tests\DbalTestCase
$conn->connect();
$conn->commit();
$this->assertTrue($conn->isTransactionActive());
self::assertTrue($conn->isTransactionActive());
}
/**
......@@ -276,7 +276,7 @@ class ConnectionTest extends \Doctrine\Tests\DbalTestCase
$conn->connect();
$conn->rollBack();
$this->assertTrue($conn->isTransactionActive());
self::assertTrue($conn->isTransactionActive());
}
/**
......@@ -295,13 +295,13 @@ class ConnectionTest extends \Doctrine\Tests\DbalTestCase
$conn->beginTransaction();
$conn->setAutoCommit(false);
$this->assertSame(1, $conn->getTransactionNestingLevel());
self::assertSame(1, $conn->getTransactionNestingLevel());
$conn->beginTransaction();
$conn->beginTransaction();
$conn->setAutoCommit(true);
$this->assertFalse($conn->isTransactionActive());
self::assertFalse($conn->isTransactionActive());
}
public function testEmptyInsert()
......@@ -507,7 +507,7 @@ class ConnectionTest extends \Doctrine\Tests\DbalTestCase
->with($statement, $params, $types)
->will($this->returnValue($driverStatementMock));
$this->assertSame($result, $conn->fetchAssoc($statement, $params, $types));
self::assertSame($result, $conn->fetchAssoc($statement, $params, $types));
}
public function testFetchArray()
......@@ -541,7 +541,7 @@ class ConnectionTest extends \Doctrine\Tests\DbalTestCase
->with($statement, $params, $types)
->will($this->returnValue($driverStatementMock));
$this->assertSame($result, $conn->fetchArray($statement, $params, $types));
self::assertSame($result, $conn->fetchArray($statement, $params, $types));
}
public function testFetchColumn()
......@@ -576,7 +576,7 @@ class ConnectionTest extends \Doctrine\Tests\DbalTestCase
->with($statement, $params, $types)
->will($this->returnValue($driverStatementMock));
$this->assertSame($result, $conn->fetchColumn($statement, $params, $column, $types));
self::assertSame($result, $conn->fetchColumn($statement, $params, $column, $types));
}
public function testConnectionIsClosedButNotUnset()
......@@ -599,7 +599,7 @@ class ConnectionTest extends \Doctrine\Tests\DbalTestCase
// the wrapped connection should be null
// (and since connect() does nothing, this will not reconnect)
// this will also fail if this _conn property was unset instead of set to null
$this->assertNull($connection->getWrappedConnection());
self::assertNull($connection->getWrappedConnection());
}
public function testFetchAll()
......@@ -632,7 +632,7 @@ class ConnectionTest extends \Doctrine\Tests\DbalTestCase
->with($statement, $params, $types)
->will($this->returnValue($driverStatementMock));
$this->assertSame($result, $conn->fetchAll($statement, $params, $types));
self::assertSame($result, $conn->fetchAll($statement, $params, $types));
}
public function testConnectionDoesNotMaintainTwoReferencesToExternalPDO()
......@@ -643,7 +643,7 @@ class ConnectionTest extends \Doctrine\Tests\DbalTestCase
$conn = new Connection($params, $driverMock);
$this->assertArrayNotHasKey('pdo', $conn->getParams(), "Connection is maintaining additional reference to the PDO connection");
self::assertArrayNotHasKey('pdo', $conn->getParams(), "Connection is maintaining additional reference to the PDO connection");
}
public function testPassingExternalPDOMeansConnectionIsConnected()
......@@ -654,7 +654,7 @@ class ConnectionTest extends \Doctrine\Tests\DbalTestCase
$conn = new Connection($params, $driverMock);
$this->assertTrue($conn->isConnected(), "Connection is not connected after passing external PDO");
self::assertTrue($conn->isConnected(), "Connection is not connected after passing external PDO");
}
public function testCallingDeleteWithNoDeletionCriteriaResultsInInvalidArgumentException()
......@@ -741,7 +741,7 @@ class ConnectionTest extends \Doctrine\Tests\DbalTestCase
->with('6.6.6')
->will($this->returnValue($platformMock));
$this->assertSame($platformMock, $connection->getDatabasePlatform());
self::assertSame($platformMock, $connection->getDatabasePlatform());
}
public function testConnectionParamsArePassedToTheQueryCacheProfileInExecuteCacheQuery()
......@@ -776,7 +776,7 @@ class ConnectionTest extends \Doctrine\Tests\DbalTestCase
/* @var $driver Driver */
$driver = $this->createMock(Driver::class);
$this->assertInstanceOf(
self::assertInstanceOf(
ArrayStatement::class,
(new Connection($this->params, $driver))->executeCacheQuery($query, $params, $types, $queryCacheProfileMock)
);
......
......@@ -15,7 +15,7 @@ class DBALExceptionTest extends DbalTestCase
/* @var $driver Driver */
$driver = $this->createMock(Driver::class);
$e = DBALException::driverExceptionDuringQuery($driver, new \Exception, '', array('ABC', chr(128)));
$this->assertContains('with params ["ABC", "\x80"]', $e->getMessage());
self::assertContains('with params ["ABC", "\x80"]', $e->getMessage());
}
public function testAvoidOverWrappingOnDriverException()
......@@ -40,7 +40,7 @@ class DBALExceptionTest extends DbalTestCase
};
$ex = new DriverException('', $inner);
$e = DBALException::driverExceptionDuringQuery($driver, $ex, '');
$this->assertSame($ex, $e);
self::assertSame($ex, $e);
}
public function testDriverRequiredWithUrl()
......@@ -48,8 +48,8 @@ class DBALExceptionTest extends DbalTestCase
$url = 'mysql://localhost';
$exception = DBALException::driverRequired($url);
$this->assertInstanceOf(DBALException::class, $exception);
$this->assertSame(
self::assertInstanceOf(DBALException::class, $exception);
self::assertSame(
sprintf(
"The options 'driver' or 'driverClass' are mandatory if a connection URL without scheme " .
'is given to DriverManager::getConnection(). Given URL: %s',
......
......@@ -95,11 +95,11 @@ abstract class AbstractDriverTest extends DbalTestCase
$convertedException = $this->driver->convertException($message, $driverException);
$this->assertSame($convertedExceptionClassName, get_class($convertedException));
self::assertSame($convertedExceptionClassName, get_class($convertedException));
$this->assertSame($driverException->getErrorCode(), $convertedException->getErrorCode());
$this->assertSame($driverException->getSQLState(), $convertedException->getSQLState());
$this->assertSame($message, $convertedException->getMessage());
self::assertSame($driverException->getErrorCode(), $convertedException->getErrorCode());
self::assertSame($driverException->getSQLState(), $convertedException->getSQLState());
self::assertSame($message, $convertedException->getMessage());
}
}
......@@ -122,7 +122,7 @@ abstract class AbstractDriverTest extends DbalTestCase
}
foreach ($data as $item) {
$this->assertSame($item[1], get_class($this->driver->createDatabasePlatformForVersion($item[0])));
self::assertSame($item[1], get_class($this->driver->createDatabasePlatformForVersion($item[0])));
}
}
......@@ -152,12 +152,12 @@ abstract class AbstractDriverTest extends DbalTestCase
->method('getParams')
->will($this->returnValue($params));
$this->assertSame($params['dbname'], $this->driver->getDatabase($connection));
self::assertSame($params['dbname'], $this->driver->getDatabase($connection));
}
public function testReturnsDatabasePlatform()
{
$this->assertEquals($this->createPlatform(), $this->driver->getDatabasePlatform());
self::assertEquals($this->createPlatform(), $this->driver->getDatabasePlatform());
}
public function testReturnsSchemaManager()
......@@ -165,8 +165,8 @@ abstract class AbstractDriverTest extends DbalTestCase
$connection = $this->getConnectionMock();
$schemaManager = $this->driver->getSchemaManager($connection);
$this->assertEquals($this->createSchemaManager($connection), $schemaManager);
$this->assertAttributeSame($connection, '_conn', $schemaManager);
self::assertEquals($this->createSchemaManager($connection), $schemaManager);
self::assertAttributeSame($connection, '_conn', $schemaManager);
}
/**
......
......@@ -34,7 +34,7 @@ class AbstractMySQLDriverTest extends AbstractDriverTest
->method('query')
->will($this->returnValue($statement));
$this->assertSame($database, $this->driver->getDatabase($connection));
self::assertSame($database, $this->driver->getDatabase($connection));
}
protected function createDriver()
......
......@@ -22,7 +22,7 @@ class AbstractOracleDriverTest extends AbstractDriverTest
->method('getParams')
->will($this->returnValue($params));
$this->assertSame($params['user'], $this->driver->getDatabase($connection));
self::assertSame($params['user'], $this->driver->getDatabase($connection));
}
public function testReturnsDatabaseNameWithConnectDescriptor()
......@@ -41,7 +41,7 @@ class AbstractOracleDriverTest extends AbstractDriverTest
->method('getParams')
->will($this->returnValue($params));
$this->assertSame($params['user'], $this->driver->getDatabase($connection));
self::assertSame($params['user'], $this->driver->getDatabase($connection));
}
protected function createDriver()
......
......@@ -34,7 +34,7 @@ class AbstractPostgreSQLDriverTest extends AbstractDriverTest
->method('query')
->will($this->returnValue($statement));
$this->assertSame($database, $this->driver->getDatabase($connection));
self::assertSame($database, $this->driver->getDatabase($connection));
}
protected function createDriver()
......
......@@ -23,7 +23,7 @@ class AbstractSQLiteDriverTest extends AbstractDriverTest
->method('getParams')
->will($this->returnValue($params));
$this->assertSame($params['path'], $this->driver->getDatabase($connection));
self::assertSame($params['path'], $this->driver->getDatabase($connection));
}
protected function createDriver()
......
......@@ -12,7 +12,7 @@ class DriverTest extends PDOMySQLDriverTest
{
public function testReturnsName()
{
$this->assertSame('drizzle_pdo_mysql', $this->driver->getName());
self::assertSame('drizzle_pdo_mysql', $this->driver->getName());
}
public function testThrowsExceptionOnCreatingDatabasePlatformsForInvalidVersion()
......
......@@ -28,6 +28,6 @@ class DB2ConnectionTest extends DbalTestCase
public function testDoesNotRequireQueryForServerVersion()
{
$this->assertFalse($this->connectionMock->requiresQueryForServerVersion());
self::assertFalse($this->connectionMock->requiresQueryForServerVersion());
}
}
......@@ -9,7 +9,7 @@ class DriverTest extends AbstractDB2DriverTest
{
public function testReturnsName()
{
$this->assertSame('ibm_db2', $this->driver->getName());
self::assertSame('ibm_db2', $this->driver->getName());
}
protected function createDriver()
......
......@@ -9,7 +9,7 @@ class DriverTest extends AbstractMySQLDriverTest
{
public function testReturnsName()
{
$this->assertSame('mysqli', $this->driver->getName());
self::assertSame('mysqli', $this->driver->getName());
}
protected function createDriver()
......
......@@ -30,7 +30,7 @@ class MysqliConnectionTest extends DbalTestCase
public function testDoesNotRequireQueryForServerVersion()
{
$this->assertFalse($this->connectionMock->requiresQueryForServerVersion());
self::assertFalse($this->connectionMock->requiresQueryForServerVersion());
}
public function testRestoresErrorHandlerOnException()
......
......@@ -9,7 +9,7 @@ class DriverTest extends AbstractOracleDriverTest
{
public function testReturnsName()
{
$this->assertSame('oci8', $this->driver->getName());
self::assertSame('oci8', $this->driver->getName());
}
protected function createDriver()
......
......@@ -28,6 +28,6 @@ class OCI8ConnectionTest extends DbalTestCase
public function testDoesNotRequireQueryForServerVersion()
{
$this->assertFalse($this->connectionMock->requiresQueryForServerVersion());
self::assertFalse($this->connectionMock->requiresQueryForServerVersion());
}
}
......@@ -44,26 +44,26 @@ class PDOExceptionTest extends DbalTestCase
public function testReturnsCode()
{
$this->assertSame(self::SQLSTATE, $this->exception->getCode());
self::assertSame(self::SQLSTATE, $this->exception->getCode());
}
public function testReturnsErrorCode()
{
$this->assertSame(self::ERROR_CODE, $this->exception->getErrorCode());
self::assertSame(self::ERROR_CODE, $this->exception->getErrorCode());
}
public function testReturnsMessage()
{
$this->assertSame(self::MESSAGE, $this->exception->getMessage());
self::assertSame(self::MESSAGE, $this->exception->getMessage());
}
public function testReturnsSQLState()
{
$this->assertSame(self::SQLSTATE, $this->exception->getSQLState());
self::assertSame(self::SQLSTATE, $this->exception->getSQLState());
}
public function testOriginalExceptionIsInChain()
{
$this->assertSame($this->wrappedException, $this->exception->getPrevious());
self::assertSame($this->wrappedException, $this->exception->getPrevious());
}
}
......@@ -9,7 +9,7 @@ class DriverTest extends AbstractDB2DriverTest
{
public function testReturnsName()
{
$this->assertSame('pdo_ibm', $this->driver->getName());
self::assertSame('pdo_ibm', $this->driver->getName());
}
protected function createDriver()
......
......@@ -9,7 +9,7 @@ class DriverTest extends AbstractMySQLDriverTest
{
public function testReturnsName()
{
$this->assertSame('pdo_mysql', $this->driver->getName());
self::assertSame('pdo_mysql', $this->driver->getName());
}
protected function createDriver()
......
......@@ -9,7 +9,7 @@ class DriverTest extends AbstractOracleDriverTest
{
public function testReturnsName()
{
$this->assertSame('pdo_oracle', $this->driver->getName());
self::assertSame('pdo_oracle', $this->driver->getName());
}
protected function createDriver()
......
......@@ -11,7 +11,7 @@ class DriverTest extends AbstractPostgreSQLDriverTest
{
public function testReturnsName()
{
$this->assertSame('pdo_pgsql', $this->driver->getName());
self::assertSame('pdo_pgsql', $this->driver->getName());
}
/**
......@@ -30,10 +30,10 @@ class DriverTest extends AbstractPostgreSQLDriverTest
$GLOBALS['db_password']
);
$this->assertInstanceOf('Doctrine\DBAL\Driver\PDOConnection', $connection);
self::assertInstanceOf('Doctrine\DBAL\Driver\PDOConnection', $connection);
try {
$this->assertTrue($connection->getAttribute(PDO::PGSQL_ATTR_DISABLE_PREPARES));
self::assertTrue($connection->getAttribute(PDO::PGSQL_ATTR_DISABLE_PREPARES));
} catch (PDOException $ignored) {
/** @link https://bugs.php.net/bug.php?id=68371 */
$this->markTestIncomplete('See https://bugs.php.net/bug.php?id=68371');
......@@ -57,10 +57,10 @@ class DriverTest extends AbstractPostgreSQLDriverTest
array(PDO::PGSQL_ATTR_DISABLE_PREPARES => false)
);
$this->assertInstanceOf('Doctrine\DBAL\Driver\PDOConnection', $connection);
self::assertInstanceOf('Doctrine\DBAL\Driver\PDOConnection', $connection);
try {
$this->assertNotSame(true, $connection->getAttribute(PDO::PGSQL_ATTR_DISABLE_PREPARES));
self::assertNotSame(true, $connection->getAttribute(PDO::PGSQL_ATTR_DISABLE_PREPARES));
} catch (PDOException $ignored) {
/** @link https://bugs.php.net/bug.php?id=68371 */
$this->markTestIncomplete('See https://bugs.php.net/bug.php?id=68371');
......@@ -84,10 +84,10 @@ class DriverTest extends AbstractPostgreSQLDriverTest
array(PDO::PGSQL_ATTR_DISABLE_PREPARES => true)
);
$this->assertInstanceOf('Doctrine\DBAL\Driver\PDOConnection', $connection);
self::assertInstanceOf('Doctrine\DBAL\Driver\PDOConnection', $connection);
try {
$this->assertTrue($connection->getAttribute(PDO::PGSQL_ATTR_DISABLE_PREPARES));
self::assertTrue($connection->getAttribute(PDO::PGSQL_ATTR_DISABLE_PREPARES));
} catch (PDOException $ignored) {
/** @link https://bugs.php.net/bug.php?id=68371 */
$this->markTestIncomplete('See https://bugs.php.net/bug.php?id=68371');
......
......@@ -9,7 +9,7 @@ class DriverTest extends AbstractSQLiteDriverTest
{
public function testReturnsName()
{
$this->assertSame('pdo_sqlite', $this->driver->getName());
self::assertSame('pdo_sqlite', $this->driver->getName());
}
protected function createDriver()
......
......@@ -9,7 +9,7 @@ class DriverTest extends AbstractSQLServerDriverTest
{
public function testReturnsName()
{
$this->assertSame('pdo_sqlsrv', $this->driver->getName());
self::assertSame('pdo_sqlsrv', $this->driver->getName());
}
protected function createDriver()
......
......@@ -9,7 +9,7 @@ class DriverTest extends AbstractSQLAnywhereDriverTest
{
public function testReturnsName()
{
$this->assertSame('sqlanywhere', $this->driver->getName());
self::assertSame('sqlanywhere', $this->driver->getName());
}
protected function createDriver()
......
......@@ -28,6 +28,6 @@ class SQLAnywhereConnectionTest extends DbalTestCase
public function testRequiresQueryForServerVersion()
{
$this->assertTrue($this->connectionMock->requiresQueryForServerVersion());
self::assertTrue($this->connectionMock->requiresQueryForServerVersion());
}
}
......@@ -9,7 +9,7 @@ class DriverTest extends AbstractSQLServerDriverTest
{
public function testReturnsName()
{
$this->assertSame('sqlsrv', $this->driver->getName());
self::assertSame('sqlsrv', $this->driver->getName());
}
protected function createDriver()
......
......@@ -28,6 +28,6 @@ class SQLSrvConnectionTest extends DbalTestCase
public function testDoesNotRequireQueryForServerVersion()
{
$this->assertFalse($this->connectionMock->requiresQueryForServerVersion());
self::assertFalse($this->connectionMock->requiresQueryForServerVersion());
}
}
......@@ -24,7 +24,7 @@ class DriverManagerTest extends \Doctrine\Tests\DbalTestCase
'pdo' => new \PDO('sqlite::memory:')
);
$conn = \Doctrine\DBAL\DriverManager::getConnection($options);
$this->assertEquals('sqlite', $conn->getDatabasePlatform()->getName());
self::assertEquals('sqlite', $conn->getDatabasePlatform()->getName());
}
/**
......@@ -39,7 +39,7 @@ class DriverManagerTest extends \Doctrine\Tests\DbalTestCase
);
$conn = \Doctrine\DBAL\DriverManager::getConnection($options);
$this->assertEquals(\PDO::ERRMODE_EXCEPTION, $pdo->getAttribute(\PDO::ATTR_ERRMODE));
self::assertEquals(\PDO::ERRMODE_EXCEPTION, $pdo->getAttribute(\PDO::ATTR_ERRMODE));
}
/**
......@@ -67,7 +67,7 @@ class DriverManagerTest extends \Doctrine\Tests\DbalTestCase
);
$conn = \Doctrine\DBAL\DriverManager::getConnection($options);
$this->assertSame($mockPlatform, $conn->getDatabasePlatform());
self::assertSame($mockPlatform, $conn->getDatabasePlatform());
}
public function testCustomWrapper()
......@@ -80,7 +80,7 @@ class DriverManagerTest extends \Doctrine\Tests\DbalTestCase
);
$conn = \Doctrine\DBAL\DriverManager::getConnection($options);
$this->assertInstanceOf($wrapperClass, $conn);
self::assertInstanceOf($wrapperClass, $conn);
}
public function testInvalidWrapperClass()
......@@ -113,7 +113,7 @@ class DriverManagerTest extends \Doctrine\Tests\DbalTestCase
);
$conn = \Doctrine\DBAL\DriverManager::getConnection($options);
$this->assertInstanceOf('Doctrine\DBAL\Driver\PDOMySql\Driver', $conn->getDriver());
self::assertInstanceOf('Doctrine\DBAL\Driver\PDOMySql\Driver', $conn->getDriver());
}
/**
......@@ -134,9 +134,9 @@ class DriverManagerTest extends \Doctrine\Tests\DbalTestCase
$params = $conn->getParams();
foreach ($expected as $key => $value) {
if (in_array($key, array('pdo', 'driver', 'driverClass'), true)) {
$this->assertInstanceOf($value, $conn->getDriver());
self::assertInstanceOf($value, $conn->getDriver());
} else {
$this->assertEquals($value, $params[$key]);
self::assertEquals($value, $params[$key]);
}
}
}
......
......@@ -26,6 +26,6 @@ class MysqlSessionInitTest extends DbalTestCase
public function testGetSubscribedEvents()
{
$listener = new MysqlSessionInit();
$this->assertEquals(array(Events::postConnect), $listener->getSubscribedEvents());
self::assertEquals(array(Events::postConnect), $listener->getSubscribedEvents());
}
}
......@@ -54,6 +54,6 @@ class OracleSessionInitTest extends DbalTestCase
public function testGetSubscribedEvents()
{
$listener = new OracleSessionInit();
$this->assertEquals(array(Events::postConnect), $listener->getSubscribedEvents());
self::assertEquals(array(Events::postConnect), $listener->getSubscribedEvents());
}
}
......@@ -28,6 +28,6 @@ class SQLSessionInitTest extends DbalTestCase
public function testGetSubscribedEvents()
{
$listener = new SQLSessionInit("SET SEARCH_PATH TO foo, public, TIMEZONE TO 'Europe/Berlin'");
$this->assertEquals(array(Events::postConnect), $listener->getSubscribedEvents());
self::assertEquals(array(Events::postConnect), $listener->getSubscribedEvents());
}
}
......@@ -34,7 +34,7 @@ class InvalidArgumentExceptionTest extends \PHPUnit\Framework\TestCase
{
$exception = InvalidArgumentException::fromEmptyCriteria();
$this->assertInstanceOf('Doctrine\DBAL\Exception\InvalidArgumentException', $exception);
$this->assertSame('Empty criteria was used, expected non-empty criteria', $exception->getMessage());
self::assertInstanceOf('Doctrine\DBAL\Exception\InvalidArgumentException', $exception);
self::assertSame('Empty criteria was used, expected non-empty criteria', $exception->getMessage());
}
}
......@@ -41,12 +41,12 @@ class BlobTest extends \Doctrine\Tests\DbalFunctionalTestCase
array('id' => 1, 'clobfield' => 'test', 'blobfield' => 'test', 'binaryfield' => 'test'),
array(\PDO::PARAM_INT, \PDO::PARAM_STR, \PDO::PARAM_LOB, \PDO::PARAM_LOB)
);
$this->assertEquals(1, $ret);
self::assertEquals(1, $ret);
}
public function testSelect()
{
$ret = $this->_conn->insert('blob_table',
$this->_conn->insert('blob_table',
array('id' => 1, 'clobfield' => 'test', 'blobfield' => 'test', 'binaryfield' => 'test'),
array(\PDO::PARAM_INT, \PDO::PARAM_STR, \PDO::PARAM_LOB, \PDO::PARAM_LOB)
);
......@@ -56,7 +56,7 @@ class BlobTest extends \Doctrine\Tests\DbalFunctionalTestCase
public function testUpdate()
{
$ret = $this->_conn->insert('blob_table',
$this->_conn->insert('blob_table',
array('id' => 1, 'clobfield' => 'test', 'blobfield' => 'test', 'binaryfield' => 'test'),
array(\PDO::PARAM_INT, \PDO::PARAM_STR, \PDO::PARAM_LOB, \PDO::PARAM_LOB)
);
......@@ -75,25 +75,25 @@ class BlobTest extends \Doctrine\Tests\DbalFunctionalTestCase
{
$rows = $this->_conn->fetchAll('SELECT * FROM blob_table');
$this->assertEquals(1, count($rows));
self::assertEquals(1, count($rows));
$row = array_change_key_case($rows[0], CASE_LOWER);
$blobValue = Type::getType('binary')->convertToPHPValue($row['binaryfield'], $this->_conn->getDatabasePlatform());
$this->assertInternalType('resource', $blobValue);
$this->assertEquals($text, stream_get_contents($blobValue));
self::assertInternalType('resource', $blobValue);
self::assertEquals($text, stream_get_contents($blobValue));
}
private function assertBlobContains($text)
{
$rows = $this->_conn->fetchAll('SELECT * FROM blob_table');
$this->assertEquals(1, count($rows));
self::assertEquals(1, count($rows));
$row = array_change_key_case($rows[0], CASE_LOWER);
$blobValue = Type::getType('blob')->convertToPHPValue($row['blobfield'], $this->_conn->getDatabasePlatform());
$this->assertInternalType('resource', $blobValue);
$this->assertEquals($text, stream_get_contents($blobValue));
self::assertInternalType('resource', $blobValue);
self::assertEquals($text, stream_get_contents($blobValue));
}
}
\ No newline at end of file
}
......@@ -23,7 +23,7 @@ class ConnectionTest extends \Doctrine\Tests\DbalFunctionalTestCase
public function testGetWrappedConnection()
{
$this->assertInstanceOf('Doctrine\DBAL\Driver\Connection', $this->_conn->getWrappedConnection());
self::assertInstanceOf('Doctrine\DBAL\Driver\Connection', $this->_conn->getWrappedConnection());
}
public function testCommitWithRollbackOnlyThrowsException()
......@@ -39,26 +39,26 @@ class ConnectionTest extends \Doctrine\Tests\DbalFunctionalTestCase
{
try {
$this->_conn->beginTransaction();
$this->assertEquals(1, $this->_conn->getTransactionNestingLevel());
self::assertEquals(1, $this->_conn->getTransactionNestingLevel());
try {
$this->_conn->beginTransaction();
$this->assertEquals(2, $this->_conn->getTransactionNestingLevel());
self::assertEquals(2, $this->_conn->getTransactionNestingLevel());
throw new \Exception;
$this->_conn->commit(); // never reached
} catch (\Exception $e) {
$this->_conn->rollBack();
$this->assertEquals(1, $this->_conn->getTransactionNestingLevel());
self::assertEquals(1, $this->_conn->getTransactionNestingLevel());
//no rethrow
}
$this->assertTrue($this->_conn->isRollbackOnly());
self::assertTrue($this->_conn->isRollbackOnly());
$this->_conn->commit(); // should throw exception
$this->fail('Transaction commit after failed nested transaction should fail.');
} catch (ConnectionException $e) {
$this->assertEquals(1, $this->_conn->getTransactionNestingLevel());
self::assertEquals(1, $this->_conn->getTransactionNestingLevel());
$this->_conn->rollBack();
$this->assertEquals(0, $this->_conn->getTransactionNestingLevel());
self::assertEquals(0, $this->_conn->getTransactionNestingLevel());
}
}
......@@ -71,28 +71,28 @@ class ConnectionTest extends \Doctrine\Tests\DbalFunctionalTestCase
$this->_conn->setNestTransactionsWithSavepoints(true);
try {
$this->_conn->beginTransaction();
$this->assertEquals(1, $this->_conn->getTransactionNestingLevel());
self::assertEquals(1, $this->_conn->getTransactionNestingLevel());
try {
$this->_conn->beginTransaction();
$this->assertEquals(2, $this->_conn->getTransactionNestingLevel());
self::assertEquals(2, $this->_conn->getTransactionNestingLevel());
$this->_conn->beginTransaction();
$this->assertEquals(3, $this->_conn->getTransactionNestingLevel());
self::assertEquals(3, $this->_conn->getTransactionNestingLevel());
$this->_conn->commit();
$this->assertEquals(2, $this->_conn->getTransactionNestingLevel());
self::assertEquals(2, $this->_conn->getTransactionNestingLevel());
throw new \Exception;
$this->_conn->commit(); // never reached
} catch (\Exception $e) {
$this->_conn->rollBack();
$this->assertEquals(1, $this->_conn->getTransactionNestingLevel());
self::assertEquals(1, $this->_conn->getTransactionNestingLevel());
//no rethrow
}
$this->assertFalse($this->_conn->isRollbackOnly());
self::assertFalse($this->_conn->isRollbackOnly());
try {
$this->_conn->setNestTransactionsWithSavepoints(false);
$this->fail('Should not be able to disable savepoints in usage for nested transactions inside an open transaction.');
} catch (ConnectionException $e) {
$this->assertTrue($this->_conn->getNestTransactionsWithSavepoints());
self::assertTrue($this->_conn->getNestTransactionsWithSavepoints());
}
$this->_conn->commit(); // should not throw exception
} catch (ConnectionException $e) {
......@@ -164,15 +164,15 @@ class ConnectionTest extends \Doctrine\Tests\DbalFunctionalTestCase
{
try {
$this->_conn->beginTransaction();
$this->assertEquals(1, $this->_conn->getTransactionNestingLevel());
self::assertEquals(1, $this->_conn->getTransactionNestingLevel());
throw new \Exception;
$this->_conn->commit(); // never reached
} catch (\Exception $e) {
$this->assertEquals(1, $this->_conn->getTransactionNestingLevel());
self::assertEquals(1, $this->_conn->getTransactionNestingLevel());
$this->_conn->rollBack();
$this->assertEquals(0, $this->_conn->getTransactionNestingLevel());
self::assertEquals(0, $this->_conn->getTransactionNestingLevel());
}
}
......@@ -180,14 +180,14 @@ class ConnectionTest extends \Doctrine\Tests\DbalFunctionalTestCase
{
try {
$this->_conn->beginTransaction();
$this->assertEquals(1, $this->_conn->getTransactionNestingLevel());
self::assertEquals(1, $this->_conn->getTransactionNestingLevel());
$this->_conn->commit();
} catch (\Exception $e) {
$this->_conn->rollBack();
$this->assertEquals(0, $this->_conn->getTransactionNestingLevel());
self::assertEquals(0, $this->_conn->getTransactionNestingLevel());
}
$this->assertEquals(0, $this->_conn->getTransactionNestingLevel());
self::assertEquals(0, $this->_conn->getTransactionNestingLevel());
}
public function testTransactionalWithException()
......@@ -200,7 +200,7 @@ class ConnectionTest extends \Doctrine\Tests\DbalFunctionalTestCase
});
$this->fail('Expected exception');
} catch (\RuntimeException $expected) {
$this->assertEquals(0, $this->_conn->getTransactionNestingLevel());
self::assertEquals(0, $this->_conn->getTransactionNestingLevel());
}
}
......@@ -218,7 +218,7 @@ class ConnectionTest extends \Doctrine\Tests\DbalFunctionalTestCase
});
$this->fail('Expected exception');
} catch (\Error $expected) {
$this->assertEquals(0, $this->_conn->getTransactionNestingLevel());
self::assertEquals(0, $this->_conn->getTransactionNestingLevel());
}
}
......@@ -238,7 +238,7 @@ class ConnectionTest extends \Doctrine\Tests\DbalFunctionalTestCase
return 42;
});
$this->assertEquals(42, $res);
self::assertEquals(42, $res);
}
/**
......@@ -246,13 +246,13 @@ class ConnectionTest extends \Doctrine\Tests\DbalFunctionalTestCase
*/
public function testQuote()
{
$this->assertEquals($this->_conn->quote("foo", Type::STRING), $this->_conn->quote("foo", \PDO::PARAM_STR));
self::assertEquals($this->_conn->quote("foo", Type::STRING), $this->_conn->quote("foo", \PDO::PARAM_STR));
}
public function testPingDoesTriggersConnect()
{
$this->assertTrue($this->_conn->ping());
$this->assertTrue($this->_conn->isConnected());
self::assertTrue($this->_conn->ping());
self::assertTrue($this->_conn->isConnected());
}
/**
......@@ -273,7 +273,7 @@ class ConnectionTest extends \Doctrine\Tests\DbalFunctionalTestCase
$this->_conn->getEventManager()
);
$this->assertTrue($connection->connect());
self::assertTrue($connection->connect());
$connection->close();
}
......@@ -296,9 +296,9 @@ class ConnectionTest extends \Doctrine\Tests\DbalFunctionalTestCase
$this->_conn->getEventManager()
);
$this->assertInstanceOf(AbstractPlatform::class, $connection->getDatabasePlatform());
$this->assertFalse($connection->isConnected());
$this->assertSame($params, $connection->getParams());
self::assertInstanceOf(AbstractPlatform::class, $connection->getDatabasePlatform());
self::assertFalse($connection->isConnected());
self::assertSame($params, $connection->getParams());
$connection->close();
}
......
......@@ -34,7 +34,7 @@ abstract class AbstractDriverTest extends DbalFunctionalTestCase
$connection = $this->driver->connect($params, $user, $password);
$this->assertInstanceOf('Doctrine\DBAL\Driver\Connection', $connection);
self::assertInstanceOf('Doctrine\DBAL\Driver\Connection', $connection);
}
/**
......@@ -52,7 +52,7 @@ abstract class AbstractDriverTest extends DbalFunctionalTestCase
$this->_conn->getEventManager()
);
$this->assertSame(
self::assertSame(
$this->getDatabaseNameForConnectionWithoutDatabaseNameParameter(),
$this->driver->getDatabase($connection)
);
......
......@@ -28,7 +28,7 @@ class ConnectionTest extends \Doctrine\Tests\DbalFunctionalTestCase
);
$connection = $this->getConnection($driverOptions);
$this->assertInstanceOf("\Doctrine\DBAL\Driver\Mysqli\MysqliConnection", $connection);
self::assertInstanceOf("\Doctrine\DBAL\Driver\Mysqli\MysqliConnection", $connection);
}
/**
......@@ -42,7 +42,7 @@ class ConnectionTest extends \Doctrine\Tests\DbalFunctionalTestCase
public function testPing()
{
$conn = $this->getConnection(array());
$this->assertTrue($conn->ping());
self::assertTrue($conn->ping());
}
private function getConnection(array $driverOptions)
......
......@@ -47,6 +47,6 @@ class OCI8ConnectionTest extends DbalFunctionalTestCase
$schema = $this->_conn->getDatabase();
$sequence = $platform->getIdentitySequenceName($schema . '.DBAL2595', 'id');
$this->assertSame(1, $this->driverConnection->lastInsertId($sequence));
self::assertSame(1, $this->driverConnection->lastInsertId($sequence));
}
}
......@@ -25,7 +25,7 @@ class StatementTest extends DbalFunctionalTestCase
*/
public function testQueryConversion($query, array $params, array $expected)
{
$this->assertEquals(
self::assertEquals(
$expected,
$this->_conn->executeQuery($query, $params)->fetch()
);
......
......@@ -38,7 +38,7 @@ class PDOConnectionTest extends DbalFunctionalTestCase
public function testDoesNotRequireQueryForServerVersion()
{
$this->assertFalse($this->driverConnection->requiresQueryForServerVersion());
self::assertFalse($this->driverConnection->requiresQueryForServerVersion());
}
/**
......
......@@ -38,7 +38,7 @@ class DriverTest extends AbstractDriverTest
$this->_conn->getEventManager()
);
$this->assertSame(
self::assertSame(
$expectedDatabaseName,
$this->driver->getDatabase($connection)
);
......@@ -82,7 +82,7 @@ class DriverTest extends AbstractDriverTest
$queryColumnName = array_key_exists('current_query', $record) ? 'current_query' : 'query';
if ($record[$queryColumnName] === $sql) {
$this->assertSame('doctrine', $record['application_name']);
self::assertSame('doctrine', $record['application_name']);
return;
}
......
......@@ -40,7 +40,7 @@ class PDOPgsqlConnectionTest extends DbalFunctionalTestCase
$this->_conn->getEventManager()
);
$this->assertEquals($charset, $connection->query("SHOW client_encoding")->fetch(\PDO::FETCH_COLUMN));
self::assertEquals($charset, $connection->query("SHOW client_encoding")->fetch(\PDO::FETCH_COLUMN));
}
/**
......
......@@ -29,7 +29,7 @@ class ConnectionTest extends \Doctrine\Tests\DbalFunctionalTestCase
$conn->connect();
$this->assertTrue($conn->isConnected(), 'No SQLAnywhere-nonpersistent connection established');
self::assertTrue($conn->isConnected(), 'No SQLAnywhere-nonpersistent connection established');
}
public function testPersistentConnection()
......@@ -41,6 +41,6 @@ class ConnectionTest extends \Doctrine\Tests\DbalFunctionalTestCase
$conn->connect();
$this->assertTrue($conn->isConnected(), 'No SQLAnywhere-persistent connection established');
self::assertTrue($conn->isConnected(), 'No SQLAnywhere-persistent connection established');
}
}
......@@ -35,7 +35,7 @@ class DriverTest extends AbstractDriverTest
// SQL Anywhere has no "default" database. The name of the default database
// is defined on server startup and therefore can be arbitrary.
$this->assertInternalType('string', $this->driver->getDatabase($connection));
self::assertInternalType('string', $this->driver->getDatabase($connection));
}
/**
......
......@@ -29,10 +29,10 @@ class StatementTest extends \Doctrine\Tests\DbalFunctionalTestCase
$conn->connect();
$this->assertTrue($conn->isConnected(),'No SQLAnywhere-Connection established');
self::assertTrue($conn->isConnected(),'No SQLAnywhere-Connection established');
$prepStmt = $conn->prepare('SELECT 1');
$this->assertTrue($prepStmt->execute(),' Statement non-persistent failed');
self::assertTrue($prepStmt->execute(),' Statement non-persistent failed');
}
public function testPersistentStatement()
......@@ -44,10 +44,10 @@ class StatementTest extends \Doctrine\Tests\DbalFunctionalTestCase
$conn->connect();
$this->assertTrue($conn->isConnected(),'No SQLAnywhere-Connection established');
self::assertTrue($conn->isConnected(),'No SQLAnywhere-Connection established');
$prepStmt = $conn->prepare('SELECT 1');
$this->assertTrue($prepStmt->execute(),' Statement persistent failed');
self::assertTrue($prepStmt->execute(),' Statement persistent failed');
}
}
......@@ -53,11 +53,11 @@ class MasterSlaveConnectionTest extends DbalFunctionalTestCase
{
$conn = $this->createMasterSlaveConnection();
$this->assertFalse($conn->isConnectedToMaster());
self::assertFalse($conn->isConnectedToMaster());
$conn->connect('slave');
$this->assertFalse($conn->isConnectedToMaster());
self::assertFalse($conn->isConnectedToMaster());
$conn->connect('master');
$this->assertTrue($conn->isConnectedToMaster());
self::assertTrue($conn->isConnectedToMaster());
}
public function testNoMasterOnExecuteQuery()
......@@ -68,8 +68,8 @@ class MasterSlaveConnectionTest extends DbalFunctionalTestCase
$data = $conn->fetchAll($sql);
$data[0] = array_change_key_case($data[0], CASE_LOWER);
$this->assertEquals(1, $data[0]['num']);
$this->assertFalse($conn->isConnectedToMaster());
self::assertEquals(1, $data[0]['num']);
self::assertFalse($conn->isConnectedToMaster());
}
public function testMasterOnWriteOperation()
......@@ -77,14 +77,14 @@ class MasterSlaveConnectionTest extends DbalFunctionalTestCase
$conn = $this->createMasterSlaveConnection();
$conn->insert('master_slave_table', array('test_int' => 30));
$this->assertTrue($conn->isConnectedToMaster());
self::assertTrue($conn->isConnectedToMaster());
$sql = "SELECT count(*) as num FROM master_slave_table";
$data = $conn->fetchAll($sql);
$data[0] = array_change_key_case($data[0], CASE_LOWER);
$this->assertEquals(2, $data[0]['num']);
$this->assertTrue($conn->isConnectedToMaster());
self::assertEquals(2, $data[0]['num']);
self::assertTrue($conn->isConnectedToMaster());
}
/**
......@@ -99,13 +99,13 @@ class MasterSlaveConnectionTest extends DbalFunctionalTestCase
$conn->insert('master_slave_table', array('test_int' => 30));
$conn->commit();
$this->assertTrue($conn->isConnectedToMaster());
self::assertTrue($conn->isConnectedToMaster());
$conn->connect();
$this->assertTrue($conn->isConnectedToMaster());
self::assertTrue($conn->isConnectedToMaster());
$conn->connect('slave');
$this->assertFalse($conn->isConnectedToMaster());
self::assertFalse($conn->isConnectedToMaster());
}
/**
......@@ -118,25 +118,25 @@ class MasterSlaveConnectionTest extends DbalFunctionalTestCase
$conn->insert('master_slave_table', array('test_int' => 30));
$this->assertTrue($conn->isConnectedToMaster());
self::assertTrue($conn->isConnectedToMaster());
$conn->connect();
$this->assertTrue($conn->isConnectedToMaster());
self::assertTrue($conn->isConnectedToMaster());
$conn->connect('slave');
$this->assertFalse($conn->isConnectedToMaster());
self::assertFalse($conn->isConnectedToMaster());
}
public function testMasterSlaveConnectionCloseAndReconnect()
{
$conn = $this->createMasterSlaveConnection();
$conn->connect('master');
$this->assertTrue($conn->isConnectedToMaster());
self::assertTrue($conn->isConnectedToMaster());
$conn->close();
$this->assertFalse($conn->isConnectedToMaster());
self::assertFalse($conn->isConnectedToMaster());
$conn->connect('master');
$this->assertTrue($conn->isConnectedToMaster());
self::assertTrue($conn->isConnectedToMaster());
}
}
......@@ -168,9 +168,9 @@ SQL;
* Do not assert the order of results when results are non-deterministic
*/
if ($deterministic) {
$this->assertEquals($expectedResults, $data);
self::assertEquals($expectedResults, $data);
} else {
$this->assertCount(count($expectedResults), $data);
self::assertCount(count($expectedResults), $data);
}
}
}
......@@ -157,7 +157,7 @@ class NamedParametersTest extends \Doctrine\Tests\DbalFunctionalTestCase
$result[$k] = array_change_key_case($v, CASE_LOWER);
}
$this->assertEquals($result, $expected);
self::assertEquals($result, $expected);
}
}
......@@ -108,7 +108,7 @@ class PortabilityTest extends \Doctrine\Tests\DbalFunctionalTestCase
public function assertFetchResultRows($rows)
{
$this->assertEquals(2, count($rows));
self::assertEquals(2, count($rows));
foreach ($rows as $row) {
$this->assertFetchResultRow($row);
}
......@@ -116,11 +116,11 @@ class PortabilityTest extends \Doctrine\Tests\DbalFunctionalTestCase
public function assertFetchResultRow($row)
{
$this->assertTrue(in_array($row['test_int'], array(1, 2)), "Primary key test_int should either be 1 or 2.");
$this->assertArrayHasKey('test_string', $row, "Case should be lowered.");
$this->assertEquals(3, strlen($row['test_string']), "test_string should be rtrimed to length of three for CHAR(32) column.");
$this->assertNull($row['test_null']);
$this->assertArrayNotHasKey(0, $row, "PDO::FETCH_ASSOC should not return numerical keys.");
self::assertTrue(in_array($row['test_int'], array(1, 2)), "Primary key test_int should either be 1 or 2.");
self::assertArrayHasKey('test_string', $row, "Case should be lowered.");
self::assertEquals(3, strlen($row['test_string']), "test_string should be rtrimed to length of three for CHAR(32) column.");
self::assertNull($row['test_null']);
self::assertArrayNotHasKey(0, $row, "PDO::FETCH_ASSOC should not return numerical keys.");
}
public function testPortabilitySqlServer()
......@@ -142,7 +142,7 @@ class PortabilityTest extends \Doctrine\Tests\DbalFunctionalTestCase
$connection->connect($params);
$this->assertEquals($portability, $connection->getPortability());
self::assertEquals($portability, $connection->getPortability());
}
/**
......@@ -154,7 +154,7 @@ class PortabilityTest extends \Doctrine\Tests\DbalFunctionalTestCase
$stmt = $conn->query('SELECT ' . $field . ' FROM portability_table');
$column = $stmt->fetchAll(PDO::FETCH_COLUMN);
$this->assertEquals($expected, $column);
self::assertEquals($expected, $column);
}
public static function fetchAllColumnProvider()
......@@ -177,6 +177,6 @@ class PortabilityTest extends \Doctrine\Tests\DbalFunctionalTestCase
$stmt = $conn->query('SELECT Test_Null FROM portability_table');
$column = $stmt->fetchAll(PDO::FETCH_COLUMN);
$this->assertSame(array(null, null), $column);
self::assertSame(array(null, null), $column);
}
}
......@@ -44,7 +44,7 @@ class ResultCacheTest extends \Doctrine\Tests\DbalFunctionalTestCase
public function testCacheFetchAssoc()
{
$this->assertCacheNonCacheSelectSameFetchModeAreEqual($this->expectedResult, \PDO::FETCH_ASSOC);
self::assertCacheNonCacheSelectSameFetchModeAreEqual($this->expectedResult, \PDO::FETCH_ASSOC);
}
public function testFetchNum()
......@@ -53,7 +53,7 @@ class ResultCacheTest extends \Doctrine\Tests\DbalFunctionalTestCase
foreach ($this->expectedResult as $v) {
$expectedResult[] = array_values($v);
}
$this->assertCacheNonCacheSelectSameFetchModeAreEqual($expectedResult, \PDO::FETCH_NUM);
self::assertCacheNonCacheSelectSameFetchModeAreEqual($expectedResult, \PDO::FETCH_NUM);
}
public function testFetchBoth()
......@@ -62,7 +62,7 @@ class ResultCacheTest extends \Doctrine\Tests\DbalFunctionalTestCase
foreach ($this->expectedResult as $v) {
$expectedResult[] = array_merge($v, array_values($v));
}
$this->assertCacheNonCacheSelectSameFetchModeAreEqual($expectedResult, \PDO::FETCH_BOTH);
self::assertCacheNonCacheSelectSameFetchModeAreEqual($expectedResult, \PDO::FETCH_BOTH);
}
public function testFetchColumn()
......@@ -71,7 +71,7 @@ class ResultCacheTest extends \Doctrine\Tests\DbalFunctionalTestCase
foreach ($this->expectedResult as $v) {
$expectedResult[] = array_shift($v);
}
$this->assertCacheNonCacheSelectSameFetchModeAreEqual($expectedResult, \PDO::FETCH_COLUMN);
self::assertCacheNonCacheSelectSameFetchModeAreEqual($expectedResult, \PDO::FETCH_COLUMN);
}
public function testMixingFetch()
......@@ -84,20 +84,20 @@ class ResultCacheTest extends \Doctrine\Tests\DbalFunctionalTestCase
$data = $this->hydrateStmt($stmt, \PDO::FETCH_ASSOC);
$this->assertEquals($this->expectedResult, $data);
self::assertEquals($this->expectedResult, $data);
$stmt = $this->_conn->executeQuery("SELECT * FROM caching ORDER BY test_int ASC", array(), array(), new QueryCacheProfile(10, "testcachekey"));
$data = $this->hydrateStmt($stmt, \PDO::FETCH_NUM);
$this->assertEquals($numExpectedResult, $data);
self::assertEquals($numExpectedResult, $data);
}
public function testIteratorFetch()
{
$this->assertStandardAndIteratorFetchAreEqual(\PDO::FETCH_BOTH);
$this->assertStandardAndIteratorFetchAreEqual(\PDO::FETCH_ASSOC);
$this->assertStandardAndIteratorFetchAreEqual(\PDO::FETCH_NUM);
self::assertStandardAndIteratorFetchAreEqual(\PDO::FETCH_BOTH);
self::assertStandardAndIteratorFetchAreEqual(\PDO::FETCH_ASSOC);
self::assertStandardAndIteratorFetchAreEqual(\PDO::FETCH_NUM);
}
public function assertStandardAndIteratorFetchAreEqual($fetchMode)
......@@ -108,7 +108,7 @@ class ResultCacheTest extends \Doctrine\Tests\DbalFunctionalTestCase
$stmt = $this->_conn->executeQuery("SELECT * FROM caching ORDER BY test_int ASC", array(), array(), new QueryCacheProfile(10, "testcachekey"));
$data_iterator = $this->hydrateStmtIterator($stmt, $fetchMode);
$this->assertEquals($data, $data_iterator);
self::assertEquals($data, $data_iterator);
}
public function testDontCloseNoCache()
......@@ -127,7 +127,7 @@ class ResultCacheTest extends \Doctrine\Tests\DbalFunctionalTestCase
$data[] = $row;
}
$this->assertEquals(2, count($this->sqlLogger->queries));
self::assertEquals(2, count($this->sqlLogger->queries));
}
public function testDontFinishNoCache()
......@@ -141,23 +141,23 @@ class ResultCacheTest extends \Doctrine\Tests\DbalFunctionalTestCase
$data = $this->hydrateStmt($stmt, \PDO::FETCH_NUM);
$this->assertEquals(2, count($this->sqlLogger->queries));
self::assertEquals(2, count($this->sqlLogger->queries));
}
public function assertCacheNonCacheSelectSameFetchModeAreEqual($expectedResult, $fetchMode)
{
$stmt = $this->_conn->executeQuery("SELECT * FROM caching ORDER BY test_int ASC", array(), array(), new QueryCacheProfile(10, "testcachekey"));
$this->assertEquals(2, $stmt->columnCount());
self::assertEquals(2, $stmt->columnCount());
$data = $this->hydrateStmt($stmt, $fetchMode);
$this->assertEquals($expectedResult, $data);
self::assertEquals($expectedResult, $data);
$stmt = $this->_conn->executeQuery("SELECT * FROM caching ORDER BY test_int ASC", array(), array(), new QueryCacheProfile(10, "testcachekey"));
$this->assertEquals(2, $stmt->columnCount());
self::assertEquals(2, $stmt->columnCount());
$data = $this->hydrateStmt($stmt, $fetchMode);
$this->assertEquals($expectedResult, $data);
$this->assertEquals(1, count($this->sqlLogger->queries), "just one dbal hit");
self::assertEquals($expectedResult, $data);
self::assertEquals(1, count($this->sqlLogger->queries), "just one dbal hit");
}
public function testEmptyResultCache()
......@@ -168,7 +168,7 @@ class ResultCacheTest extends \Doctrine\Tests\DbalFunctionalTestCase
$stmt = $this->_conn->executeQuery("SELECT * FROM caching WHERE test_int > 500", array(), array(), new QueryCacheProfile(10, "emptycachekey"));
$data = $this->hydrateStmt($stmt);
$this->assertEquals(1, count($this->sqlLogger->queries), "just one dbal hit");
self::assertEquals(1, count($this->sqlLogger->queries), "just one dbal hit");
}
public function testChangeCacheImpl()
......@@ -180,8 +180,8 @@ class ResultCacheTest extends \Doctrine\Tests\DbalFunctionalTestCase
$stmt = $this->_conn->executeQuery("SELECT * FROM caching WHERE test_int > 500", array(), array(), new QueryCacheProfile(10, "emptycachekey", $secondCache));
$data = $this->hydrateStmt($stmt);
$this->assertEquals(2, count($this->sqlLogger->queries), "two hits");
$this->assertEquals(1, count($secondCache->fetch("emptycachekey")));
self::assertEquals(2, count($this->sqlLogger->queries), "two hits");
self::assertEquals(1, count($secondCache->fetch("emptycachekey")));
}
private function hydrateStmt($stmt, $fetchMode = \PDO::FETCH_ASSOC)
......
......@@ -19,10 +19,10 @@ class Db2SchemaManagerTest extends SchemaManagerFunctionalTestCase
$columns = $this->_sm->listTableColumns('boolean_column_test');
$this->assertInstanceOf('Doctrine\DBAL\Types\BooleanType', $columns['bool']->getType());
$this->assertInstanceOf('Doctrine\DBAL\Types\BooleanType', $columns['bool_commented']->getType());
self::assertInstanceOf('Doctrine\DBAL\Types\BooleanType', $columns['bool']->getType());
self::assertInstanceOf('Doctrine\DBAL\Types\BooleanType', $columns['bool_commented']->getType());
$this->assertNull($columns['bool']->getComment());
$this->assertSame("That's a comment", $columns['bool_commented']->getComment());
self::assertNull($columns['bool']->getComment());
self::assertSame("That's a comment", $columns['bool_commented']->getComment());
}
}
......@@ -20,11 +20,11 @@ class DrizzleSchemaManagerTest extends SchemaManagerFunctionalTestCase
$table = $this->_sm->listTableDetails($tableName);
$this->assertInstanceOf('Doctrine\DBAL\Types\BinaryType', $table->getColumn('column_varbinary')->getType());
$this->assertFalse($table->getColumn('column_varbinary')->getFixed());
self::assertInstanceOf('Doctrine\DBAL\Types\BinaryType', $table->getColumn('column_varbinary')->getType());
self::assertFalse($table->getColumn('column_varbinary')->getFixed());
$this->assertInstanceOf('Doctrine\DBAL\Types\BinaryType', $table->getColumn('column_binary')->getType());
$this->assertFalse($table->getColumn('column_binary')->getFixed());
self::assertInstanceOf('Doctrine\DBAL\Types\BinaryType', $table->getColumn('column_binary')->getType());
self::assertFalse($table->getColumn('column_binary')->getFixed());
}
public function testColumnCollation()
......@@ -39,9 +39,9 @@ class DrizzleSchemaManagerTest extends SchemaManagerFunctionalTestCase
$columns = $this->_sm->listTableColumns('test_collation');
$this->assertArrayNotHasKey('collation', $columns['id']->getPlatformOptions());
$this->assertEquals('utf8_unicode_ci', $columns['text']->getPlatformOption('collation'));
$this->assertEquals('utf8_swedish_ci', $columns['foo']->getPlatformOption('collation'));
$this->assertEquals('utf8_general_ci', $columns['bar']->getPlatformOption('collation'));
self::assertArrayNotHasKey('collation', $columns['id']->getPlatformOptions());
self::assertEquals('utf8_unicode_ci', $columns['text']->getPlatformOption('collation'));
self::assertEquals('utf8_swedish_ci', $columns['foo']->getPlatformOption('collation'));
self::assertEquals('utf8_general_ci', $columns['bar']->getPlatformOption('collation'));
}
}
......@@ -61,7 +61,7 @@ class MySqlSchemaManagerTest extends SchemaManagerFunctionalTestCase
$comparator = new Comparator;
$diff = $comparator->diffTable($tableFetched, $table);
$this->assertFalse($diff, "no changes expected.");
self::assertFalse($diff, "no changes expected.");
}
public function testFulltextIndex()
......@@ -77,8 +77,8 @@ class MySqlSchemaManagerTest extends SchemaManagerFunctionalTestCase
$this->_sm->dropAndCreateTable($table);
$indexes = $this->_sm->listTableIndexes('fulltext_index');
$this->assertArrayHasKey('f_index', $indexes);
$this->assertTrue($indexes['f_index']->hasFlag('fulltext'));
self::assertArrayHasKey('f_index', $indexes);
self::assertTrue($indexes['f_index']->hasFlag('fulltext'));
}
public function testSpatialIndex()
......@@ -94,8 +94,8 @@ class MySqlSchemaManagerTest extends SchemaManagerFunctionalTestCase
$this->_sm->dropAndCreateTable($table);
$indexes = $this->_sm->listTableIndexes('spatial_index');
$this->assertArrayHasKey('s_index', $indexes);
$this->assertTrue($indexes['s_index']->hasFlag('spatial'));
self::assertArrayHasKey('s_index', $indexes);
self::assertTrue($indexes['s_index']->hasFlag('spatial'));
}
/**
......@@ -120,8 +120,8 @@ class MySqlSchemaManagerTest extends SchemaManagerFunctionalTestCase
$table = $this->_sm->listTableDetails("alter_table_add_pk");
$this->assertFalse($table->hasIndex('idx_id'));
$this->assertTrue($table->hasPrimaryKey());
self::assertFalse($table->hasIndex('idx_id'));
self::assertTrue($table->hasPrimaryKey());
}
/**
......@@ -146,8 +146,8 @@ class MySqlSchemaManagerTest extends SchemaManagerFunctionalTestCase
$table = $this->_sm->listTableDetails("drop_primary_key");
$this->assertFalse($table->hasPrimaryKey());
$this->assertFalse($table->getColumn('id')->getAutoincrement());
self::assertFalse($table->hasPrimaryKey());
self::assertFalse($table->getColumn('id')->getAutoincrement());
}
/**
......@@ -165,12 +165,12 @@ class MySqlSchemaManagerTest extends SchemaManagerFunctionalTestCase
$onlineTable = $this->_sm->listTableDetails("text_blob_default_value");
$this->assertNull($onlineTable->getColumn('def_text')->getDefault());
$this->assertNull($onlineTable->getColumn('def_text_null')->getDefault());
$this->assertFalse($onlineTable->getColumn('def_text_null')->getNotnull());
$this->assertNull($onlineTable->getColumn('def_blob')->getDefault());
$this->assertNull($onlineTable->getColumn('def_blob_null')->getDefault());
$this->assertFalse($onlineTable->getColumn('def_blob_null')->getNotnull());
self::assertNull($onlineTable->getColumn('def_text')->getDefault());
self::assertNull($onlineTable->getColumn('def_text_null')->getDefault());
self::assertFalse($onlineTable->getColumn('def_text_null')->getNotnull());
self::assertNull($onlineTable->getColumn('def_blob')->getDefault());
self::assertNull($onlineTable->getColumn('def_blob_null')->getDefault());
self::assertFalse($onlineTable->getColumn('def_blob_null')->getNotnull());
$comparator = new Comparator();
......@@ -178,12 +178,12 @@ class MySqlSchemaManagerTest extends SchemaManagerFunctionalTestCase
$onlineTable = $this->_sm->listTableDetails("text_blob_default_value");
$this->assertNull($onlineTable->getColumn('def_text')->getDefault());
$this->assertNull($onlineTable->getColumn('def_text_null')->getDefault());
$this->assertFalse($onlineTable->getColumn('def_text_null')->getNotnull());
$this->assertNull($onlineTable->getColumn('def_blob')->getDefault());
$this->assertNull($onlineTable->getColumn('def_blob_null')->getDefault());
$this->assertFalse($onlineTable->getColumn('def_blob_null')->getNotnull());
self::assertNull($onlineTable->getColumn('def_text')->getDefault());
self::assertNull($onlineTable->getColumn('def_text_null')->getDefault());
self::assertFalse($onlineTable->getColumn('def_text_null')->getNotnull());
self::assertNull($onlineTable->getColumn('def_blob')->getDefault());
self::assertNull($onlineTable->getColumn('def_blob_null')->getDefault());
self::assertFalse($onlineTable->getColumn('def_blob_null')->getNotnull());
}
public function testColumnCollation()
......@@ -199,10 +199,10 @@ class MySqlSchemaManagerTest extends SchemaManagerFunctionalTestCase
$columns = $this->_sm->listTableColumns('test_collation');
$this->assertArrayNotHasKey('collation', $columns['id']->getPlatformOptions());
$this->assertEquals('latin1_swedish_ci', $columns['text']->getPlatformOption('collation'));
$this->assertEquals('latin1_swedish_ci', $columns['foo']->getPlatformOption('collation'));
$this->assertEquals('utf8_general_ci', $columns['bar']->getPlatformOption('collation'));
self::assertArrayNotHasKey('collation', $columns['id']->getPlatformOptions());
self::assertEquals('latin1_swedish_ci', $columns['text']->getPlatformOption('collation'));
self::assertEquals('latin1_swedish_ci', $columns['foo']->getPlatformOption('collation'));
self::assertEquals('utf8_general_ci', $columns['bar']->getPlatformOption('collation'));
}
/**
......@@ -229,36 +229,36 @@ class MySqlSchemaManagerTest extends SchemaManagerFunctionalTestCase
$offlineColumns = $table->getColumns();
$onlineColumns = $this->_sm->listTableColumns($tableName);
$this->assertSame(
self::assertSame(
$platform->getClobTypeDeclarationSQL($offlineColumns['col_tinytext']->toArray()),
$platform->getClobTypeDeclarationSQL($onlineColumns['col_tinytext']->toArray())
);
$this->assertSame(
self::assertSame(
$platform->getClobTypeDeclarationSQL($offlineColumns['col_text']->toArray()),
$platform->getClobTypeDeclarationSQL($onlineColumns['col_text']->toArray())
);
$this->assertSame(
self::assertSame(
$platform->getClobTypeDeclarationSQL($offlineColumns['col_mediumtext']->toArray()),
$platform->getClobTypeDeclarationSQL($onlineColumns['col_mediumtext']->toArray())
);
$this->assertSame(
self::assertSame(
$platform->getClobTypeDeclarationSQL($offlineColumns['col_longtext']->toArray()),
$platform->getClobTypeDeclarationSQL($onlineColumns['col_longtext']->toArray())
);
$this->assertSame(
self::assertSame(
$platform->getBlobTypeDeclarationSQL($offlineColumns['col_tinyblob']->toArray()),
$platform->getBlobTypeDeclarationSQL($onlineColumns['col_tinyblob']->toArray())
);
$this->assertSame(
self::assertSame(
$platform->getBlobTypeDeclarationSQL($offlineColumns['col_blob']->toArray()),
$platform->getBlobTypeDeclarationSQL($onlineColumns['col_blob']->toArray())
);
$this->assertSame(
self::assertSame(
$platform->getBlobTypeDeclarationSQL($offlineColumns['col_mediumblob']->toArray()),
$platform->getBlobTypeDeclarationSQL($onlineColumns['col_mediumblob']->toArray())
);
$this->assertSame(
self::assertSame(
$platform->getBlobTypeDeclarationSQL($offlineColumns['col_longblob']->toArray()),
$platform->getBlobTypeDeclarationSQL($onlineColumns['col_longblob']->toArray())
);
......@@ -278,7 +278,7 @@ class MySqlSchemaManagerTest extends SchemaManagerFunctionalTestCase
$comparator = new Comparator();
$this->assertFalse(
self::assertFalse(
$comparator->diffTable($offlineTable, $onlineTable),
"No differences should be detected with the offline vs online schema."
);
......@@ -299,10 +299,10 @@ class MySqlSchemaManagerTest extends SchemaManagerFunctionalTestCase
$columns = $this->_sm->listTableColumns($tableName);
$this->assertArrayHasKey('col', $columns);
$this->assertArrayHasKey('col_unsigned', $columns);
$this->assertFalse($columns['col']->getUnsigned());
$this->assertTrue($columns['col_unsigned']->getUnsigned());
self::assertArrayHasKey('col', $columns);
self::assertArrayHasKey('col_unsigned', $columns);
self::assertFalse($columns['col']->getUnsigned());
self::assertTrue($columns['col_unsigned']->getUnsigned());
}
/**
......@@ -320,9 +320,9 @@ class MySqlSchemaManagerTest extends SchemaManagerFunctionalTestCase
$columns = $this->_sm->listTableColumns($tableName);
$this->assertArrayHasKey('col', $columns);
$this->assertArrayHasKey('col_unsigned', $columns);
$this->assertFalse($columns['col']->getUnsigned());
$this->assertTrue($columns['col_unsigned']->getUnsigned());
self::assertArrayHasKey('col', $columns);
self::assertArrayHasKey('col_unsigned', $columns);
self::assertFalse($columns['col']->getUnsigned());
self::assertTrue($columns['col_unsigned']->getUnsigned());
}
}
......@@ -21,10 +21,10 @@ class SQLAnywhereSchemaManagerTest extends SchemaManagerFunctionalTestCase
$views = $this->_sm->listViews();
$this->assertEquals(1, count($views), "Database has to have one view.");
$this->assertInstanceOf('Doctrine\DBAL\Schema\View', $views[$name]);
$this->assertEquals($name, $views[$name]->getName());
$this->assertEquals($sql, $views[$name]->getSql());
self::assertEquals(1, count($views), "Database has to have one view.");
self::assertInstanceOf('Doctrine\DBAL\Schema\View', $views[$name]);
self::assertEquals($name, $views[$name]->getName());
self::assertEquals($sql, $views[$name]->getSql());
}
public function testDropAndCreateAdvancedIndex()
......@@ -37,14 +37,14 @@ class SQLAnywhereSchemaManagerTest extends SchemaManagerFunctionalTestCase
);
$tableIndexes = $this->_sm->listTableIndexes('test_create_advanced_index');
$this->assertInternalType('array', $tableIndexes);
$this->assertEquals('test', $tableIndexes['test']->getName());
$this->assertEquals(array('test'), $tableIndexes['test']->getColumns());
$this->assertTrue($tableIndexes['test']->isUnique());
$this->assertFalse($tableIndexes['test']->isPrimary());
$this->assertTrue($tableIndexes['test']->hasFlag('clustered'));
$this->assertTrue($tableIndexes['test']->hasFlag('with_nulls_not_distinct'));
$this->assertTrue($tableIndexes['test']->hasFlag('for_olap_workload'));
self::assertInternalType('array', $tableIndexes);
self::assertEquals('test', $tableIndexes['test']->getName());
self::assertEquals(array('test'), $tableIndexes['test']->getColumns());
self::assertTrue($tableIndexes['test']->isUnique());
self::assertFalse($tableIndexes['test']->isPrimary());
self::assertTrue($tableIndexes['test']->hasFlag('clustered'));
self::assertTrue($tableIndexes['test']->hasFlag('with_nulls_not_distinct'));
self::assertTrue($tableIndexes['test']->hasFlag('for_olap_workload'));
}
public function testListTableColumnsWithFixedStringTypeColumn()
......@@ -58,7 +58,7 @@ class SQLAnywhereSchemaManagerTest extends SchemaManagerFunctionalTestCase
$columns = $this->_sm->listTableColumns('list_table_columns_char');
$this->assertArrayHasKey('test', $columns);
$this->assertTrue($columns['test']->getFixed());
self::assertArrayHasKey('test', $columns);
self::assertTrue($columns['test']->getFixed());
}
}
......@@ -22,9 +22,9 @@ class SqliteSchemaManagerTest extends SchemaManagerFunctionalTestCase
$path = dirname(__FILE__).'/test_create_and_drop_sqlite_database.sqlite';
$this->_sm->createDatabase($path);
$this->assertEquals(true, file_exists($path));
self::assertEquals(true, file_exists($path));
$this->_sm->dropDatabase($path);
$this->assertEquals(false, file_exists($path));
self::assertEquals(false, file_exists($path));
}
/**
......@@ -34,7 +34,7 @@ class SqliteSchemaManagerTest extends SchemaManagerFunctionalTestCase
{
$this->_sm->dropAndCreateDatabase('test_drop_database');
$this->assertFileExists('test_drop_database');
self::assertFileExists('test_drop_database');
$params = $this->_conn->getParams();
$params['dbname'] = 'test_drop_database';
......@@ -44,11 +44,11 @@ class SqliteSchemaManagerTest extends SchemaManagerFunctionalTestCase
$connection = $this->_conn->getDriver()->connect($params, $user, $password);
$this->assertInstanceOf('Doctrine\DBAL\Driver\Connection', $connection);
self::assertInstanceOf('Doctrine\DBAL\Driver\Connection', $connection);
$this->_sm->dropDatabase('test_drop_database');
$this->assertFileNotExists('test_drop_database');
self::assertFileNotExists('test_drop_database');
unset($connection);
}
......@@ -59,8 +59,8 @@ class SqliteSchemaManagerTest extends SchemaManagerFunctionalTestCase
$this->_sm->renameTable('oldname', 'newname');
$tables = $this->_sm->listTableNames();
$this->assertContains('newname', $tables);
$this->assertNotContains('oldname', $tables);
self::assertContains('newname', $tables);
self::assertNotContains('oldname', $tables);
}
public function createListTableColumns()
......@@ -93,7 +93,7 @@ EOS
array('onUpdate' => 'NO ACTION', 'onDelete' => 'NO ACTION', 'deferrable' => true, 'deferred' => true)),
);
$this->assertEquals($expected, $this->_sm->listTableForeignKeys('user'));
self::assertEquals($expected, $this->_sm->listTableForeignKeys('user'));
}
public function testColumnCollation()
......@@ -107,10 +107,10 @@ EOS
$columns = $this->_sm->listTableColumns('test_collation');
$this->assertArrayNotHasKey('collation', $columns['id']->getPlatformOptions());
$this->assertEquals('BINARY', $columns['text']->getPlatformOption('collation'));
$this->assertEquals('BINARY', $columns['foo']->getPlatformOption('collation'));
$this->assertEquals('NOCASE', $columns['bar']->getPlatformOption('collation'));
self::assertArrayNotHasKey('collation', $columns['id']->getPlatformOptions());
self::assertEquals('BINARY', $columns['text']->getPlatformOption('collation'));
self::assertEquals('BINARY', $columns['foo']->getPlatformOption('collation'));
self::assertEquals('NOCASE', $columns['bar']->getPlatformOption('collation'));
}
public function testListTableWithBinary()
......@@ -127,11 +127,11 @@ EOS
$table = $this->_sm->listTableDetails($tableName);
$this->assertInstanceOf('Doctrine\DBAL\Types\BlobType', $table->getColumn('column_varbinary')->getType());
$this->assertFalse($table->getColumn('column_varbinary')->getFixed());
self::assertInstanceOf('Doctrine\DBAL\Types\BlobType', $table->getColumn('column_varbinary')->getType());
self::assertFalse($table->getColumn('column_varbinary')->getFixed());
$this->assertInstanceOf('Doctrine\DBAL\Types\BlobType', $table->getColumn('column_binary')->getType());
$this->assertFalse($table->getColumn('column_binary')->getFixed());
self::assertInstanceOf('Doctrine\DBAL\Types\BlobType', $table->getColumn('column_binary')->getType());
self::assertFalse($table->getColumn('column_binary')->getFixed());
}
public function testNonDefaultPKOrder()
......@@ -155,10 +155,10 @@ EOS
$tableIndexes = $this->_sm->listTableIndexes('non_default_pk_order');
$this->assertEquals(1, count($tableIndexes));
self::assertEquals(1, count($tableIndexes));
$this->assertArrayHasKey('primary', $tableIndexes, 'listTableIndexes() has to return a "primary" array key.');
$this->assertEquals(array('other_id', 'id'), array_map('strtolower', $tableIndexes['primary']->getColumns()));
self::assertArrayHasKey('primary', $tableIndexes, 'listTableIndexes() has to return a "primary" array key.');
self::assertEquals(array('other_id', 'id'), array_map('strtolower', $tableIndexes['primary']->getColumns()));
}
/**
......@@ -177,16 +177,16 @@ SQL;
$columns = $this->_sm->listTableColumns('dbal_1779');
$this->assertCount(2, $columns);
self::assertCount(2, $columns);
$this->assertArrayHasKey('foo', $columns);
$this->assertArrayHasKey('bar', $columns);
self::assertArrayHasKey('foo', $columns);
self::assertArrayHasKey('bar', $columns);
$this->assertSame(Type::getType(Type::STRING), $columns['foo']->getType());
$this->assertSame(Type::getType(Type::TEXT), $columns['bar']->getType());
self::assertSame(Type::getType(Type::STRING), $columns['foo']->getType());
self::assertSame(Type::getType(Type::TEXT), $columns['bar']->getType());
$this->assertSame(64, $columns['foo']->getLength());
$this->assertSame(100, $columns['bar']->getLength());
self::assertSame(64, $columns['foo']->getLength());
self::assertSame(100, $columns['bar']->getLength());
}
/**
......@@ -208,9 +208,9 @@ SQL;
$diff = $comparator->diffTable($offlineTable, $onlineTable);
if ($expectedComparatorDiff) {
$this->assertEmpty($this->_sm->getDatabasePlatform()->getAlterTableSQL($diff));
self::assertEmpty($this->_sm->getDatabasePlatform()->getAlterTableSQL($diff));
} else {
$this->assertFalse($diff);
self::assertFalse($diff);
}
}
......
......@@ -28,15 +28,15 @@ class StatementTest extends \Doctrine\Tests\DbalFunctionalTestCase
$stmt->execute();
$id = $stmt->fetchColumn();
$this->assertEquals(1, $id);
self::assertEquals(1, $id);
$stmt->closeCursor();
$stmt->execute();
$id = $stmt->fetchColumn();
$this->assertEquals(1, $id);
self::assertEquals(1, $id);
$id = $stmt->fetchColumn();
$this->assertEquals(2, $id);
self::assertEquals(2, $id);
}
public function testReuseStatementWithLongerResults()
......@@ -55,7 +55,7 @@ class StatementTest extends \Doctrine\Tests\DbalFunctionalTestCase
$stmt = $this->_conn->prepare('SELECT param, val FROM stmt_longer_results ORDER BY param');
$stmt->execute();
$this->assertArraySubset(array(
self::assertArraySubset(array(
array('param1', 'X'),
), $stmt->fetchAll(\PDO::FETCH_NUM));
......@@ -66,7 +66,7 @@ class StatementTest extends \Doctrine\Tests\DbalFunctionalTestCase
$this->_conn->insert('stmt_longer_results', $row2);
$stmt->execute();
$this->assertArraySubset(array(
self::assertArraySubset(array(
array('param1', 'X'),
array('param2', 'A bit longer value'),
), $stmt->fetchAll(\PDO::FETCH_NUM));
......@@ -119,7 +119,7 @@ EOF
$this->markTestSkipped('Skipping on pdo_sqlsrv due to https://github.com/Microsoft/msphpsql/issues/270');
}
$this->assertSame($contents, stream_get_contents($stream));
self::assertSame($contents, stream_get_contents($stream));
}
public function testIncompletelyFetchedStatementDoesNotBlockConnection()
......@@ -136,7 +136,7 @@ EOF
$stmt2 = $this->_conn->prepare('SELECT id FROM stmt_test WHERE id = ?');
$stmt2->execute(array(1));
$this->assertEquals(1, $stmt2->fetchColumn());
self::assertEquals(1, $stmt2->fetchColumn());
}
public function testReuseStatementAfterClosingCursor()
......@@ -148,13 +148,13 @@ EOF
$stmt->execute(array(1));
$id = $stmt->fetchColumn();
$this->assertEquals(1, $id);
self::assertEquals(1, $id);
$stmt->closeCursor();
$stmt->execute(array(2));
$id = $stmt->fetchColumn();
$this->assertEquals(2, $id);
self::assertEquals(2, $id);
}
public function testReuseStatementWithParameterBoundByReference()
......@@ -167,11 +167,11 @@ EOF
$id = 1;
$stmt->execute();
$this->assertEquals(1, $stmt->fetchColumn());
self::assertEquals(1, $stmt->fetchColumn());
$id = 2;
$stmt->execute();
$this->assertEquals(2, $stmt->fetchColumn());
self::assertEquals(2, $stmt->fetchColumn());
}
public function testReuseStatementWithReboundValue()
......@@ -183,11 +183,11 @@ EOF
$stmt->bindValue(1, 1);
$stmt->execute();
$this->assertEquals(1, $stmt->fetchColumn());
self::assertEquals(1, $stmt->fetchColumn());
$stmt->bindValue(1, 2);
$stmt->execute();
$this->assertEquals(2, $stmt->fetchColumn());
self::assertEquals(2, $stmt->fetchColumn());
}
public function testReuseStatementWithReboundParam()
......@@ -200,12 +200,12 @@ EOF
$x = 1;
$stmt->bindParam(1, $x);
$stmt->execute();
$this->assertEquals(1, $stmt->fetchColumn());
self::assertEquals(1, $stmt->fetchColumn());
$y = 2;
$stmt->bindParam(1, $y);
$stmt->execute();
$this->assertEquals(2, $stmt->fetchColumn());
self::assertEquals(2, $stmt->fetchColumn());
}
/**
......@@ -215,14 +215,14 @@ EOF
{
$stmt = $this->_conn->prepare('SELECT id FROM stmt_test');
$this->assertSame($expected, $fetch($stmt));
self::assertSame($expected, $fetch($stmt));
}
public function testCloseCursorOnNonExecutedStatement()
{
$stmt = $this->_conn->prepare('SELECT id FROM stmt_test');
$this->assertTrue($stmt->closeCursor());
self::assertTrue($stmt->closeCursor());
}
/**
......@@ -235,7 +235,7 @@ EOF
$stmt->execute();
$stmt->fetch();
$this->assertTrue($stmt->closeCursor());
self::assertTrue($stmt->closeCursor());
}
/**
......@@ -246,7 +246,7 @@ EOF
$stmt = $this->_conn->prepare('SELECT id FROM stmt_test');
$stmt->closeCursor();
$this->assertSame($expected, $fetch($stmt));
self::assertSame($expected, $fetch($stmt));
}
/**
......@@ -260,7 +260,7 @@ EOF
$stmt->execute();
$stmt->closeCursor();
$this->assertSame($expected, $fetch($stmt));
self::assertSame($expected, $fetch($stmt));
}
public static function emptyFetchProvider()
......
......@@ -40,9 +40,9 @@ class TableGeneratorTest extends \Doctrine\Tests\DbalFunctionalTestCase
$id2 = $this->generator->nextValue("tbl1");
$id3 = $this->generator->nextValue("tbl2");
$this->assertTrue($id1 > 0, "First id has to be larger than 0");
$this->assertEquals($id1 + 1, $id2, "Second id is one larger than first one.");
$this->assertEquals($id1, $id3, "First ids from different tables are equal.");
self::assertTrue($id1 > 0, "First id has to be larger than 0");
self::assertEquals($id1 + 1, $id2, "Second id is one larger than first one.");
self::assertEquals($id1, $id3, "First ids from different tables are equal.");
}
public function testNextValNotAffectedByOuterTransactions()
......@@ -52,8 +52,8 @@ class TableGeneratorTest extends \Doctrine\Tests\DbalFunctionalTestCase
$this->_conn->rollBack();
$id2 = $this->generator->nextValue("tbl1");
$this->assertTrue($id1 > 0, "First id has to be larger than 0");
$this->assertEquals($id1 + 1, $id2, "Second id is one larger than first one.");
self::assertTrue($id1 > 0, "First id has to be larger than 0");
self::assertEquals($id1 + 1, $id2, "Second id is one larger than first one.");
}
}
......@@ -62,7 +62,7 @@ class TemporaryTableTest extends \Doctrine\Tests\DbalFunctionalTestCase
$this->_conn->rollBack();
$rows = $this->_conn->fetchAll('SELECT * FROM nontemporary');
$this->assertEquals(array(), $rows, "In an event of an error this result has one row, because of an implicit commit.");
self::assertEquals(array(), $rows, "In an event of an error this result has one row, because of an implicit commit.");
}
/**
......@@ -104,6 +104,6 @@ class TemporaryTableTest extends \Doctrine\Tests\DbalFunctionalTestCase
}
$rows = $this->_conn->fetchAll('SELECT * FROM nontemporary');
$this->assertEquals(array(), $rows, "In an event of an error this result has one row, because of an implicit commit.");
self::assertEquals(array(), $rows, "In an event of an error this result has one row, because of an implicit commit.");
}
}
......@@ -22,6 +22,6 @@ class DBAL168Test extends \Doctrine\Tests\DbalFunctionalTestCase
$this->_conn->getSchemaManager()->createTable($table);
$table = $this->_conn->getSchemaManager()->listTableDetails('domains');
$this->assertEquals('domains', $table->getName());
self::assertEquals('domains', $table->getName());
}
}
\ No newline at end of file
}
......@@ -33,7 +33,7 @@ class DBAL202Test extends \Doctrine\Tests\DbalFunctionalTestCase
$stmt->execute();
$this->_conn->rollBack();
$this->assertEquals(0, $this->_conn->query('SELECT COUNT(1) FROM DBAL202')->fetchColumn());
self::assertEquals(0, $this->_conn->query('SELECT COUNT(1) FROM DBAL202')->fetchColumn());
}
public function testStatementCommit()
......@@ -43,6 +43,6 @@ class DBAL202Test extends \Doctrine\Tests\DbalFunctionalTestCase
$stmt->execute();
$this->_conn->commit();
$this->assertEquals(1, $this->_conn->query('SELECT COUNT(1) FROM DBAL202')->fetchColumn());
self::assertEquals(1, $this->_conn->query('SELECT COUNT(1) FROM DBAL202')->fetchColumn());
}
}
......@@ -21,7 +21,7 @@ class DBAL421Test extends \Doctrine\Tests\DbalFunctionalTestCase
{
$guid = $this->_conn->query($this->getSelectGuidSql())->fetchColumn();
$pattern = '/[0-9A-F]{8}\-[0-9A-F]{4}\-[0-9A-F]{4}\-[8-9A-B][0-9A-F]{3}\-[0-9A-F]{12}/i';
$this->assertEquals(1, preg_match($pattern, $guid), "GUID does not match pattern");
self::assertEquals(1, preg_match($pattern, $guid), "GUID does not match pattern");
}
/**
......@@ -36,7 +36,7 @@ class DBAL421Test extends \Doctrine\Tests\DbalFunctionalTestCase
for ($i = 0; $i < 99; $i++) {
$statement->execute();
$guid = $statement->fetchColumn();
$this->assertNotContains($guid, $guids, "Duplicate GUID detected");
self::assertNotContains($guid, $guids, "Duplicate GUID detected");
$guids[] = $guid;
}
......
......@@ -31,6 +31,6 @@ class DBAL461Test extends \PHPUnit\Framework\TestCase
'comment' => null,
));
$this->assertEquals('Decimal', (string)$column->getType());
self::assertEquals('Decimal', (string)$column->getType());
}
}
......@@ -32,6 +32,6 @@ class DBAL510Test extends \Doctrine\Tests\DbalFunctionalTestCase
$comparator = new Comparator();
$diff = $comparator->diffTable($onlineTable, $table);
$this->assertFalse($diff);
self::assertFalse($diff);
}
}
......@@ -49,22 +49,22 @@ class DBAL630Test extends \Doctrine\Tests\DbalFunctionalTestCase
{
$this->_conn->executeUpdate('INSERT INTO dbal630 (bool_col) VALUES(false)');
$id = $this->_conn->lastInsertId('dbal630_id_seq');
$this->assertNotEmpty($id);
self::assertNotEmpty($id);
$row = $this->_conn->fetchAssoc('SELECT bool_col FROM dbal630 WHERE id = ?', array($id));
$this->assertFalse($row['bool_col']);
self::assertFalse($row['bool_col']);
}
public function testBooleanConversionBoolParamRealPrepares()
{
$this->_conn->executeUpdate('INSERT INTO dbal630 (bool_col) VALUES(?)', array('false'), array(PDO::PARAM_BOOL));
$id = $this->_conn->lastInsertId('dbal630_id_seq');
$this->assertNotEmpty($id);
self::assertNotEmpty($id);
$row = $this->_conn->fetchAssoc('SELECT bool_col FROM dbal630 WHERE id = ?', array($id));
$this->assertFalse($row['bool_col']);
self::assertFalse($row['bool_col']);
}
public function testBooleanConversionBoolParamEmulatedPrepares()
......@@ -85,11 +85,11 @@ class DBAL630Test extends \Doctrine\Tests\DbalFunctionalTestCase
$id = $this->_conn->lastInsertId('dbal630_id_seq');
$this->assertNotEmpty($id);
self::assertNotEmpty($id);
$row = $this->_conn->fetchAssoc('SELECT bool_col FROM dbal630 WHERE id = ?', array($id));
$this->assertFalse($row['bool_col']);
self::assertFalse($row['bool_col']);
}
/**
......@@ -115,11 +115,11 @@ class DBAL630Test extends \Doctrine\Tests\DbalFunctionalTestCase
$id = $this->_conn->lastInsertId('dbal630_allow_nulls_id_seq');
$this->assertNotEmpty($id);
self::assertNotEmpty($id);
$row = $this->_conn->fetchAssoc('SELECT bool_col FROM dbal630_allow_nulls WHERE id = ?', array($id));
$this->assertSame($databaseConvertedValue, $row['bool_col']);
self::assertSame($databaseConvertedValue, $row['bool_col']);
}
/**
......@@ -145,11 +145,11 @@ class DBAL630Test extends \Doctrine\Tests\DbalFunctionalTestCase
$id = $this->_conn->lastInsertId('dbal630_allow_nulls_id_seq');
$this->assertNotEmpty($id);
self::assertNotEmpty($id);
$row = $this->_conn->fetchAssoc('SELECT bool_col FROM dbal630_allow_nulls WHERE id = ?', array($id));
$this->assertSame($databaseConvertedValue, $row['bool_col']);
self::assertSame($databaseConvertedValue, $row['bool_col']);
}
/**
......
......@@ -38,23 +38,23 @@ SQL
$fetchedTable = $schemaManager->listTableDetails('dbal752_unsigneds');
$this->assertEquals('smallint', $fetchedTable->getColumn('small')->getType()->getName());
$this->assertEquals('smallint', $fetchedTable->getColumn('small_unsigned')->getType()->getName());
$this->assertEquals('integer', $fetchedTable->getColumn('medium')->getType()->getName());
$this->assertEquals('integer', $fetchedTable->getColumn('medium_unsigned')->getType()->getName());
$this->assertEquals('integer', $fetchedTable->getColumn('integer')->getType()->getName());
$this->assertEquals('integer', $fetchedTable->getColumn('integer_unsigned')->getType()->getName());
$this->assertEquals('bigint', $fetchedTable->getColumn('big')->getType()->getName());
$this->assertEquals('bigint', $fetchedTable->getColumn('big_unsigned')->getType()->getName());
$this->assertTrue($fetchedTable->getColumn('small_unsigned')->getUnsigned());
$this->assertTrue($fetchedTable->getColumn('medium_unsigned')->getUnsigned());
$this->assertTrue($fetchedTable->getColumn('integer_unsigned')->getUnsigned());
$this->assertTrue($fetchedTable->getColumn('big_unsigned')->getUnsigned());
$this->assertFalse($fetchedTable->getColumn('small')->getUnsigned());
$this->assertFalse($fetchedTable->getColumn('medium')->getUnsigned());
$this->assertFalse($fetchedTable->getColumn('integer')->getUnsigned());
$this->assertFalse($fetchedTable->getColumn('big')->getUnsigned());
self::assertEquals('smallint', $fetchedTable->getColumn('small')->getType()->getName());
self::assertEquals('smallint', $fetchedTable->getColumn('small_unsigned')->getType()->getName());
self::assertEquals('integer', $fetchedTable->getColumn('medium')->getType()->getName());
self::assertEquals('integer', $fetchedTable->getColumn('medium_unsigned')->getType()->getName());
self::assertEquals('integer', $fetchedTable->getColumn('integer')->getType()->getName());
self::assertEquals('integer', $fetchedTable->getColumn('integer_unsigned')->getType()->getName());
self::assertEquals('bigint', $fetchedTable->getColumn('big')->getType()->getName());
self::assertEquals('bigint', $fetchedTable->getColumn('big_unsigned')->getType()->getName());
self::assertTrue($fetchedTable->getColumn('small_unsigned')->getUnsigned());
self::assertTrue($fetchedTable->getColumn('medium_unsigned')->getUnsigned());
self::assertTrue($fetchedTable->getColumn('integer_unsigned')->getUnsigned());
self::assertTrue($fetchedTable->getColumn('big_unsigned')->getUnsigned());
self::assertFalse($fetchedTable->getColumn('small')->getUnsigned());
self::assertFalse($fetchedTable->getColumn('medium')->getUnsigned());
self::assertFalse($fetchedTable->getColumn('integer')->getUnsigned());
self::assertFalse($fetchedTable->getColumn('big')->getUnsigned());
}
}
......@@ -83,16 +83,16 @@ class TypeConversionTest extends \Doctrine\Tests\DbalFunctionalTestCase
$actualDbValue = $typeInstance->convertToPHPValue($this->_conn->fetchColumn($sql), $this->_conn->getDatabasePlatform());
if ($originalValue instanceof \DateTime) {
$this->assertInstanceOf($expectedPhpType, $actualDbValue, "The expected type from the conversion to and back from the database should be " . $expectedPhpType);
self::assertInstanceOf($expectedPhpType, $actualDbValue, "The expected type from the conversion to and back from the database should be " . $expectedPhpType);
} else {
$this->assertInternalType($expectedPhpType, $actualDbValue, "The expected type from the conversion to and back from the database should be " . $expectedPhpType);
self::assertInternalType($expectedPhpType, $actualDbValue, "The expected type from the conversion to and back from the database should be " . $expectedPhpType);
}
if ($type !== "datetimetz") {
$this->assertEquals($originalValue, $actualDbValue, "Conversion between values should produce the same out as in value, but doesnt!");
self::assertEquals($originalValue, $actualDbValue, "Conversion between values should produce the same out as in value, but doesnt!");
if ($originalValue instanceof \DateTime) {
$this->assertEquals($originalValue->getTimezone()->getName(), $actualDbValue->getTimezone()->getName(), "Timezones should be the same.");
self::assertEquals($originalValue->getTimezone()->getName(), $actualDbValue->getTimezone()->getName(), "Timezones should be the same.");
}
}
}
......
......@@ -34,7 +34,7 @@ class WriteTest extends \Doctrine\Tests\DbalFunctionalTestCase
$this->_conn->executeUpdate($sql, array("text", 1111), array(null, PDO::PARAM_INT));
$sql = "SELECT * FROM write_table WHERE test_string = ? AND test_int = ?";
$this->assertTrue((bool)$this->_conn->fetchColumn($sql, array("text", 1111)));
self::assertTrue((bool)$this->_conn->fetchColumn($sql, array("text", 1111)));
}
public function testExecuteUpdate()
......@@ -42,7 +42,7 @@ class WriteTest extends \Doctrine\Tests\DbalFunctionalTestCase
$sql = "INSERT INTO write_table (test_int) VALUES ( " . $this->_conn->quote(1) . ")";
$affected = $this->_conn->executeUpdate($sql);
$this->assertEquals(1, $affected, "executeUpdate() should return the number of affected rows!");
self::assertEquals(1, $affected, "executeUpdate() should return the number of affected rows!");
}
public function testExecuteUpdateWithTypes()
......@@ -50,7 +50,7 @@ class WriteTest extends \Doctrine\Tests\DbalFunctionalTestCase
$sql = "INSERT INTO write_table (test_int, test_string) VALUES (?, ?)";
$affected = $this->_conn->executeUpdate($sql, array(1, 'foo'), array(\PDO::PARAM_INT, \PDO::PARAM_STR));
$this->assertEquals(1, $affected, "executeUpdate() should return the number of affected rows!");
self::assertEquals(1, $affected, "executeUpdate() should return the number of affected rows!");
}
public function testPrepareRowCountReturnsAffectedRows()
......@@ -62,7 +62,7 @@ class WriteTest extends \Doctrine\Tests\DbalFunctionalTestCase
$stmt->bindValue(2, "foo");
$stmt->execute();
$this->assertEquals(1, $stmt->rowCount());
self::assertEquals(1, $stmt->rowCount());
}
public function testPrepareWithPdoTypes()
......@@ -74,7 +74,7 @@ class WriteTest extends \Doctrine\Tests\DbalFunctionalTestCase
$stmt->bindValue(2, "foo", \PDO::PARAM_STR);
$stmt->execute();
$this->assertEquals(1, $stmt->rowCount());
self::assertEquals(1, $stmt->rowCount());
}
public function testPrepareWithDbalTypes()
......@@ -86,7 +86,7 @@ class WriteTest extends \Doctrine\Tests\DbalFunctionalTestCase
$stmt->bindValue(2, "foo", Type::getType('string'));
$stmt->execute();
$this->assertEquals(1, $stmt->rowCount());
self::assertEquals(1, $stmt->rowCount());
}
public function testPrepareWithDbalTypeNames()
......@@ -98,13 +98,13 @@ class WriteTest extends \Doctrine\Tests\DbalFunctionalTestCase
$stmt->bindValue(2, "foo", 'string');
$stmt->execute();
$this->assertEquals(1, $stmt->rowCount());
self::assertEquals(1, $stmt->rowCount());
}
public function insertRows()
{
$this->assertEquals(1, $this->_conn->insert('write_table', array('test_int' => 1, 'test_string' => 'foo')));
$this->assertEquals(1, $this->_conn->insert('write_table', array('test_int' => 2, 'test_string' => 'bar')));
self::assertEquals(1, $this->_conn->insert('write_table', array('test_int' => 1, 'test_string' => 'foo')));
self::assertEquals(1, $this->_conn->insert('write_table', array('test_int' => 2, 'test_string' => 'bar')));
}
public function testInsert()
......@@ -116,20 +116,20 @@ class WriteTest extends \Doctrine\Tests\DbalFunctionalTestCase
{
$this->insertRows();
$this->assertEquals(1, $this->_conn->delete('write_table', array('test_int' => 2)));
$this->assertEquals(1, count($this->_conn->fetchAll('SELECT * FROM write_table')));
self::assertEquals(1, $this->_conn->delete('write_table', array('test_int' => 2)));
self::assertEquals(1, count($this->_conn->fetchAll('SELECT * FROM write_table')));
$this->assertEquals(1, $this->_conn->delete('write_table', array('test_int' => 1)));
$this->assertEquals(0, count($this->_conn->fetchAll('SELECT * FROM write_table')));
self::assertEquals(1, $this->_conn->delete('write_table', array('test_int' => 1)));
self::assertEquals(0, count($this->_conn->fetchAll('SELECT * FROM write_table')));
}
public function testUpdate()
{
$this->insertRows();
$this->assertEquals(1, $this->_conn->update('write_table', array('test_string' => 'bar'), array('test_string' => 'foo')));
$this->assertEquals(2, $this->_conn->update('write_table', array('test_string' => 'baz'), array('test_string' => 'bar')));
$this->assertEquals(0, $this->_conn->update('write_table', array('test_string' => 'baz'), array('test_string' => 'bar')));
self::assertEquals(1, $this->_conn->update('write_table', array('test_string' => 'bar'), array('test_string' => 'foo')));
self::assertEquals(2, $this->_conn->update('write_table', array('test_string' => 'baz'), array('test_string' => 'bar')));
self::assertEquals(0, $this->_conn->update('write_table', array('test_string' => 'baz'), array('test_string' => 'bar')));
}
public function testLastInsertId()
......@@ -138,11 +138,11 @@ class WriteTest extends \Doctrine\Tests\DbalFunctionalTestCase
$this->markTestSkipped('Test only works on platforms with identity columns.');
}
$this->assertEquals(1, $this->_conn->insert('write_table', array('test_int' => 2, 'test_string' => 'bar')));
self::assertEquals(1, $this->_conn->insert('write_table', array('test_int' => 2, 'test_string' => 'bar')));
$num = $this->_conn->lastInsertId();
$this->assertNotNull($num, "LastInsertId() should not be null.");
$this->assertTrue($num > 0, "LastInsertId() should be non-negative number.");
self::assertNotNull($num, "LastInsertId() should not be null.");
self::assertTrue($num > 0, "LastInsertId() should be non-negative number.");
}
public function testLastInsertIdSequence()
......@@ -158,7 +158,7 @@ class WriteTest extends \Doctrine\Tests\DbalFunctionalTestCase
}
$sequences = $this->_conn->getSchemaManager()->listSequences();
$this->assertEquals(1, count(array_filter($sequences, function($sequence) {
self::assertEquals(1, count(array_filter($sequences, function($sequence) {
return strtolower($sequence->getName()) === 'write_table_id_seq';
})));
......@@ -167,8 +167,8 @@ class WriteTest extends \Doctrine\Tests\DbalFunctionalTestCase
$lastInsertId = $this->_conn->lastInsertId('write_table_id_seq');
$this->assertTrue($lastInsertId > 0);
$this->assertEquals($nextSequenceVal, $lastInsertId);
self::assertTrue($lastInsertId > 0);
self::assertEquals($nextSequenceVal, $lastInsertId);
}
public function testLastInsertIdNoSequenceGiven()
......@@ -177,7 +177,7 @@ class WriteTest extends \Doctrine\Tests\DbalFunctionalTestCase
$this->markTestSkipped("Test only works consistently on platforms that support sequences and don't support identity columns.");
}
$this->assertFalse($this->_conn->lastInsertId( null ));
self::assertFalse($this->_conn->lastInsertId( null ));
}
......@@ -196,7 +196,7 @@ class WriteTest extends \Doctrine\Tests\DbalFunctionalTestCase
$data = $this->_conn->fetchColumn('SELECT test_string FROM write_table WHERE test_int = 30');
$this->assertEquals($testString->format($this->_conn->getDatabasePlatform()->getDateTimeFormatString()), $data);
self::assertEquals($testString->format($this->_conn->getDatabasePlatform()->getDateTimeFormatString()), $data);
}
/**
......@@ -223,7 +223,7 @@ class WriteTest extends \Doctrine\Tests\DbalFunctionalTestCase
$data = $this->_conn->fetchColumn('SELECT test_string FROM write_table WHERE test_int = 30');
$this->assertEquals($testString->format($this->_conn->getDatabasePlatform()->getDateTimeFormatString()), $data);
self::assertEquals($testString->format($this->_conn->getDatabasePlatform()->getDateTimeFormatString()), $data);
}
/**
......@@ -242,7 +242,7 @@ class WriteTest extends \Doctrine\Tests\DbalFunctionalTestCase
$data = $this->_conn->fetchColumn('SELECT test_string FROM write_table WHERE test_int = 30');
$this->assertFalse($data);
self::assertFalse($data);
}
public function testEmptyIdentityInsert()
......@@ -281,7 +281,7 @@ class WriteTest extends \Doctrine\Tests\DbalFunctionalTestCase
$secondId = $this->_conn->lastInsertId($seqName);
$this->assertTrue($secondId > $firstId);
self::assertTrue($secondId > $firstId);
}
......@@ -298,13 +298,13 @@ class WriteTest extends \Doctrine\Tests\DbalFunctionalTestCase
$data = $this->_conn->fetchAll('SELECT * FROM write_table WHERE test_int = 30');
$this->assertCount(1, $data);
self::assertCount(1, $data);
$this->_conn->update('write_table', ['test_int' => 10], ['test_string' => null], ['test_string' => 'string', 'test_int' => 'integer']);
$data = $this->_conn->fetchAll('SELECT * FROM write_table WHERE test_int = 30');
$this->assertCount(0, $data);
self::assertCount(0, $data);
}
public function testDeleteWhereIsNull()
......@@ -317,12 +317,12 @@ class WriteTest extends \Doctrine\Tests\DbalFunctionalTestCase
$data = $this->_conn->fetchAll('SELECT * FROM write_table WHERE test_int = 30');
$this->assertCount(1, $data);
self::assertCount(1, $data);
$this->_conn->delete('write_table', ['test_string' => null], ['test_string' => 'string']);
$data = $this->_conn->fetchAll('SELECT * FROM write_table WHERE test_int = 30');
$this->assertCount(0, $data);
self::assertCount(0, $data);
}
}
......@@ -17,7 +17,7 @@ class DebugStackTest extends \Doctrine\Tests\DbalTestCase
public function testLoggedQuery()
{
$this->logger->startQuery('SELECT column FROM table');
$this->assertEquals(
self::assertEquals(
array(
1 => array(
'sql' => 'SELECT column FROM table',
......@@ -30,16 +30,16 @@ class DebugStackTest extends \Doctrine\Tests\DbalTestCase
);
$this->logger->stopQuery();
$this->assertGreaterThan(0, $this->logger->queries[1]['executionMS']);
self::assertGreaterThan(0, $this->logger->queries[1]['executionMS']);
}
public function testLoggedQueryDisabled()
{
$this->logger->enabled = false;
$this->logger->startQuery('SELECT column FROM table');
$this->assertEquals(array(), $this->logger->queries);
self::assertEquals(array(), $this->logger->queries);
$this->logger->stopQuery();
$this->assertEquals(array(), $this->logger->queries);
self::assertEquals(array(), $this->logger->queries);
}
}
......@@ -17,18 +17,18 @@ class MySQL57PlatformTest extends AbstractMySQLPlatformTestCase
public function testHasNativeJsonType()
{
$this->assertTrue($this->_platform->hasNativeJsonType());
self::assertTrue($this->_platform->hasNativeJsonType());
}
public function testReturnsJsonTypeDeclarationSQL()
{
$this->assertSame('JSON', $this->_platform->getJsonTypeDeclarationSQL(array()));
self::assertSame('JSON', $this->_platform->getJsonTypeDeclarationSQL(array()));
}
public function testInitializesJsonTypeMapping()
{
$this->assertTrue($this->_platform->hasDoctrineTypeMappingFor('json'));
$this->assertSame(Type::JSON, $this->_platform->getDoctrineTypeMapping('json'));
self::assertTrue($this->_platform->hasDoctrineTypeMappingFor('json'));
self::assertSame(Type::JSON, $this->_platform->getDoctrineTypeMapping('json'));
}
/**
......
......@@ -14,7 +14,7 @@ class MySqlPlatformTest extends AbstractMySQLPlatformTestCase
public function testHasCorrectDefaultTransactionIsolationLevel()
{
$this->assertEquals(
self::assertEquals(
Connection::TRANSACTION_REPEATABLE_READ,
$this->_platform->getDefaultTransactionIsolationLevel()
);
......
......@@ -13,7 +13,7 @@ class PostgreSql91PlatformTest extends PostgreSqlPlatformTest
public function testColumnCollationDeclarationSQL()
{
$this->assertEquals(
self::assertEquals(
'COLLATE "en_US.UTF-8"',
$this->_platform->getColumnCollationDeclarationSQL('en_US.UTF-8')
);
......
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