Commit 24b4ebf0 authored by Marco Pivetta's avatar Marco Pivetta Committed by GitHub

Merge pull request #2849 from lcobucci/update-build

Update build to use stages (adding PHPCS to check for CS violations)
parents 8d18a330 a39ea6b1
......@@ -8,3 +8,4 @@ build.properties export-ignore
build.xml export-ignore
phpunit.xml.dist export-ignore
run-all.sh export-ignore
/phpcs.xml.dist export-ignore
......@@ -5,4 +5,6 @@ dist/
download/
vendor/
*.phpunit.xml
composer.lock
\ No newline at end of file
composer.lock
/phpunit.xml
/.phpcs-cache
language: php
sudo: false
dist: trusty
cache:
directories:
......@@ -8,6 +9,7 @@ cache:
php:
- 7.1
- 7.2
- nightly
env:
......@@ -15,148 +17,215 @@ env:
- DB=mysql
- DB=mysqli
before_install:
- mv ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini{,.disabled} || echo "xdebug not available"
before_script:
- if [[ $TRAVIS_PHP_VERSION = '7.1' && $DB = 'sqlite' ]]; then PHPUNIT_FLAGS="--coverage-clover .clover.xml"; else PHPUNIT_FLAGS=""; fi
- if [[ "$PHPUNIT_FLAGS" == "" ]]; then phpenv config-rm xdebug.ini || true; fi
- if [ "$MYSQL_VERSION" == "5.7" ]; then bash ./tests/travis/install-mysql-5.7.sh; fi;
- if [[ "$MYSQL_VERSION" == "5.6" || "$MYSQL_VERSION" == "5.7" ]]; then mysql -e "CREATE SCHEMA doctrine_tests; GRANT ALL PRIVILEGES ON doctrine_tests.* to travis@'%'"; fi;
- if [[ "$MYSQL_VERSION" == "5.6" || "$MYSQL_VERSION" == "5.7" ]]; then mysql -e "CREATE SCHEMA test_create_database; GRANT ALL PRIVILEGES ON test_create_database.* to travis@'%'"; fi;
- if [[ "$MYSQL_VERSION" == "5.6" || "$MYSQL_VERSION" == "5.7" ]]; then mysql -e "CREATE SCHEMA test_drop_database; GRANT ALL PRIVILEGES ON test_drop_database.* to travis@'%'"; fi;
matrix:
fast_finish: true
include:
- php: 7.1
env: DB=mysql MYSQL_VERSION=5.6
dist: trusty
- php: nightly
env: DB=mysql MYSQL_VERSION=5.6
dist: trusty
- if [[ "$DB" == "mysql" || "$DB" == "mysqli" || "$DB" == "mariadb" ]]; then mysql < tests/travis/create-mysql-schema.sql; fi;
install:
- travis_retry composer -n install
- php: 7.1
env: DB=mysqli MYSQL_VERSION=5.6
dist: trusty
script: ./vendor/bin/phpunit --configuration tests/travis/$DB.travis.xml
jobs:
allow_failures:
- php: nightly
env: DB=mysqli MYSQL_VERSION=5.6
dist: trusty
- php: 7.1
include:
- stage: Test
php: 7.1
env: DB=mysql MYSQL_VERSION=5.7
dist: trusty
sudo: required
- php: nightly
before_script:
- bash ./tests/travis/install-mysql-5.7.sh
- stage: Test
php: 7.2
env: DB=mysql MYSQL_VERSION=5.7
sudo: required
before_script:
- bash ./tests/travis/install-mysql-5.7.sh
- stage: Test
php: nightly
env: DB=mysql MYSQL_VERSION=5.7
dist: trusty
sudo: required
before_script:
- bash ./tests/travis/install-mysql-5.7.sh
- php: 7.1
- stage: Test
php: 7.1
env: DB=mysqli MYSQL_VERSION=5.7
dist: trusty
sudo: required
- php: nightly
before_script:
- bash ./tests/travis/install-mysql-5.7.sh
- stage: Test
php: 7.2
env: DB=mysqli MYSQL_VERSION=5.7
dist: trusty
sudo: required
before_script:
- bash ./tests/travis/install-mysql-5.7.sh
- stage: Test
php: nightly
env: DB=mysqli MYSQL_VERSION=5.7
sudo: required
before_script:
- bash ./tests/travis/install-mysql-5.7.sh
- php: 7.1
- stage: Test
php: 7.1
env: DB=mariadb MARIADB_VERSION=10.0
addons:
mariadb: 10.0
- php: nightly
- stage: Test
php: 7.2
env: DB=mariadb MARIADB_VERSION=10.0
addons:
mariadb: 10.0
- stage: Test
php: nightly
env: DB=mariadb MARIADB_VERSION=10.0
addons:
mariadb: 10.0
- php: 7.1
- stage: Test
php: 7.1
env: DB=mariadb MARIADB_VERSION=10.1
addons:
mariadb: 10.1
- php: nightly
- stage: Test
php: 7.2
env: DB=mariadb MARIADB_VERSION=10.1
addons:
mariadb: 10.1
- stage: Test
php: nightly
env: DB=mariadb MARIADB_VERSION=10.1
addons:
mariadb: 10.1
- php: 7.1
- stage: Test
php: 7.1
env: DB=pgsql POSTGRESQL_VERSION=9.2
services:
- postgresql
addons:
postgresql: "9.2"
- stage: Test
php: 7.2
env: DB=pgsql POSTGRESQL_VERSION=9.2
services:
- postgresql
env: DB=pgsql POSTGRESQL_VERSION=9.2
- php: nightly
addons:
postgresql: "9.2"
- stage: Test
php: nightly
env: DB=pgsql POSTGRESQL_VERSION=9.2
services:
- postgresql
env: DB=pgsql POSTGRESQL_VERSION=9.2
addons:
postgresql: "9.2"
- php: 7.1
- stage: Test
php: 7.1
env: DB=pgsql POSTGRESQL_VERSION=9.3
services:
- postgresql
addons:
postgresql: "9.3"
- stage: Test
php: 7.2
env: DB=pgsql POSTGRESQL_VERSION=9.3
services:
- postgresql
env: DB=pgsql POSTGRESQL_VERSION=9.3
- php: nightly
addons:
postgresql: "9.3"
- stage: Test
php: nightly
env: DB=pgsql POSTGRESQL_VERSION=9.3
services:
- postgresql
env: DB=pgsql POSTGRESQL_VERSION=9.3
addons:
postgresql: "9.3"
- php: 7.1
- stage: Test
php: 7.1
env: DB=pgsql POSTGRESQL_VERSION=9.4
services:
- postgresql
addons:
postgresql: "9.4"
- stage: Test
php: 7.2
env: DB=pgsql POSTGRESQL_VERSION=9.4
services:
- postgresql
env: DB=pgsql POSTGRESQL_VERSION=9.4
- php: nightly
addons:
postgresql: "9.4"
- stage: Test
php: nightly
env: DB=pgsql POSTGRESQL_VERSION=9.4
services:
- postgresql
env: DB=pgsql POSTGRESQL_VERSION=9.4
addons:
postgresql: "9.4"
- php: 7.1
sudo: false
dist: trusty
- stage: Test
php: 7.1
env: DB=pgsql POSTGRESQL_VERSION=9.5
services:
- postgresql
addons:
postgresql: "9.5"
- stage: Test
php: 7.2
env: DB=pgsql POSTGRESQL_VERSION=9.5
services:
- postgresql
env: DB=pgsql POSTGRESQL_VERSION=9.5
- php: nightly
sudo: false
dist: trusty
addons:
postgresql: "9.5"
- stage: Test
php: nightly
env: DB=pgsql POSTGRESQL_VERSION=9.5
services:
- postgresql
env: DB=pgsql POSTGRESQL_VERSION=9.5
addons:
postgresql: "9.5"
- php: 7.1
sudo: false
dist: trusty
- stage: Test
php: 7.1
env: DB=pgsql POSTGRESQL_VERSION=9.6
services:
- postgresql
addons:
postgresql: "9.6"
- stage: Test
php: 7.2
env: DB=pgsql POSTGRESQL_VERSION=9.6
services:
- postgresql
env: DB=pgsql POSTGRESQL_VERSION=9.6
- php: nightly
sudo: false
dist: trusty
addons:
postgresql: "9.6"
- stage: Test
php: nightly
env: DB=pgsql POSTGRESQL_VERSION=9.6
services:
- postgresql
env: DB=pgsql POSTGRESQL_VERSION=9.6
allow_failures:
- php: nightly
after_script:
- if [[ "$PHPUNIT_FLAGS" != "" ]]; then wget https://scrutinizer-ci.com/ocular.phar; fi
- if [[ "$PHPUNIT_FLAGS" != "" ]]; then php ocular.phar code-coverage:upload --format=php-clover .clover.xml; fi
install:
- travis_retry composer install
addons:
postgresql: "9.6"
script: ./vendor/bin/phpunit --configuration tests/travis/$DB.travis.xml $PHPUNIT_FLAGS
- stage: Coverage
php: 7.1
env: DB=sqlite
before_script:
- mv ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini{.disabled,}
- if [[ ! $(php -m | grep -si xdebug) ]]; then echo "xdebug required for coverage"; exit 1; fi
script:
- ./vendor/bin/phpunit --configuration tests/travis/$DB.travis.xml --coverage-clover clover.xml
after_script:
- wget https://scrutinizer-ci.com/ocular.phar
- php ocular.phar code-coverage:upload --format=php-clover clover.xml
- stage: Coding standard
php: nightly
script:
- ./vendor/bin/phpcs
......@@ -17,9 +17,11 @@
"doctrine/common": "^2.7.1"
},
"require-dev": {
"phpunit/phpunit": "^5.4.6",
"phpunit/phpunit": "^6.3",
"phpunit/phpunit-mock-objects": "!=3.2.4,!=3.2.5",
"symfony/console": "2.*||^3.0"
"symfony/console": "2.*||^3.0",
"doctrine/coding-standard": "^1.0",
"squizlabs/php_codesniffer": "^3.0"
},
"suggest": {
"symfony/console": "For helpful console commands such as SQL execution and import of files."
......
<?xml version="1.0"?>
<ruleset>
<arg name="basepath" value="."/>
<arg name="extensions" value="php"/>
<arg name="parallel" value="80"/>
<arg name="cache" value=".phpcs-cache"/>
<arg name="colors" />
<!-- Ignore warnings and show progress of the run -->
<arg value="np"/>
<file>lib</file>
<file>tests</file>
<rule ref="Doctrine"/>
<rule ref="PSR1.Classes.ClassDeclaration.MultipleClasses">
<exclude-pattern>*/tests/*</exclude-pattern>
</rule>
<rule ref="Generic.NamingConventions.UpperCaseConstantName.ClassConstantNotUpperCase">
<exclude-pattern>lib/Doctrine/DBAL/Events.php</exclude-pattern>
</rule>
</ruleset>
......@@ -12,10 +12,12 @@
Example: phpunit -c mysqlconf.xml
-->
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.8/phpunit.xsd"
backupGlobals="false"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
colors="true"
bootstrap="vendor/autoload.php"
verbose="true"
beStrictAboutOutputDuringTests="true"
beStrictAboutTodoAnnotatedTests="true"
failOnRisky="true"
>
<php>
<ini name="error_reporting" value="-1" />
......@@ -30,7 +32,7 @@
<var name="db_port" value="3306"/>
-->
<!--<var name="db_event_subscribers" value="Doctrine\DBAL\Event\Listeners\OracleSessionInit">-->
<!-- Database for temporary connections (i.e. to drop/create the main database) -->
<var name="tmpdb_type" value="pdo_mysql"/>
<var name="tmpdb_host" value="localhost" />
......@@ -49,6 +51,7 @@
<directory>./tests/Doctrine/Tests/DBAL/Performance</directory>
</testsuite>
</testsuites>
<listeners>
<listener class="Doctrine\Tests\DbalPerformanceTestListener"/>
</listeners>
......
......@@ -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());
}
}
......@@ -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());
}
}
......@@ -2,6 +2,9 @@
namespace Doctrine\Tests\DBAL;
use Doctrine\DBAL\DBALException;
use Doctrine\Tests\Mocks\PDOMock;
class DriverManagerTest extends \Doctrine\Tests\DbalTestCase
{
/**
......@@ -21,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());
}
/**
......@@ -36,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));
}
/**
......@@ -64,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()
......@@ -77,12 +80,12 @@ class DriverManagerTest extends \Doctrine\Tests\DbalTestCase
);
$conn = \Doctrine\DBAL\DriverManager::getConnection($options);
$this->assertInstanceOf($wrapperClass, $conn);
self::assertInstanceOf($wrapperClass, $conn);
}
public function testInvalidWrapperClass()
{
$this->setExpectedException('\Doctrine\DBAL\DBALException');
$this->expectException(DBALException::class);
$options = array(
'pdo' => new \PDO('sqlite::memory:'),
......@@ -94,7 +97,7 @@ class DriverManagerTest extends \Doctrine\Tests\DbalTestCase
public function testInvalidDriverClass()
{
$this->setExpectedException('\Doctrine\DBAL\DBALException');
$this->expectException(DBALException::class);
$options = array(
'driverClass' => 'stdClass'
......@@ -110,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());
}
/**
......@@ -123,7 +126,7 @@ class DriverManagerTest extends \Doctrine\Tests\DbalTestCase
);
if ($expected === false) {
$this->setExpectedException('Doctrine\DBAL\DBALException');
$this->expectException(DBALException::class);
}
$conn = \Doctrine\DBAL\DriverManager::getConnection($options);
......@@ -131,16 +134,16 @@ 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]);
}
}
}
public function databaseUrls()
{
$pdoMock = $this->getMock('Doctrine\Tests\Mocks\PDOMock');
$pdoMock = $this->createMock(PDOMock::class);
return array(
'simple URL' => array(
......
......@@ -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());
}
}
......@@ -20,7 +20,6 @@
namespace Doctrine\Tests\DBAL\Exception;
use Doctrine\DBAL\Exception\InvalidArgumentException;
use PHPUnit_Framework_TestCase;
/**
* Tests for {@see \Doctrine\DBAL\Exception\InvalidArgumentException}
......@@ -29,13 +28,13 @@ use PHPUnit_Framework_TestCase;
*
* @author Marco Pivetta <ocramius@gmail.com>
*/
class InvalidArgumentExceptionTest extends PHPUnit_Framework_TestCase
class InvalidArgumentExceptionTest extends \PHPUnit\Framework\TestCase
{
public function testFromEmptyCriteria()
{
$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
}
......@@ -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');
}
}
......@@ -2,7 +2,7 @@
namespace Doctrine\Tests\DBAL\Functional;
use Doctrine\DBAL\Driver\ExceptionConverterDriver;
use Doctrine\DBAL\Exception\ForeignKeyConstraintViolationException;
use Doctrine\DBAL\Exception;
use Doctrine\DBAL\Schema\Table;
class ExceptionTest extends \Doctrine\Tests\DbalFunctionalTestCase
......@@ -26,8 +26,7 @@ class ExceptionTest extends \Doctrine\Tests\DbalFunctionalTestCase
$this->_conn->insert("duplicatekey_table", array('id' => 1));
$this->setExpectedException(
'\Doctrine\DBAL\Exception\UniqueConstraintViolationException');
$this->expectException(Exception\UniqueConstraintViolationException::class);
$this->_conn->insert("duplicatekey_table", array('id' => 1));
}
......@@ -35,7 +34,7 @@ class ExceptionTest extends \Doctrine\Tests\DbalFunctionalTestCase
{
$sql = "SELECT * FROM unknown_table";
$this->setExpectedException('\Doctrine\DBAL\Exception\TableNotFoundException');
$this->expectException(Exception\TableNotFoundException::class);
$this->_conn->executeQuery($sql);
}
......@@ -46,7 +45,7 @@ class ExceptionTest extends \Doctrine\Tests\DbalFunctionalTestCase
$table->addColumn('id', 'integer', array());
$table->setPrimaryKey(array('id'));
$this->setExpectedException('\Doctrine\DBAL\Exception\TableExistsException');
$this->expectException(Exception\TableExistsException::class);
$schemaManager->createTable($table);
$schemaManager->createTable($table);
}
......@@ -68,11 +67,11 @@ class ExceptionTest extends \Doctrine\Tests\DbalFunctionalTestCase
throw $exception;
}
$this->setExpectedException('\Doctrine\DBAL\Exception\ForeignKeyConstraintViolationException');
$this->expectException(Exception\ForeignKeyConstraintViolationException::class);
try {
$this->_conn->insert('owning_table', array('id' => 2, 'constraint_id' => 2));
} catch (ForeignKeyConstraintViolationException $exception) {
} catch (Exception\ForeignKeyConstraintViolationException $exception) {
$this->tearDownForeignKeyConstraintViolationExceptionTest();
throw $exception;
......@@ -102,11 +101,11 @@ class ExceptionTest extends \Doctrine\Tests\DbalFunctionalTestCase
throw $exception;
}
$this->setExpectedException('\Doctrine\DBAL\Exception\ForeignKeyConstraintViolationException');
$this->expectException(Exception\ForeignKeyConstraintViolationException::class);
try {
$this->_conn->update('constraint_error_table', array('id' => 2), array('id' => 1));
} catch (ForeignKeyConstraintViolationException $exception) {
} catch (Exception\ForeignKeyConstraintViolationException $exception) {
$this->tearDownForeignKeyConstraintViolationExceptionTest();
throw $exception;
......@@ -136,11 +135,11 @@ class ExceptionTest extends \Doctrine\Tests\DbalFunctionalTestCase
throw $exception;
}
$this->setExpectedException('\Doctrine\DBAL\Exception\ForeignKeyConstraintViolationException');
$this->expectException(Exception\ForeignKeyConstraintViolationException::class);
try {
$this->_conn->delete('constraint_error_table', array('id' => 1));
} catch (ForeignKeyConstraintViolationException $exception) {
} catch (Exception\ForeignKeyConstraintViolationException $exception) {
$this->tearDownForeignKeyConstraintViolationExceptionTest();
throw $exception;
......@@ -172,11 +171,11 @@ class ExceptionTest extends \Doctrine\Tests\DbalFunctionalTestCase
throw $exception;
}
$this->setExpectedException('\Doctrine\DBAL\Exception\ForeignKeyConstraintViolationException');
$this->expectException(Exception\ForeignKeyConstraintViolationException::class);
try {
$this->_conn->executeUpdate($platform->getTruncateTableSQL('constraint_error_table'));
} catch (ForeignKeyConstraintViolationException $exception) {
} catch (Exception\ForeignKeyConstraintViolationException $exception) {
$this->tearDownForeignKeyConstraintViolationExceptionTest();
throw $exception;
......@@ -202,7 +201,7 @@ class ExceptionTest extends \Doctrine\Tests\DbalFunctionalTestCase
$this->_conn->exec($sql);
}
$this->setExpectedException('\Doctrine\DBAL\Exception\NotNullConstraintViolationException');
$this->expectException(Exception\NotNullConstraintViolationException::class);
$this->_conn->insert("notnull_table", array('id' => 1, 'value' => null));
}
......@@ -217,7 +216,7 @@ class ExceptionTest extends \Doctrine\Tests\DbalFunctionalTestCase
$this->_conn->exec($sql);
}
$this->setExpectedException('\Doctrine\DBAL\Exception\InvalidFieldNameException');
$this->expectException(Exception\InvalidFieldNameException::class);
$this->_conn->insert("bad_fieldname_table", array('name' => 5));
}
......@@ -236,7 +235,7 @@ class ExceptionTest extends \Doctrine\Tests\DbalFunctionalTestCase
}
$sql = 'SELECT id FROM ambiguous_list_table, ambiguous_list_table_2';
$this->setExpectedException('\Doctrine\DBAL\Exception\NonUniqueFieldNameException');
$this->expectException(Exception\NonUniqueFieldNameException::class);
$this->_conn->executeQuery($sql);
}
......@@ -253,7 +252,7 @@ class ExceptionTest extends \Doctrine\Tests\DbalFunctionalTestCase
}
$this->_conn->insert("unique_field_table", array('id' => 5));
$this->setExpectedException('\Doctrine\DBAL\Exception\UniqueConstraintViolationException');
$this->expectException(Exception\UniqueConstraintViolationException::class);
$this->_conn->insert("unique_field_table", array('id' => 5));
}
......@@ -266,7 +265,7 @@ class ExceptionTest extends \Doctrine\Tests\DbalFunctionalTestCase
$this->_conn->getSchemaManager()->createTable($table);
$sql = 'SELECT id FRO syntax_error_table';
$this->setExpectedException('\Doctrine\DBAL\Exception\SyntaxErrorException');
$this->expectException(Exception\SyntaxErrorException::class);
$this->_conn->executeQuery($sql);
}
......@@ -299,7 +298,7 @@ class ExceptionTest extends \Doctrine\Tests\DbalFunctionalTestCase
$table = $schema->createTable("no_connection");
$table->addColumn('id', 'integer');
$this->setExpectedException($exceptionClass);
$this->expectException($exceptionClass);
foreach ($schema->toSql($conn->getDatabasePlatform()) as $sql) {
$conn->exec($sql);
}
......@@ -309,8 +308,8 @@ class ExceptionTest extends \Doctrine\Tests\DbalFunctionalTestCase
{
return array(
// mode 0 is considered read-only on Windows
array(0000, defined('PHP_WINDOWS_VERSION_BUILD') ? '\Doctrine\DBAL\Exception\ReadOnlyException' : '\Doctrine\DBAL\Exception\ConnectionException'),
array(0444, '\Doctrine\DBAL\Exception\ReadOnlyException'),
array(0000, defined('PHP_WINDOWS_VERSION_BUILD') ? Exception\ReadOnlyException::class : Exception\ConnectionException::class),
array(0444, Exception\ReadOnlyException::class),
);
}
......@@ -340,7 +339,7 @@ class ExceptionTest extends \Doctrine\Tests\DbalFunctionalTestCase
$table = $schema->createTable("no_connection");
$table->addColumn('id', 'integer');
$this->setExpectedException('Doctrine\DBAL\Exception\ConnectionException');
$this->expectException(Exception\ConnectionException::class);
foreach ($schema->toSql($conn->getDatabasePlatform()) as $sql) {
$conn->exec($sql);
......
......@@ -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'));
}
}
......@@ -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;
}
......
......@@ -7,7 +7,7 @@ use Doctrine\DBAL\Schema\SQLServerSchemaManager;
/**
* @group DBAL-461
*/
class DBAL461Test extends \PHPUnit_Framework_TestCase
class DBAL461Test extends \PHPUnit\Framework\TestCase
{
public function testIssue()
{
......@@ -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'));
}
/**
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment