From 7ca735dbf8f71bee3b3d45c85193e7d8d4daa90c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lu=C3=ADs=20Cobucci?= Date: Fri, 8 Sep 2017 08:06:47 -0300 Subject: [PATCH 1/5] Create MySQL schema in more situations This is now mandatory on the new Travis-CI containers. --- .travis.yml | 5 ++--- tests/travis/create-mysql-schema.sql | 7 +++++++ 2 files changed, 9 insertions(+), 3 deletions(-) create mode 100644 tests/travis/create-mysql-schema.sql diff --git a/.travis.yml b/.travis.yml index 0f487cad8c9..18798c82603 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,6 @@ language: php sudo: false +dist: trusty cache: directories: @@ -19,9 +20,7 @@ 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; + - if [[ "$MYSQL_VERSION" == "5.6" || "$MYSQL_VERSION" == "5.7" || "$MARIADB_VERSION" == "10.2" || "$MARIADB_VERSION" == "10.1" || "$MARIADB_VERSION" == "10.0" || "$DB" == "mysql" || "$DB" == "mysqli" ]]; then mysql < tests/travis/create-mysql-schema.sql; fi; matrix: fast_finish: true diff --git a/tests/travis/create-mysql-schema.sql b/tests/travis/create-mysql-schema.sql new file mode 100644 index 00000000000..4e331838cfd --- /dev/null +++ b/tests/travis/create-mysql-schema.sql @@ -0,0 +1,7 @@ +CREATE SCHEMA doctrine_tests; +CREATE SCHEMA test_create_database; +CREATE SCHEMA test_drop_database; + +GRANT ALL PRIVILEGES ON doctrine_tests.* to travis@'%'; +GRANT ALL PRIVILEGES ON test_create_database.* to travis@'%'; +GRANT ALL PRIVILEGES ON test_drop_database.* to travis@'%'; From 5ad704e9be92e8a62a613f13fa7eb6d23aec7f3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lu=C3=ADs=20Cobucci?= Date: Fri, 8 Sep 2017 08:33:13 -0300 Subject: [PATCH 2/5] Upgrade to PHPUnit 6.3 --- composer.json | 2 +- phpunit.xml.dist | 11 +++-- tests/Doctrine/Tests/DBAL/ConnectionTest.php | 17 +++++--- .../Doctrine/Tests/DBAL/DriverManagerTest.php | 11 +++-- .../InvalidArgumentExceptionTest.php | 3 +- .../Tests/DBAL/Functional/ConnectionTest.php | 15 ++++--- .../Tests/DBAL/Functional/ExceptionTest.php | 43 +++++++++---------- .../DBAL/Functional/Ticket/DBAL461Test.php | 2 +- .../Platforms/AbstractPlatformTestCase.php | 14 +++--- .../DBAL/Platforms/OraclePlatformTest.php | 2 +- .../Platforms/SQLAnywhere16PlatformTest.php | 2 +- .../Platforms/SQLAnywherePlatformTest.php | 26 +++++------ .../Tests/DBAL/Query/QueryBuilderTest.php | 4 +- .../Tests/DBAL/SQLParserUtilsTest.php | 4 +- .../Tests/DBAL/Schema/ColumnDiffTest.php | 2 +- .../Doctrine/Tests/DBAL/Schema/ColumnTest.php | 4 +- .../Tests/DBAL/Schema/ComparatorTest.php | 2 +- .../DBAL/Schema/DB2SchemaManagerTest.php | 2 +- .../DBAL/Schema/ForeignKeyConstraintTest.php | 2 +- .../Doctrine/Tests/DBAL/Schema/IndexTest.php | 2 +- .../DBAL/Schema/MySqlSchemaManagerTest.php | 2 +- .../DBAL/Schema/Platforms/MySQLSchemaTest.php | 4 +- .../Schema/PostgreSQLSchemaManagerTest.php | 2 +- .../Tests/DBAL/Schema/SchemaDiffTest.php | 2 +- .../Doctrine/Tests/DBAL/Schema/SchemaTest.php | 10 ++--- .../DBAL/Schema/SqliteSchemaManagerTest.php | 2 +- .../SingleDatabaseSynchronizerTest.php | 2 +- .../Tests/DBAL/Schema/TableDiffTest.php | 2 +- .../Doctrine/Tests/DBAL/Schema/TableTest.php | 20 ++++----- .../Visitor/CreateSchemaSqlCollectorTest.php | 2 +- .../Visitor/DropSchemaSqlCollectorTest.php | 4 +- .../Visitor/RemoveNamespacedAssetsTest.php | 2 +- .../Schema/Visitor/SchemaSqlCollectorTest.php | 2 +- .../Sharding/PoolingShardConnectionTest.php | 18 ++++---- .../DBAL/Sharding/PoolingShardManagerTest.php | 2 +- .../Sharding/SQLAzure/AbstractTestCase.php | 2 +- .../SQLAzure/MultiTenantVisitorTest.php | 2 +- .../SQLAzure/SQLAzureShardManagerTest.php | 14 +++--- .../MultiTenantShardChoserTest.php | 2 +- .../DBAL/Tools/Console/RunSqlCommandTest.php | 2 +- tests/Doctrine/Tests/DBAL/Types/ArrayTest.php | 2 +- .../Tests/DBAL/Types/BaseDateTypeTestCase.php | 5 +-- .../DBAL/Types/ConversionExceptionTest.php | 3 +- .../DBAL/Types/DateImmutableTypeTest.php | 2 +- .../Tests/DBAL/Types/DateIntervalTest.php | 4 +- tests/Doctrine/Tests/DBAL/Types/DateTest.php | 2 +- .../DBAL/Types/DateTimeImmutableTypeTest.php | 2 +- .../Tests/DBAL/Types/DateTimeTest.php | 2 +- .../Types/DateTimeTzImmutableTypeTest.php | 2 +- .../Tests/DBAL/Types/DateTimeTzTest.php | 2 +- tests/Doctrine/Tests/DBAL/Types/JsonTest.php | 2 +- .../Doctrine/Tests/DBAL/Types/ObjectTest.php | 2 +- .../DBAL/Types/TimeImmutableTypeTest.php | 2 +- tests/Doctrine/Tests/DBAL/Types/TimeTest.php | 2 +- .../Types/VarDateTimeImmutableTypeTest.php | 2 +- .../Tests/DBAL/Types/VarDateTimeTest.php | 2 +- .../Doctrine/Tests/DbalFunctionalTestCase.php | 14 +++--- .../Tests/DbalPerformanceTestListener.php | 4 +- tests/Doctrine/Tests/DbalTestCase.php | 2 +- tests/travis/mariadb.travis.xml | 9 ++-- tests/travis/mysql.travis.xml | 9 ++-- tests/travis/mysqli.travis.xml | 9 ++-- tests/travis/pgsql.travis.xml | 8 ++-- tests/travis/sqlite.travis.xml | 12 ++++-- 64 files changed, 196 insertions(+), 177 deletions(-) diff --git a/composer.json b/composer.json index 123d5f5e3c0..d36fc7b9348 100644 --- a/composer.json +++ b/composer.json @@ -17,7 +17,7 @@ "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" }, diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 69ac465c5df..cd75dcbce9a 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -12,10 +12,12 @@ Example: phpunit -c mysqlconf.xml --> @@ -30,7 +32,7 @@ --> - + @@ -49,6 +51,7 @@ ./tests/Doctrine/Tests/DBAL/Performance + diff --git a/tests/Doctrine/Tests/DBAL/ConnectionTest.php b/tests/Doctrine/Tests/DBAL/ConnectionTest.php index efc33b7c2b0..55ec93fe110 100644 --- a/tests/Doctrine/Tests/DBAL/ConnectionTest.php +++ b/tests/Doctrine/Tests/DBAL/ConnectionTest.php @@ -4,16 +4,18 @@ use Doctrine\Common\Cache\Cache; use Doctrine\Common\EventManager; +use Doctrine\DBAL\Cache\ArrayStatement; use Doctrine\DBAL\Cache\QueryCacheProfile; use Doctrine\DBAL\Configuration; use Doctrine\DBAL\Connection; +use Doctrine\DBAL\ConnectionException; use Doctrine\DBAL\DBALException; use Doctrine\DBAL\Driver; use Doctrine\DBAL\Events; +use Doctrine\DBAL\Exception\InvalidArgumentException; use Doctrine\DBAL\Platforms\AbstractPlatform; use Doctrine\Tests\Mocks\DriverConnectionMock; use Doctrine\Tests\Mocks\DriverMock; -use Doctrine\DBAL\Cache\ArrayStatement; use Doctrine\Tests\Mocks\VersionAwarePlatformDriverMock; class ConnectionTest extends \Doctrine\Tests\DbalTestCase @@ -64,25 +66,25 @@ public function testNoTransactionActiveByDefault() public function testCommitWithNoActiveTransaction_ThrowsException() { - $this->setExpectedException('Doctrine\DBAL\ConnectionException'); + $this->expectException(ConnectionException::class); $this->_conn->commit(); } public function testRollbackWithNoActiveTransaction_ThrowsException() { - $this->setExpectedException('Doctrine\DBAL\ConnectionException'); + $this->expectException(ConnectionException::class); $this->_conn->rollBack(); } public function testSetRollbackOnlyNoActiveTransaction_ThrowsException() { - $this->setExpectedException('Doctrine\DBAL\ConnectionException'); + $this->expectException(ConnectionException::class); $this->_conn->setRollbackOnly(); } public function testIsRollbackOnlyNoActiveTransaction_ThrowsException() { - $this->setExpectedException('Doctrine\DBAL\ConnectionException'); + $this->expectException(ConnectionException::class); $this->_conn->isRollbackOnly(); } @@ -156,7 +158,8 @@ public function testEventManagerPassedToPlatform() */ public function testDriverExceptionIsWrapped($method) { - $this->setExpectedException('Doctrine\DBAL\DBALException', "An exception occurred while executing 'MUUHAAAAHAAAA':\n\nSQLSTATE[HY000]: General error: 1 near \"MUUHAAAAHAAAA\""); + $this->expectException(DBALException::class); + $this->expectExceptionMessage("An exception occurred while executing 'MUUHAAAAHAAAA':\n\nSQLSTATE[HY000]: General error: 1 near \"MUUHAAAAHAAAA\""); $con = \Doctrine\DBAL\DriverManager::getConnection(array( 'driver' => 'pdo_sqlite', @@ -666,7 +669,7 @@ public function testCallingDeleteWithNoDeletionCriteriaResultsInInvalidArgumentE $conn = new Connection(array('pdo' => $pdoMock), $driver); - $this->setExpectedException('Doctrine\DBAL\Exception\InvalidArgumentException'); + $this->expectException(InvalidArgumentException::class); $conn->delete('kittens', array()); } diff --git a/tests/Doctrine/Tests/DBAL/DriverManagerTest.php b/tests/Doctrine/Tests/DBAL/DriverManagerTest.php index 76ebfffc073..d71d51c3b98 100644 --- a/tests/Doctrine/Tests/DBAL/DriverManagerTest.php +++ b/tests/Doctrine/Tests/DBAL/DriverManagerTest.php @@ -2,6 +2,9 @@ namespace Doctrine\Tests\DBAL; +use Doctrine\DBAL\DBALException; +use Doctrine\Tests\Mocks\PDOMock; + class DriverManagerTest extends \Doctrine\Tests\DbalTestCase { /** @@ -82,7 +85,7 @@ public function testCustomWrapper() public function testInvalidWrapperClass() { - $this->setExpectedException('\Doctrine\DBAL\DBALException'); + $this->expectException(DBALException::class); $options = array( 'pdo' => new \PDO('sqlite::memory:'), @@ -94,7 +97,7 @@ public function testInvalidWrapperClass() public function testInvalidDriverClass() { - $this->setExpectedException('\Doctrine\DBAL\DBALException'); + $this->expectException(DBALException::class); $options = array( 'driverClass' => 'stdClass' @@ -123,7 +126,7 @@ public function testDatabaseUrl($url, $expected) ); if ($expected === false) { - $this->setExpectedException('Doctrine\DBAL\DBALException'); + $this->expectException(DBALException::class); } $conn = \Doctrine\DBAL\DriverManager::getConnection($options); @@ -140,7 +143,7 @@ public function testDatabaseUrl($url, $expected) public function databaseUrls() { - $pdoMock = $this->getMock('Doctrine\Tests\Mocks\PDOMock'); + $pdoMock = $this->createMock(PDOMock::class); return array( 'simple URL' => array( diff --git a/tests/Doctrine/Tests/DBAL/Exception/InvalidArgumentExceptionTest.php b/tests/Doctrine/Tests/DBAL/Exception/InvalidArgumentExceptionTest.php index 79696a6faef..967f4551615 100644 --- a/tests/Doctrine/Tests/DBAL/Exception/InvalidArgumentExceptionTest.php +++ b/tests/Doctrine/Tests/DBAL/Exception/InvalidArgumentExceptionTest.php @@ -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,7 +28,7 @@ * * @author Marco Pivetta */ -class InvalidArgumentExceptionTest extends PHPUnit_Framework_TestCase +class InvalidArgumentExceptionTest extends \PHPUnit\Framework\TestCase { public function testFromEmptyCriteria() { diff --git a/tests/Doctrine/Tests/DBAL/Functional/ConnectionTest.php b/tests/Doctrine/Tests/DBAL/Functional/ConnectionTest.php index e4e230a1b0f..de9fee35f1a 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/ConnectionTest.php +++ b/tests/Doctrine/Tests/DBAL/Functional/ConnectionTest.php @@ -30,7 +30,8 @@ public function testCommitWithRollbackOnlyThrowsException() { $this->_conn->beginTransaction(); $this->_conn->setRollbackOnly(); - $this->setExpectedException('Doctrine\DBAL\ConnectionException'); + + $this->expectException(ConnectionException::class); $this->_conn->commit(); } @@ -121,7 +122,8 @@ public function testSetNestedTransactionsThroughSavepointsNotSupportedThrowsExce $this->markTestSkipped('This test requires the platform not to support savepoints.'); } - $this->setExpectedException('Doctrine\DBAL\ConnectionException', "Savepoints are not supported by this driver."); + $this->expectException(ConnectionException::class); + $this->expectExceptionMessage("Savepoints are not supported by this driver."); $this->_conn->setNestTransactionsWithSavepoints(true); } @@ -132,7 +134,8 @@ public function testCreateSavepointsNotSupportedThrowsException() $this->markTestSkipped('This test requires the platform not to support savepoints.'); } - $this->setExpectedException('Doctrine\DBAL\ConnectionException', "Savepoints are not supported by this driver."); + $this->expectException(ConnectionException::class); + $this->expectExceptionMessage("Savepoints are not supported by this driver."); $this->_conn->createSavepoint('foo'); } @@ -143,7 +146,8 @@ public function testReleaseSavepointsNotSupportedThrowsException() $this->markTestSkipped('This test requires the platform not to support savepoints.'); } - $this->setExpectedException('Doctrine\DBAL\ConnectionException', "Savepoints are not supported by this driver."); + $this->expectException(ConnectionException::class); + $this->expectExceptionMessage("Savepoints are not supported by this driver."); $this->_conn->releaseSavepoint('foo'); } @@ -154,7 +158,8 @@ public function testRollbackSavepointsNotSupportedThrowsException() $this->markTestSkipped('This test requires the platform not to support savepoints.'); } - $this->setExpectedException('Doctrine\DBAL\ConnectionException', "Savepoints are not supported by this driver."); + $this->expectException(ConnectionException::class); + $this->expectExceptionMessage("Savepoints are not supported by this driver."); $this->_conn->rollbackSavepoint('foo'); } diff --git a/tests/Doctrine/Tests/DBAL/Functional/ExceptionTest.php b/tests/Doctrine/Tests/DBAL/Functional/ExceptionTest.php index f2af434ad45..12af0e1cf85 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/ExceptionTest.php +++ b/tests/Doctrine/Tests/DBAL/Functional/ExceptionTest.php @@ -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 @@ public function testPrimaryConstraintViolationException() $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 @@ public function testTableNotFoundException() { $sql = "SELECT * FROM unknown_table"; - $this->setExpectedException('\Doctrine\DBAL\Exception\TableNotFoundException'); + $this->expectException(Exception\TableNotFoundException::class); $this->_conn->executeQuery($sql); } @@ -46,7 +45,7 @@ public function testTableExistsException() $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 @@ public function testForeignKeyConstraintViolationExceptionOnInsert() 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 @@ public function testForeignKeyConstraintViolationExceptionOnUpdate() 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 @@ public function testForeignKeyConstraintViolationExceptionOnDelete() 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 @@ public function testForeignKeyConstraintViolationExceptionOnTruncate() 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 @@ public function testNotNullConstraintViolationException() $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 @@ public function testInvalidFieldNameException() $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 @@ public function testNonUniqueFieldNameException() } $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 @@ public function testUniqueConstraintViolationException() } $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 @@ public function testSyntaxErrorException() $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 @@ public function testConnectionExceptionSqLite($mode, $exceptionClass) $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 @@ public function getSqLiteOpenConnection() { 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 @@ public function testConnectionException($params) $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); diff --git a/tests/Doctrine/Tests/DBAL/Functional/Ticket/DBAL461Test.php b/tests/Doctrine/Tests/DBAL/Functional/Ticket/DBAL461Test.php index 3d5c323728c..70bbe2f58c6 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/Ticket/DBAL461Test.php +++ b/tests/Doctrine/Tests/DBAL/Functional/Ticket/DBAL461Test.php @@ -7,7 +7,7 @@ /** * @group DBAL-461 */ -class DBAL461Test extends \PHPUnit_Framework_TestCase +class DBAL461Test extends \PHPUnit\Framework\TestCase { public function testIssue() { diff --git a/tests/Doctrine/Tests/DBAL/Platforms/AbstractPlatformTestCase.php b/tests/Doctrine/Tests/DBAL/Platforms/AbstractPlatformTestCase.php index 5242e07f784..a3b0ded7747 100644 --- a/tests/Doctrine/Tests/DBAL/Platforms/AbstractPlatformTestCase.php +++ b/tests/Doctrine/Tests/DBAL/Platforms/AbstractPlatformTestCase.php @@ -86,13 +86,13 @@ public function getReturnsForeignKeyReferentialActionSQL() public function testGetInvalidForeignKeyReferentialActionSQL() { - $this->setExpectedException('InvalidArgumentException'); + $this->expectException('InvalidArgumentException'); $this->_platform->getForeignKeyReferentialActionSQL('unknown'); } public function testGetUnknownDoctrineMappingType() { - $this->setExpectedException('Doctrine\DBAL\DBALException'); + $this->expectException('Doctrine\DBAL\DBALException'); $this->_platform->getDoctrineTypeMapping('foobar'); } @@ -104,7 +104,7 @@ public function testRegisterDoctrineMappingType() public function testRegisterUnknownDoctrineMappingType() { - $this->setExpectedException('Doctrine\DBAL\DBALException'); + $this->expectException('Doctrine\DBAL\DBALException'); $this->_platform->registerDoctrineTypeMapping('foo', 'bar'); } @@ -155,7 +155,7 @@ public function testCreateWithNoColumns() { $table = new Table('test'); - $this->setExpectedException('Doctrine\DBAL\DBALException'); + $this->expectException('Doctrine\DBAL\DBALException'); $sql = $this->_platform->getCreateTableSQL($table); } @@ -268,7 +268,7 @@ public function testGeneratesForeignKeySqlOnlyWhenSupportingForeignKeys() $this->_platform->getCreateForeignKeySQL($fk, 'test') ); } else { - $this->setExpectedException('Doctrine\DBAL\DBALException'); + $this->expectException('Doctrine\DBAL\DBALException'); $this->_platform->getCreateForeignKeySQL($fk, 'test'); } } @@ -695,7 +695,7 @@ public function testQuotesReservedKeywordInIndexDeclarationSQL() $index = new Index('select', array('foo')); if (! $this->supportsInlineIndexDeclaration()) { - $this->setExpectedException('Doctrine\DBAL\DBALException'); + $this->expectException('Doctrine\DBAL\DBALException'); } $this->assertSame( @@ -1225,7 +1225,7 @@ public function testThrowsExceptionOnGeneratingInlineColumnCommentSQLIfUnsupport $this->markTestSkipped(sprintf('%s supports inline column comments.', get_class($this->_platform))); } - $this->setExpectedException( + $this->expectException( 'Doctrine\DBAL\DBALException', "Operation 'Doctrine\\DBAL\\Platforms\\AbstractPlatform::getInlineColumnCommentSQL' is not supported by platform.", 0 diff --git a/tests/Doctrine/Tests/DBAL/Platforms/OraclePlatformTest.php b/tests/Doctrine/Tests/DBAL/Platforms/OraclePlatformTest.php index 7f54557a8c5..15a5870a936 100644 --- a/tests/Doctrine/Tests/DBAL/Platforms/OraclePlatformTest.php +++ b/tests/Doctrine/Tests/DBAL/Platforms/OraclePlatformTest.php @@ -51,7 +51,7 @@ public static function dataInvalidIdentifiers() */ public function testInvalidIdentifiers($identifier) { - $this->setExpectedException('Doctrine\DBAL\DBALException'); + $this->expectException('Doctrine\DBAL\DBALException'); $platform = $this->createPlatform(); $platform->assertValidIdentifier($identifier); } diff --git a/tests/Doctrine/Tests/DBAL/Platforms/SQLAnywhere16PlatformTest.php b/tests/Doctrine/Tests/DBAL/Platforms/SQLAnywhere16PlatformTest.php index 1d0eba07a30..0d4efb17431 100644 --- a/tests/Doctrine/Tests/DBAL/Platforms/SQLAnywhere16PlatformTest.php +++ b/tests/Doctrine/Tests/DBAL/Platforms/SQLAnywhere16PlatformTest.php @@ -63,7 +63,7 @@ public function testGeneratesCreateIndexWithAdvancedPlatformOptionsSQL() public function testThrowsExceptionOnInvalidWithNullsNotDistinctIndexOptions() { - $this->setExpectedException('UnexpectedValueException'); + $this->expectException('UnexpectedValueException'); $this->_platform->getCreateIndexSQL( new Index( diff --git a/tests/Doctrine/Tests/DBAL/Platforms/SQLAnywherePlatformTest.php b/tests/Doctrine/Tests/DBAL/Platforms/SQLAnywherePlatformTest.php index f2605c4f5a1..5fe5a2e6acb 100644 --- a/tests/Doctrine/Tests/DBAL/Platforms/SQLAnywherePlatformTest.php +++ b/tests/Doctrine/Tests/DBAL/Platforms/SQLAnywherePlatformTest.php @@ -340,7 +340,7 @@ public function testGeneratesPrimaryKeyDeclarationSQL() public function testCannotGeneratePrimaryKeyDeclarationSQLWithEmptyColumns() { - $this->setExpectedException('\InvalidArgumentException'); + $this->expectException('\InvalidArgumentException'); $this->_platform->getPrimaryKeyDeclarationSQL(new Index('pk', array(), true, true)); } @@ -380,7 +380,7 @@ public function testGeneratesUniqueConstraintDeclarationSQL() public function testCannotGenerateUniqueConstraintDeclarationSQLWithEmptyColumns() { - $this->setExpectedException('\InvalidArgumentException'); + $this->expectException('\InvalidArgumentException'); $this->_platform->getUniqueConstraintDeclarationSQL('constr', new Index('constr', array(), true)); } @@ -422,39 +422,39 @@ public function testGeneratesForeignKeyMatchClausesSQL() public function testCannotGenerateInvalidForeignKeyMatchClauseSQL() { - $this->setExpectedException('\InvalidArgumentException'); + $this->expectException('\InvalidArgumentException'); $this->_platform->getForeignKeyMatchCLauseSQL(3); } public function testCannotGenerateForeignKeyConstraintSQLWithEmptyLocalColumns() { - $this->setExpectedException('\InvalidArgumentException'); + $this->expectException('\InvalidArgumentException'); $this->_platform->getForeignKeyDeclarationSQL(new ForeignKeyConstraint(array(), 'foreign_tbl', array('c', 'd'))); } public function testCannotGenerateForeignKeyConstraintSQLWithEmptyForeignColumns() { - $this->setExpectedException('\InvalidArgumentException'); + $this->expectException('\InvalidArgumentException'); $this->_platform->getForeignKeyDeclarationSQL(new ForeignKeyConstraint(array('a', 'b'), 'foreign_tbl', array())); } public function testCannotGenerateForeignKeyConstraintSQLWithEmptyForeignTableName() { - $this->setExpectedException('\InvalidArgumentException'); + $this->expectException('\InvalidArgumentException'); $this->_platform->getForeignKeyDeclarationSQL(new ForeignKeyConstraint(array('a', 'b'), '', array('c', 'd'))); } public function testCannotGenerateCommonIndexWithCreateConstraintSQL() { - $this->setExpectedException('\InvalidArgumentException'); + $this->expectException('\InvalidArgumentException'); $this->_platform->getCreateConstraintSQL(new Index('fooindex', array()), new Table('footable')); } public function testCannotGenerateCustomConstraintWithCreateConstraintSQL() { - $this->setExpectedException('\InvalidArgumentException'); + $this->expectException('\InvalidArgumentException'); $this->_platform->getCreateConstraintSQL($this->createMock('\Doctrine\DBAL\Schema\Constraint'), 'footable'); } @@ -478,7 +478,7 @@ public function testGeneratesCreateIndexWithAdvancedPlatformOptionsSQL() public function testDoesNotSupportIndexDeclarationInCreateAlterTableStatements() { - $this->setExpectedException('\Doctrine\DBAL\DBALException'); + $this->expectException('\Doctrine\DBAL\DBALException'); $this->_platform->getIndexDeclarationSQL('index', new Index('index', array())); } @@ -497,14 +497,14 @@ public function testGeneratesDropIndexSQL() public function testCannotGenerateDropIndexSQLWithInvalidIndexParameter() { - $this->setExpectedException('\InvalidArgumentException'); + $this->expectException('\InvalidArgumentException'); $this->_platform->getDropIndexSQL(array('index'), 'table'); } public function testCannotGenerateDropIndexSQLWithInvalidTableParameter() { - $this->setExpectedException('\InvalidArgumentException'); + $this->expectException('\InvalidArgumentException'); $this->_platform->getDropIndexSQL('index', array('table')); } @@ -585,7 +585,7 @@ public function testGeneratesSQLSnippets() public function testDoesNotSupportRegexp() { - $this->setExpectedException('\Doctrine\DBAL\DBALException'); + $this->expectException('\Doctrine\DBAL\DBALException'); $this->_platform->getRegexpExpression(); } @@ -628,7 +628,7 @@ public function testGeneratesTransactionsCommands() public function testCannotGenerateTransactionCommandWithInvalidIsolationLevel() { - $this->setExpectedException('\InvalidArgumentException'); + $this->expectException('\InvalidArgumentException'); $this->_platform->getSetTransactionIsolationSQL('invalid_transaction_isolation_level'); } diff --git a/tests/Doctrine/Tests/DBAL/Query/QueryBuilderTest.php b/tests/Doctrine/Tests/DBAL/Query/QueryBuilderTest.php index ae44684db7a..0569d4fd696 100644 --- a/tests/Doctrine/Tests/DBAL/Query/QueryBuilderTest.php +++ b/tests/Doctrine/Tests/DBAL/Query/QueryBuilderTest.php @@ -648,7 +648,7 @@ public function testReferenceJoinFromJoin() ->innerJoin('nt', 'node', 'n', 'nt.node = n.id') ->where('nt.lang = :lang AND n.deleted != 1'); - $this->setExpectedException('Doctrine\DBAL\Query\QueryException', "The given alias 'invalid' is not part of any FROM or JOIN clause table. The currently registered aliases are: news, nv."); + $this->expectException('Doctrine\DBAL\Query\QueryException', "The given alias 'invalid' is not part of any FROM or JOIN clause table. The currently registered aliases are: news, nv."); $this->assertEquals('', $qb->getSQL()); } @@ -887,7 +887,7 @@ public function testJoinWithNonUniqueAliasThrowsException() ->from('table_a', 'a') ->join('a', 'table_b', 'a', 'a.fk_b = a.id'); - $this->setExpectedException( + $this->expectException( 'Doctrine\DBAL\Query\QueryException', "The given alias 'a' is not unique in FROM and JOIN clause table. The currently registered aliases are: a." ); diff --git a/tests/Doctrine/Tests/DBAL/SQLParserUtilsTest.php b/tests/Doctrine/Tests/DBAL/SQLParserUtilsTest.php index dae359af49b..00c72ddf101 100644 --- a/tests/Doctrine/Tests/DBAL/SQLParserUtilsTest.php +++ b/tests/Doctrine/Tests/DBAL/SQLParserUtilsTest.php @@ -72,7 +72,7 @@ public function dataGetPlaceholderPositions() array('SELECT data.age AS age, data.id AS id, data.name AS name, data.id AS id FROM test_data data WHERE (data.description LIKE :condition_0 ESCAPE "\\\\") AND (data.description LIKE :condition_1 ESCAPE \'\\\\\') ORDER BY id ASC', false, array(121 => 'condition_0', 174 => 'condition_1')), array('SELECT data.age AS age, data.id AS id, data.name AS name, data.id AS id FROM test_data data WHERE (data.description LIKE :condition_0 ESCAPE `\\\\`) AND (data.description LIKE :condition_1 ESCAPE `\\\\`) ORDER BY id ASC', false, array(121 => 'condition_0', 174 => 'condition_1')), array('SELECT data.age AS age, data.id AS id, data.name AS name, data.id AS id FROM test_data data WHERE (data.description LIKE :condition_0 ESCAPE \'\\\\\') AND (data.description LIKE :condition_1 ESCAPE `\\\\`) ORDER BY id ASC', false, array(121 => 'condition_0', 174 => 'condition_1')), - + ); } @@ -419,7 +419,7 @@ public function dataQueryWithMissingParameters() */ public function testExceptionIsThrownForMissingParam($query, $params, $types = array()) { - $this->setExpectedException( + $this->expectException( 'Doctrine\DBAL\SQLParserUtilsException', 'Value for :param not found in params array. Params array key should be "param"' ); diff --git a/tests/Doctrine/Tests/DBAL/Schema/ColumnDiffTest.php b/tests/Doctrine/Tests/DBAL/Schema/ColumnDiffTest.php index f2d8d2143af..90a17d84fc2 100644 --- a/tests/Doctrine/Tests/DBAL/Schema/ColumnDiffTest.php +++ b/tests/Doctrine/Tests/DBAL/Schema/ColumnDiffTest.php @@ -6,7 +6,7 @@ use Doctrine\DBAL\Schema\ColumnDiff; use Doctrine\DBAL\Types\Type; -class ColumnDiffTest extends \PHPUnit_Framework_TestCase +class ColumnDiffTest extends \PHPUnit\Framework\TestCase { /** * @group DBAL-1255 diff --git a/tests/Doctrine/Tests/DBAL/Schema/ColumnTest.php b/tests/Doctrine/Tests/DBAL/Schema/ColumnTest.php index 04f3bc879bb..4b11ab56edf 100644 --- a/tests/Doctrine/Tests/DBAL/Schema/ColumnTest.php +++ b/tests/Doctrine/Tests/DBAL/Schema/ColumnTest.php @@ -5,7 +5,7 @@ use Doctrine\DBAL\Schema\Column; use Doctrine\DBAL\Types\Type; -class ColumnTest extends \PHPUnit_Framework_TestCase +class ColumnTest extends \PHPUnit\Framework\TestCase { public function testGet() { @@ -137,4 +137,4 @@ public function testColumnComment() $this->assertArrayHasKey('comment', $columnArray); $this->assertEquals('foo', $columnArray['comment']); } -} \ No newline at end of file +} diff --git a/tests/Doctrine/Tests/DBAL/Schema/ComparatorTest.php b/tests/Doctrine/Tests/DBAL/Schema/ComparatorTest.php index d9ee037715d..eb7fbf36a4d 100644 --- a/tests/Doctrine/Tests/DBAL/Schema/ComparatorTest.php +++ b/tests/Doctrine/Tests/DBAL/Schema/ComparatorTest.php @@ -41,7 +41,7 @@ * @version $Revision$ * @author Benjamin Eberlei */ -class ComparatorTest extends \PHPUnit_Framework_TestCase +class ComparatorTest extends \PHPUnit\Framework\TestCase { public function testCompareSame1() { diff --git a/tests/Doctrine/Tests/DBAL/Schema/DB2SchemaManagerTest.php b/tests/Doctrine/Tests/DBAL/Schema/DB2SchemaManagerTest.php index d524afe9c45..001280eddad 100644 --- a/tests/Doctrine/Tests/DBAL/Schema/DB2SchemaManagerTest.php +++ b/tests/Doctrine/Tests/DBAL/Schema/DB2SchemaManagerTest.php @@ -12,7 +12,7 @@ /** * @covers \Doctrine\DBAL\Schema\DB2SchemaManager */ -final class DB2SchemaManagerTest extends \PHPUnit_Framework_TestCase +final class DB2SchemaManagerTest extends \PHPUnit\Framework\TestCase { /** * @var Connection|\PHPUnit_Framework_MockObject_MockObject diff --git a/tests/Doctrine/Tests/DBAL/Schema/ForeignKeyConstraintTest.php b/tests/Doctrine/Tests/DBAL/Schema/ForeignKeyConstraintTest.php index 6bae18c378c..8fff59cfd63 100644 --- a/tests/Doctrine/Tests/DBAL/Schema/ForeignKeyConstraintTest.php +++ b/tests/Doctrine/Tests/DBAL/Schema/ForeignKeyConstraintTest.php @@ -4,7 +4,7 @@ use Doctrine\DBAL\Schema\ForeignKeyConstraint; -class ForeignKeyConstraintTest extends \PHPUnit_Framework_TestCase +class ForeignKeyConstraintTest extends \PHPUnit\Framework\TestCase { /** * @group DBAL-1062 diff --git a/tests/Doctrine/Tests/DBAL/Schema/IndexTest.php b/tests/Doctrine/Tests/DBAL/Schema/IndexTest.php index 088905dcb62..65c6f09a90c 100644 --- a/tests/Doctrine/Tests/DBAL/Schema/IndexTest.php +++ b/tests/Doctrine/Tests/DBAL/Schema/IndexTest.php @@ -4,7 +4,7 @@ use Doctrine\DBAL\Schema\Index; -class IndexTest extends \PHPUnit_Framework_TestCase +class IndexTest extends \PHPUnit\Framework\TestCase { public function createIndex($unique = false, $primary = false, $options = array()) { diff --git a/tests/Doctrine/Tests/DBAL/Schema/MySqlSchemaManagerTest.php b/tests/Doctrine/Tests/DBAL/Schema/MySqlSchemaManagerTest.php index cd3887922d9..5e4361d4041 100644 --- a/tests/Doctrine/Tests/DBAL/Schema/MySqlSchemaManagerTest.php +++ b/tests/Doctrine/Tests/DBAL/Schema/MySqlSchemaManagerTest.php @@ -6,7 +6,7 @@ use Doctrine\DBAL\Configuration; use Doctrine\DBAL\Schema\MySqlSchemaManager; -class MySqlSchemaManagerTest extends \PHPUnit_Framework_TestCase +class MySqlSchemaManagerTest extends \PHPUnit\Framework\TestCase { /** * diff --git a/tests/Doctrine/Tests/DBAL/Schema/Platforms/MySQLSchemaTest.php b/tests/Doctrine/Tests/DBAL/Schema/Platforms/MySQLSchemaTest.php index 43589485c38..d4f06a38b0c 100644 --- a/tests/Doctrine/Tests/DBAL/Schema/Platforms/MySQLSchemaTest.php +++ b/tests/Doctrine/Tests/DBAL/Schema/Platforms/MySQLSchemaTest.php @@ -4,7 +4,7 @@ use Doctrine\DBAL\Schema\Table; -class MySQLSchemaTest extends \PHPUnit_Framework_TestCase +class MySQLSchemaTest extends \PHPUnit\Framework\TestCase { /** * @var Comparator @@ -80,4 +80,4 @@ public function testClobNoAlterTable() $sql ); } -} \ No newline at end of file +} diff --git a/tests/Doctrine/Tests/DBAL/Schema/PostgreSQLSchemaManagerTest.php b/tests/Doctrine/Tests/DBAL/Schema/PostgreSQLSchemaManagerTest.php index 42d21551ed3..010c35e4b7e 100644 --- a/tests/Doctrine/Tests/DBAL/Schema/PostgreSQLSchemaManagerTest.php +++ b/tests/Doctrine/Tests/DBAL/Schema/PostgreSQLSchemaManagerTest.php @@ -6,7 +6,7 @@ use Doctrine\DBAL\Schema\PostgreSqlSchemaManager; use Doctrine\DBAL\Schema\Sequence; -class PostgreSQLSchemaManagerTest extends \PHPUnit_Framework_TestCase +class PostgreSQLSchemaManagerTest extends \PHPUnit\Framework\TestCase { /** * @var \Doctrine\DBAL\Schema\PostgreSQLSchemaManager diff --git a/tests/Doctrine/Tests/DBAL/Schema/SchemaDiffTest.php b/tests/Doctrine/Tests/DBAL/Schema/SchemaDiffTest.php index aee0657cf19..e0776f6eea5 100644 --- a/tests/Doctrine/Tests/DBAL/Schema/SchemaDiffTest.php +++ b/tests/Doctrine/Tests/DBAL/Schema/SchemaDiffTest.php @@ -7,7 +7,7 @@ use Doctrine\DBAL\Schema\Table; use Doctrine\DBAL\Schema\TableDiff; -class SchemaDiffTest extends \PHPUnit_Framework_TestCase +class SchemaDiffTest extends \PHPUnit\Framework\TestCase { public function testSchemaDiffToSql() { diff --git a/tests/Doctrine/Tests/DBAL/Schema/SchemaTest.php b/tests/Doctrine/Tests/DBAL/Schema/SchemaTest.php index a939cdb471a..ddfdf16b7d3 100644 --- a/tests/Doctrine/Tests/DBAL/Schema/SchemaTest.php +++ b/tests/Doctrine/Tests/DBAL/Schema/SchemaTest.php @@ -6,7 +6,7 @@ use Doctrine\DBAL\Schema\Sequence; use Doctrine\DBAL\Schema\Table; -class SchemaTest extends \PHPUnit_Framework_TestCase +class SchemaTest extends \PHPUnit\Framework\TestCase { public function testAddTable() { @@ -39,7 +39,7 @@ public function testTableMatchingCaseInsensitive() public function testGetUnknownTableThrowsException() { - $this->setExpectedException("Doctrine\DBAL\Schema\SchemaException"); + $this->expectException("Doctrine\DBAL\Schema\SchemaException"); $schema = new Schema(); $schema->getTable("unknown"); @@ -47,7 +47,7 @@ public function testGetUnknownTableThrowsException() public function testCreateTableTwiceThrowsException() { - $this->setExpectedException("Doctrine\DBAL\Schema\SchemaException"); + $this->expectException("Doctrine\DBAL\Schema\SchemaException"); $tableName = "foo"; $table = new Table($tableName); @@ -124,7 +124,7 @@ public function testSequenceAccessCaseInsensitive() public function testGetUnknownSequenceThrowsException() { - $this->setExpectedException("Doctrine\DBAL\Schema\SchemaException"); + $this->expectException("Doctrine\DBAL\Schema\SchemaException"); $schema = new Schema(); $schema->getSequence("unknown"); @@ -158,7 +158,7 @@ public function testDropSequence() public function testAddSequenceTwiceThrowsException() { - $this->setExpectedException("Doctrine\DBAL\Schema\SchemaException"); + $this->expectException("Doctrine\DBAL\Schema\SchemaException"); $sequence = new Sequence("a_seq", 1, 1); diff --git a/tests/Doctrine/Tests/DBAL/Schema/SqliteSchemaManagerTest.php b/tests/Doctrine/Tests/DBAL/Schema/SqliteSchemaManagerTest.php index 69ff9516a0c..2ef6b244b69 100644 --- a/tests/Doctrine/Tests/DBAL/Schema/SqliteSchemaManagerTest.php +++ b/tests/Doctrine/Tests/DBAL/Schema/SqliteSchemaManagerTest.php @@ -5,7 +5,7 @@ use Doctrine\DBAL\Platforms\SqlitePlatform; use Doctrine\DBAL\Schema\SqliteSchemaManager; -class SqliteSchemaManagerTest extends \PHPUnit_Framework_TestCase +class SqliteSchemaManagerTest extends \PHPUnit\Framework\TestCase { /** diff --git a/tests/Doctrine/Tests/DBAL/Schema/Synchronizer/SingleDatabaseSynchronizerTest.php b/tests/Doctrine/Tests/DBAL/Schema/Synchronizer/SingleDatabaseSynchronizerTest.php index 8dbc65d469a..b01ab85deff 100644 --- a/tests/Doctrine/Tests/DBAL/Schema/Synchronizer/SingleDatabaseSynchronizerTest.php +++ b/tests/Doctrine/Tests/DBAL/Schema/Synchronizer/SingleDatabaseSynchronizerTest.php @@ -23,7 +23,7 @@ use Doctrine\DBAL\Schema\Schema; use Doctrine\DBAL\Schema\Synchronizer\SingleDatabaseSynchronizer; -class SingleDatabaseSynchronizerTest extends \PHPUnit_Framework_TestCase +class SingleDatabaseSynchronizerTest extends \PHPUnit\Framework\TestCase { private $conn; private $synchronizer; diff --git a/tests/Doctrine/Tests/DBAL/Schema/TableDiffTest.php b/tests/Doctrine/Tests/DBAL/Schema/TableDiffTest.php index ecd7a0f50ed..239038ea8ad 100644 --- a/tests/Doctrine/Tests/DBAL/Schema/TableDiffTest.php +++ b/tests/Doctrine/Tests/DBAL/Schema/TableDiffTest.php @@ -6,7 +6,7 @@ use Doctrine\DBAL\Schema\TableDiff; use Doctrine\Tests\DBAL\Mocks\MockPlatform; -class TableDiffTest extends \PHPUnit_Framework_TestCase +class TableDiffTest extends \PHPUnit\Framework\TestCase { /** * @group DBAL-1013 diff --git a/tests/Doctrine/Tests/DBAL/Schema/TableTest.php b/tests/Doctrine/Tests/DBAL/Schema/TableTest.php index 709f72018d4..147e4de33b8 100644 --- a/tests/Doctrine/Tests/DBAL/Schema/TableTest.php +++ b/tests/Doctrine/Tests/DBAL/Schema/TableTest.php @@ -12,7 +12,7 @@ class TableTest extends \Doctrine\Tests\DbalTestCase { public function testCreateWithInvalidTableName() { - $this->setExpectedException('Doctrine\DBAL\DBALException'); + $this->expectException('Doctrine\DBAL\DBALException'); $table = new \Doctrine\DBAL\Schema\Table(''); } @@ -85,7 +85,7 @@ public function testDropColumn() public function testGetUnknownColumnThrowsException() { - $this->setExpectedException("Doctrine\DBAL\Schema\SchemaException"); + $this->expectException("Doctrine\DBAL\Schema\SchemaException"); $table = new Table("foo", array(), array(), array()); $table->getColumn('unknown'); @@ -93,7 +93,7 @@ public function testGetUnknownColumnThrowsException() public function testAddColumnTwiceThrowsException() { - $this->setExpectedException("Doctrine\DBAL\Schema\SchemaException"); + $this->expectException("Doctrine\DBAL\Schema\SchemaException"); $type = \Doctrine\DBAL\Types\Type::getType('integer'); $columns = array(); @@ -156,7 +156,7 @@ public function testAddIndexes() public function testGetUnknownIndexThrowsException() { - $this->setExpectedException("Doctrine\DBAL\Schema\SchemaException"); + $this->expectException("Doctrine\DBAL\Schema\SchemaException"); $table = new Table("foo", array(), array(), array()); $table->getIndex("unknownIndex"); @@ -164,7 +164,7 @@ public function testGetUnknownIndexThrowsException() public function testAddTwoPrimaryThrowsException() { - $this->setExpectedException("Doctrine\DBAL\Schema\SchemaException"); + $this->expectException("Doctrine\DBAL\Schema\SchemaException"); $type = \Doctrine\DBAL\Types\Type::getType('integer'); $columns = array(new Column("foo", $type), new Column("bar", $type)); @@ -177,7 +177,7 @@ public function testAddTwoPrimaryThrowsException() public function testAddTwoIndexesWithSameNameThrowsException() { - $this->setExpectedException("Doctrine\DBAL\Schema\SchemaException"); + $this->expectException("Doctrine\DBAL\Schema\SchemaException"); $type = \Doctrine\DBAL\Types\Type::getType('integer'); $columns = array(new Column("foo", $type), new Column("bar", $type)); @@ -246,7 +246,7 @@ public function testBuilderAddIndex() public function testBuilderAddIndexWithInvalidNameThrowsException() { - $this->setExpectedException("Doctrine\DBAL\Schema\SchemaException"); + $this->expectException("Doctrine\DBAL\Schema\SchemaException"); $table = new Table("foo"); $table->addColumn("bar",'integer'); @@ -255,7 +255,7 @@ public function testBuilderAddIndexWithInvalidNameThrowsException() public function testBuilderAddIndexWithUnknownColumnThrowsException() { - $this->setExpectedException("Doctrine\DBAL\Schema\SchemaException"); + $this->expectException("Doctrine\DBAL\Schema\SchemaException"); $table = new Table("foo"); $table->addIndex(array("bar"), "invalidName"); @@ -271,7 +271,7 @@ public function testBuilderOptions() public function testAddForeignKeyConstraint_UnknownLocalColumn_ThrowsException() { - $this->setExpectedException("Doctrine\DBAL\Schema\SchemaException"); + $this->expectException("Doctrine\DBAL\Schema\SchemaException"); $table = new Table("foo"); $table->addColumn("id", 'integer'); @@ -284,7 +284,7 @@ public function testAddForeignKeyConstraint_UnknownLocalColumn_ThrowsException() public function testAddForeignKeyConstraint_UnknownForeignColumn_ThrowsException() { - $this->setExpectedException("Doctrine\DBAL\Schema\SchemaException"); + $this->expectException("Doctrine\DBAL\Schema\SchemaException"); $table = new Table("foo"); $table->addColumn("id", 'integer'); diff --git a/tests/Doctrine/Tests/DBAL/Schema/Visitor/CreateSchemaSqlCollectorTest.php b/tests/Doctrine/Tests/DBAL/Schema/Visitor/CreateSchemaSqlCollectorTest.php index ea1352ceaf1..fba52392e2b 100644 --- a/tests/Doctrine/Tests/DBAL/Schema/Visitor/CreateSchemaSqlCollectorTest.php +++ b/tests/Doctrine/Tests/DBAL/Schema/Visitor/CreateSchemaSqlCollectorTest.php @@ -4,7 +4,7 @@ use \Doctrine\DBAL\Schema\Visitor\CreateSchemaSqlCollector; -class CreateSchemaSqlCollectorTest extends \PHPUnit_Framework_TestCase +class CreateSchemaSqlCollectorTest extends \PHPUnit\Framework\TestCase { /** * @var \Doctrine\DBAL\Platforms\AbstractPlatform|\PHPUnit_Framework_MockObject_MockObject diff --git a/tests/Doctrine/Tests/DBAL/Schema/Visitor/DropSchemaSqlCollectorTest.php b/tests/Doctrine/Tests/DBAL/Schema/Visitor/DropSchemaSqlCollectorTest.php index 20f17ac7d1b..20e20127f04 100644 --- a/tests/Doctrine/Tests/DBAL/Schema/Visitor/DropSchemaSqlCollectorTest.php +++ b/tests/Doctrine/Tests/DBAL/Schema/Visitor/DropSchemaSqlCollectorTest.php @@ -7,7 +7,7 @@ /** * @covers Doctrine\DBAL\Schema\Visitor\DropSchemaSqlCollector */ -class DropSchemaSqlCollectorTest extends \PHPUnit_Framework_TestCase +class DropSchemaSqlCollectorTest extends \PHPUnit\Framework\TestCase { public function testGetQueriesUsesAcceptedForeignKeys() { @@ -75,7 +75,7 @@ public function testGivenForeignKeyWithZeroLength_acceptForeignKeyThrowsExceptio $this->getMockForAbstractClass('Doctrine\DBAL\Platforms\AbstractPlatform') ); - $this->setExpectedException( 'Doctrine\DBAL\Schema\SchemaException' ); + $this->expectException( 'Doctrine\DBAL\Schema\SchemaException' ); $collector->acceptForeignKey($this->getTableMock(), $this->getStubKeyConstraint('')); } } diff --git a/tests/Doctrine/Tests/DBAL/Schema/Visitor/RemoveNamespacedAssetsTest.php b/tests/Doctrine/Tests/DBAL/Schema/Visitor/RemoveNamespacedAssetsTest.php index a8e2a063914..5338ce76d7c 100644 --- a/tests/Doctrine/Tests/DBAL/Schema/Visitor/RemoveNamespacedAssetsTest.php +++ b/tests/Doctrine/Tests/DBAL/Schema/Visitor/RemoveNamespacedAssetsTest.php @@ -7,7 +7,7 @@ use Doctrine\DBAL\Schema\SchemaConfig; use Doctrine\DBAL\Schema\Visitor\RemoveNamespacedAssets; -class RemoveNamespacedAssetsTest extends \PHPUnit_Framework_TestCase +class RemoveNamespacedAssetsTest extends \PHPUnit\Framework\TestCase { /** * @group DBAL-204 diff --git a/tests/Doctrine/Tests/DBAL/Schema/Visitor/SchemaSqlCollectorTest.php b/tests/Doctrine/Tests/DBAL/Schema/Visitor/SchemaSqlCollectorTest.php index 012bfd0ac4b..c65fe9cb0fa 100644 --- a/tests/Doctrine/Tests/DBAL/Schema/Visitor/SchemaSqlCollectorTest.php +++ b/tests/Doctrine/Tests/DBAL/Schema/Visitor/SchemaSqlCollectorTest.php @@ -4,7 +4,7 @@ use Doctrine\DBAL\Schema\Schema; -class SchemaSqlCollectorTest extends \PHPUnit_Framework_TestCase +class SchemaSqlCollectorTest extends \PHPUnit\Framework\TestCase { public function testCreateSchema() { diff --git a/tests/Doctrine/Tests/DBAL/Sharding/PoolingShardConnectionTest.php b/tests/Doctrine/Tests/DBAL/Sharding/PoolingShardConnectionTest.php index a91fe5122b4..9ede74e1e3c 100644 --- a/tests/Doctrine/Tests/DBAL/Sharding/PoolingShardConnectionTest.php +++ b/tests/Doctrine/Tests/DBAL/Sharding/PoolingShardConnectionTest.php @@ -22,7 +22,7 @@ use Doctrine\DBAL\DriverManager; use Doctrine\DBAL\Sharding\ShardChoser\MultiTenantShardChoser; -class PoolingShardConnectionTest extends \PHPUnit_Framework_TestCase +class PoolingShardConnectionTest extends \PHPUnit\Framework\TestCase { public function testConnect() { @@ -60,7 +60,7 @@ public function testConnect() public function testNoGlobalServerException() { - $this->setExpectedException('InvalidArgumentException', "Connection Parameters require 'global' and 'shards' configurations."); + $this->expectException('InvalidArgumentException', "Connection Parameters require 'global' and 'shards' configurations."); DriverManager::getConnection(array( 'wrapperClass' => 'Doctrine\DBAL\Sharding\PoolingShardConnection', @@ -75,7 +75,7 @@ public function testNoGlobalServerException() public function testNoShardsServersException() { - $this->setExpectedException('InvalidArgumentException', "Connection Parameters require 'global' and 'shards' configurations."); + $this->expectException('InvalidArgumentException', "Connection Parameters require 'global' and 'shards' configurations."); DriverManager::getConnection(array( 'wrapperClass' => 'Doctrine\DBAL\Sharding\PoolingShardConnection', @@ -87,7 +87,7 @@ public function testNoShardsServersException() public function testNoShardsChoserException() { - $this->setExpectedException('InvalidArgumentException', "Missing Shard Choser configuration 'shardChoser'"); + $this->expectException('InvalidArgumentException', "Missing Shard Choser configuration 'shardChoser'"); DriverManager::getConnection(array( 'wrapperClass' => 'Doctrine\DBAL\Sharding\PoolingShardConnection', @@ -102,7 +102,7 @@ public function testNoShardsChoserException() public function testShardChoserWrongInstance() { - $this->setExpectedException('InvalidArgumentException', "The 'shardChoser' configuration is not a valid instance of Doctrine\DBAL\Sharding\ShardChoser\ShardChoser"); + $this->expectException('InvalidArgumentException', "The 'shardChoser' configuration is not a valid instance of Doctrine\DBAL\Sharding\ShardChoser\ShardChoser"); DriverManager::getConnection(array( 'wrapperClass' => 'Doctrine\DBAL\Sharding\PoolingShardConnection', @@ -118,7 +118,7 @@ public function testShardChoserWrongInstance() public function testShardNonNumericId() { - $this->setExpectedException('InvalidArgumentException', "Shard Id has to be a non-negative number."); + $this->expectException('InvalidArgumentException', "Shard Id has to be a non-negative number."); DriverManager::getConnection(array( 'wrapperClass' => 'Doctrine\DBAL\Sharding\PoolingShardConnection', @@ -133,7 +133,7 @@ public function testShardNonNumericId() public function testShardMissingId() { - $this->setExpectedException('InvalidArgumentException', "Missing 'id' for one configured shard. Please specify a unique shard-id."); + $this->expectException('InvalidArgumentException', "Missing 'id' for one configured shard. Please specify a unique shard-id."); DriverManager::getConnection(array( 'wrapperClass' => 'Doctrine\DBAL\Sharding\PoolingShardConnection', @@ -148,7 +148,7 @@ public function testShardMissingId() public function testDuplicateShardId() { - $this->setExpectedException('InvalidArgumentException', "Shard 1 is duplicated in the configuration."); + $this->expectException('InvalidArgumentException', "Shard 1 is duplicated in the configuration."); DriverManager::getConnection(array( 'wrapperClass' => 'Doctrine\DBAL\Sharding\PoolingShardConnection', @@ -176,7 +176,7 @@ public function testSwitchShardWithOpenTransactionException() $conn->beginTransaction(); - $this->setExpectedException('Doctrine\DBAL\Sharding\ShardingException', 'Cannot switch shard when transaction is active.'); + $this->expectException('Doctrine\DBAL\Sharding\ShardingException', 'Cannot switch shard when transaction is active.'); $conn->connect(1); } diff --git a/tests/Doctrine/Tests/DBAL/Sharding/PoolingShardManagerTest.php b/tests/Doctrine/Tests/DBAL/Sharding/PoolingShardManagerTest.php index 93f8369e3fe..ec1581a99e6 100644 --- a/tests/Doctrine/Tests/DBAL/Sharding/PoolingShardManagerTest.php +++ b/tests/Doctrine/Tests/DBAL/Sharding/PoolingShardManagerTest.php @@ -20,7 +20,7 @@ use Doctrine\DBAL\Sharding\PoolingShardManager; -class PoolingShardManagerTest extends \PHPUnit_Framework_TestCase +class PoolingShardManagerTest extends \PHPUnit\Framework\TestCase { private function createConnectionMock() { diff --git a/tests/Doctrine/Tests/DBAL/Sharding/SQLAzure/AbstractTestCase.php b/tests/Doctrine/Tests/DBAL/Sharding/SQLAzure/AbstractTestCase.php index 792476a5b74..abb68c784bf 100644 --- a/tests/Doctrine/Tests/DBAL/Sharding/SQLAzure/AbstractTestCase.php +++ b/tests/Doctrine/Tests/DBAL/Sharding/SQLAzure/AbstractTestCase.php @@ -6,7 +6,7 @@ use Doctrine\DBAL\Schema\Schema; use Doctrine\DBAL\Sharding\SQLAzure\SQLAzureShardManager; -abstract class AbstractTestCase extends \PHPUnit_Framework_TestCase +abstract class AbstractTestCase extends \PHPUnit\Framework\TestCase { protected $conn; protected $sm; diff --git a/tests/Doctrine/Tests/DBAL/Sharding/SQLAzure/MultiTenantVisitorTest.php b/tests/Doctrine/Tests/DBAL/Sharding/SQLAzure/MultiTenantVisitorTest.php index 7eb038fc4c4..4575d14f512 100644 --- a/tests/Doctrine/Tests/DBAL/Sharding/SQLAzure/MultiTenantVisitorTest.php +++ b/tests/Doctrine/Tests/DBAL/Sharding/SQLAzure/MultiTenantVisitorTest.php @@ -23,7 +23,7 @@ use Doctrine\DBAL\Schema\Schema; use Doctrine\DBAL\Sharding\SQLAzure\Schema\MultiTenantVisitor; -class MultiTenantVisitorTest extends \PHPUnit_Framework_TestCase +class MultiTenantVisitorTest extends \PHPUnit\Framework\TestCase { public function testMultiTenantPrimaryKey() { diff --git a/tests/Doctrine/Tests/DBAL/Sharding/SQLAzure/SQLAzureShardManagerTest.php b/tests/Doctrine/Tests/DBAL/Sharding/SQLAzure/SQLAzureShardManagerTest.php index e0219b4e512..e252f172596 100644 --- a/tests/Doctrine/Tests/DBAL/Sharding/SQLAzure/SQLAzureShardManagerTest.php +++ b/tests/Doctrine/Tests/DBAL/Sharding/SQLAzure/SQLAzureShardManagerTest.php @@ -4,11 +4,11 @@ use Doctrine\DBAL\Sharding\SQLAzure\SQLAzureShardManager; -class SQLAzureShardManagerTest extends \PHPUnit_Framework_TestCase +class SQLAzureShardManagerTest extends \PHPUnit\Framework\TestCase { public function testNoFederationName() { - $this->setExpectedException('Doctrine\DBAL\Sharding\ShardingException', 'SQLAzure requires a federation name to be set during sharding configuration.'); + $this->expectException('Doctrine\DBAL\Sharding\ShardingException', 'SQLAzure requires a federation name to be set during sharding configuration.'); $conn = $this->createConnection(array('sharding' => array('distributionKey' => 'abc', 'distributionType' => 'integer'))); $sm = new SQLAzureShardManager($conn); @@ -16,7 +16,7 @@ public function testNoFederationName() public function testNoDistributionKey() { - $this->setExpectedException('Doctrine\DBAL\Sharding\ShardingException', 'SQLAzure requires a distribution key to be set during sharding configuration.'); + $this->expectException('Doctrine\DBAL\Sharding\ShardingException', 'SQLAzure requires a distribution key to be set during sharding configuration.'); $conn = $this->createConnection(array('sharding' => array('federationName' => 'abc', 'distributionType' => 'integer'))); $sm = new SQLAzureShardManager($conn); @@ -24,7 +24,7 @@ public function testNoDistributionKey() public function testNoDistributionType() { - $this->setExpectedException('Doctrine\DBAL\Sharding\ShardingException'); + $this->expectException('Doctrine\DBAL\Sharding\ShardingException'); $conn = $this->createConnection(array('sharding' => array('federationName' => 'abc', 'distributionKey' => 'foo'))); $sm = new SQLAzureShardManager($conn); @@ -43,7 +43,7 @@ public function testSelectGlobalTransactionActive() $conn = $this->createConnection(array('sharding' => array('federationName' => 'abc', 'distributionKey' => 'foo', 'distributionType' => 'integer'))); $conn->expects($this->at(1))->method('isTransactionActive')->will($this->returnValue(true)); - $this->setExpectedException('Doctrine\DBAL\Sharding\ShardingException', 'Cannot switch shard during an active transaction.'); + $this->expectException('Doctrine\DBAL\Sharding\ShardingException', 'Cannot switch shard during an active transaction.'); $sm = new SQLAzureShardManager($conn); $sm->selectGlobal(); @@ -64,7 +64,7 @@ public function testSelectShard() $conn = $this->createConnection(array('sharding' => array('federationName' => 'abc', 'distributionKey' => 'foo', 'distributionType' => 'integer'))); $conn->expects($this->at(1))->method('isTransactionActive')->will($this->returnValue(true)); - $this->setExpectedException('Doctrine\DBAL\Sharding\ShardingException', 'Cannot switch shard during an active transaction.'); + $this->expectException('Doctrine\DBAL\Sharding\ShardingException', 'Cannot switch shard during an active transaction.'); $sm = new SQLAzureShardManager($conn); $sm->selectShard(1234); @@ -77,7 +77,7 @@ public function testSelectShardNoDistributionValue() $conn = $this->createConnection(array('sharding' => array('federationName' => 'abc', 'distributionKey' => 'foo', 'distributionType' => 'integer'))); $conn->expects($this->at(1))->method('isTransactionActive')->will($this->returnValue(false)); - $this->setExpectedException('Doctrine\DBAL\Sharding\ShardingException', 'You have to specify a string or integer as shard distribution value.'); + $this->expectException('Doctrine\DBAL\Sharding\ShardingException', 'You have to specify a string or integer as shard distribution value.'); $sm = new SQLAzureShardManager($conn); $sm->selectShard(null); diff --git a/tests/Doctrine/Tests/DBAL/Sharding/ShardChoser/MultiTenantShardChoserTest.php b/tests/Doctrine/Tests/DBAL/Sharding/ShardChoser/MultiTenantShardChoserTest.php index f71014cd36d..fa470bd8d50 100644 --- a/tests/Doctrine/Tests/DBAL/Sharding/ShardChoser/MultiTenantShardChoserTest.php +++ b/tests/Doctrine/Tests/DBAL/Sharding/ShardChoser/MultiTenantShardChoserTest.php @@ -21,7 +21,7 @@ use Doctrine\DBAL\Sharding\ShardChoser\MultiTenantShardChoser; -class MultiTenantShardChoserTest extends \PHPUnit_Framework_TestCase +class MultiTenantShardChoserTest extends \PHPUnit\Framework\TestCase { public function testPickShard() { diff --git a/tests/Doctrine/Tests/DBAL/Tools/Console/RunSqlCommandTest.php b/tests/Doctrine/Tests/DBAL/Tools/Console/RunSqlCommandTest.php index baff459d83e..7fbcac3da34 100644 --- a/tests/Doctrine/Tests/DBAL/Tools/Console/RunSqlCommandTest.php +++ b/tests/Doctrine/Tests/DBAL/Tools/Console/RunSqlCommandTest.php @@ -7,7 +7,7 @@ use Symfony\Component\Console\Application; use Symfony\Component\Console\Tester\CommandTester; -class RunSqlCommandTest extends \PHPUnit_Framework_TestCase +class RunSqlCommandTest extends \PHPUnit\Framework\TestCase { /** @var CommandTester */ private $commandTester; diff --git a/tests/Doctrine/Tests/DBAL/Types/ArrayTest.php b/tests/Doctrine/Tests/DBAL/Types/ArrayTest.php index b6089e7804f..2a54bdc1f79 100644 --- a/tests/Doctrine/Tests/DBAL/Types/ArrayTest.php +++ b/tests/Doctrine/Tests/DBAL/Types/ArrayTest.php @@ -40,7 +40,7 @@ public function testArrayConvertsToPHPValue() public function testConversionFailure() { error_reporting( (E_ALL | E_STRICT) - \E_NOTICE ); - $this->setExpectedException('Doctrine\DBAL\Types\ConversionException'); + $this->expectException('Doctrine\DBAL\Types\ConversionException'); $this->_type->convertToPHPValue('abcdefg', $this->_platform); } diff --git a/tests/Doctrine/Tests/DBAL/Types/BaseDateTypeTestCase.php b/tests/Doctrine/Tests/DBAL/Types/BaseDateTypeTestCase.php index c5f370190a7..953d6362935 100644 --- a/tests/Doctrine/Tests/DBAL/Types/BaseDateTypeTestCase.php +++ b/tests/Doctrine/Tests/DBAL/Types/BaseDateTypeTestCase.php @@ -3,9 +3,8 @@ namespace Doctrine\Tests\DBAL\Types; use Doctrine\Tests\DBAL\Mocks\MockPlatform; -use PHPUnit_Framework_TestCase; -abstract class BaseDateTypeTestCase extends PHPUnit_Framework_TestCase +abstract class BaseDateTypeTestCase extends \PHPUnit\Framework\TestCase { /** * @var MockPlatform @@ -53,7 +52,7 @@ public function testDateConvertsToDatabaseValue() */ public function testInvalidTypeConversionToDatabaseValue($value) { - $this->setExpectedException('Doctrine\DBAL\Types\ConversionException'); + $this->expectException('Doctrine\DBAL\Types\ConversionException'); $this->type->convertToDatabaseValue($value, $this->platform); } diff --git a/tests/Doctrine/Tests/DBAL/Types/ConversionExceptionTest.php b/tests/Doctrine/Tests/DBAL/Types/ConversionExceptionTest.php index 5aa797895fd..6ee20f170eb 100644 --- a/tests/Doctrine/Tests/DBAL/Types/ConversionExceptionTest.php +++ b/tests/Doctrine/Tests/DBAL/Types/ConversionExceptionTest.php @@ -3,9 +3,8 @@ namespace Doctrine\Tests\DBAL\Types; use Doctrine\DBAL\Types\ConversionException; -use PHPUnit_Framework_TestCase; -class ConversionExceptionTest extends PHPUnit_Framework_TestCase +class ConversionExceptionTest extends \PHPUnit\Framework\TestCase { /** * @dataProvider scalarsProvider diff --git a/tests/Doctrine/Tests/DBAL/Types/DateImmutableTypeTest.php b/tests/Doctrine/Tests/DBAL/Types/DateImmutableTypeTest.php index e792033a00c..e5733ec4db7 100644 --- a/tests/Doctrine/Tests/DBAL/Types/DateImmutableTypeTest.php +++ b/tests/Doctrine/Tests/DBAL/Types/DateImmutableTypeTest.php @@ -7,7 +7,7 @@ use Doctrine\DBAL\Types\DateImmutableType; use Doctrine\DBAL\Types\Type; -class DateImmutableTypeTest extends \PHPUnit_Framework_TestCase +class DateImmutableTypeTest extends \PHPUnit\Framework\TestCase { /** * @var \Doctrine\DBAL\Platforms\AbstractPlatform|\Prophecy\Prophecy\ObjectProphecy diff --git a/tests/Doctrine/Tests/DBAL/Types/DateIntervalTest.php b/tests/Doctrine/Tests/DBAL/Types/DateIntervalTest.php index e474fe41fb0..efb6049bcd1 100644 --- a/tests/Doctrine/Tests/DBAL/Types/DateIntervalTest.php +++ b/tests/Doctrine/Tests/DBAL/Types/DateIntervalTest.php @@ -47,7 +47,7 @@ public function testDateIntervalConvertsToPHPValue() public function testInvalidDateIntervalFormatConversion() { - $this->setExpectedException('Doctrine\DBAL\Types\ConversionException'); + $this->expectException('Doctrine\DBAL\Types\ConversionException'); $this->type->convertToPHPValue('abcdefg', $this->platform); } @@ -71,7 +71,7 @@ public function testRequiresSQLCommentHint() */ public function testInvalidTypeConversionToDatabaseValue($value) { - $this->setExpectedException('Doctrine\DBAL\Types\ConversionException'); + $this->expectException('Doctrine\DBAL\Types\ConversionException'); $this->type->convertToDatabaseValue($value, $this->platform); } diff --git a/tests/Doctrine/Tests/DBAL/Types/DateTest.php b/tests/Doctrine/Tests/DBAL/Types/DateTest.php index 108eb502755..75464cb1f02 100644 --- a/tests/Doctrine/Tests/DBAL/Types/DateTest.php +++ b/tests/Doctrine/Tests/DBAL/Types/DateTest.php @@ -47,7 +47,7 @@ public function testDateRests_SummerTimeAffection() public function testInvalidDateFormatConversion() { - $this->setExpectedException('Doctrine\DBAL\Types\ConversionException'); + $this->expectException('Doctrine\DBAL\Types\ConversionException'); $this->type->convertToPHPValue('abcdefg', $this->platform); } } diff --git a/tests/Doctrine/Tests/DBAL/Types/DateTimeImmutableTypeTest.php b/tests/Doctrine/Tests/DBAL/Types/DateTimeImmutableTypeTest.php index ebdecc71772..73da0a68b44 100644 --- a/tests/Doctrine/Tests/DBAL/Types/DateTimeImmutableTypeTest.php +++ b/tests/Doctrine/Tests/DBAL/Types/DateTimeImmutableTypeTest.php @@ -7,7 +7,7 @@ use Doctrine\DBAL\Types\DateTimeImmutableType; use Doctrine\DBAL\Types\Type; -class DateTimeImmutableTypeTest extends \PHPUnit_Framework_TestCase +class DateTimeImmutableTypeTest extends \PHPUnit\Framework\TestCase { /** * @var \Doctrine\DBAL\Platforms\AbstractPlatform|\Prophecy\Prophecy\ObjectProphecy diff --git a/tests/Doctrine/Tests/DBAL/Types/DateTimeTest.php b/tests/Doctrine/Tests/DBAL/Types/DateTimeTest.php index 9d9720118bf..2ace9ab6277 100644 --- a/tests/Doctrine/Tests/DBAL/Types/DateTimeTest.php +++ b/tests/Doctrine/Tests/DBAL/Types/DateTimeTest.php @@ -36,7 +36,7 @@ public function testDateTimeConvertsToPHPValue() public function testInvalidDateTimeFormatConversion() { - $this->setExpectedException('Doctrine\DBAL\Types\ConversionException'); + $this->expectException('Doctrine\DBAL\Types\ConversionException'); $this->type->convertToPHPValue('abcdefg', $this->platform); } diff --git a/tests/Doctrine/Tests/DBAL/Types/DateTimeTzImmutableTypeTest.php b/tests/Doctrine/Tests/DBAL/Types/DateTimeTzImmutableTypeTest.php index 55fa10681e8..b5f28f18751 100644 --- a/tests/Doctrine/Tests/DBAL/Types/DateTimeTzImmutableTypeTest.php +++ b/tests/Doctrine/Tests/DBAL/Types/DateTimeTzImmutableTypeTest.php @@ -7,7 +7,7 @@ use Doctrine\DBAL\Types\DateTimeTzImmutableType; use Doctrine\DBAL\Types\Type; -class DateTimeTzImmutableTypeTest extends \PHPUnit_Framework_TestCase +class DateTimeTzImmutableTypeTest extends \PHPUnit\Framework\TestCase { /** * @var \Doctrine\DBAL\Platforms\AbstractPlatform|\Prophecy\Prophecy\ObjectProphecy diff --git a/tests/Doctrine/Tests/DBAL/Types/DateTimeTzTest.php b/tests/Doctrine/Tests/DBAL/Types/DateTimeTzTest.php index 94366e87d15..9bd72710660 100644 --- a/tests/Doctrine/Tests/DBAL/Types/DateTimeTzTest.php +++ b/tests/Doctrine/Tests/DBAL/Types/DateTimeTzTest.php @@ -36,7 +36,7 @@ public function testDateTimeConvertsToPHPValue() public function testInvalidDateFormatConversion() { - $this->setExpectedException('Doctrine\DBAL\Types\ConversionException'); + $this->expectException('Doctrine\DBAL\Types\ConversionException'); $this->type->convertToPHPValue('abcdefg', $this->platform); } } diff --git a/tests/Doctrine/Tests/DBAL/Types/JsonTest.php b/tests/Doctrine/Tests/DBAL/Types/JsonTest.php index b4b8f08af45..fc9e64bac34 100644 --- a/tests/Doctrine/Tests/DBAL/Types/JsonTest.php +++ b/tests/Doctrine/Tests/DBAL/Types/JsonTest.php @@ -63,7 +63,7 @@ public function testJsonStringConvertsToPHPValue() /** @dataProvider providerFailure */ public function testConversionFailure($data) { - $this->setExpectedException('Doctrine\DBAL\Types\ConversionException'); + $this->expectException('Doctrine\DBAL\Types\ConversionException'); $this->type->convertToPHPValue($data, $this->platform); } diff --git a/tests/Doctrine/Tests/DBAL/Types/ObjectTest.php b/tests/Doctrine/Tests/DBAL/Types/ObjectTest.php index 416827293da..062394d888b 100644 --- a/tests/Doctrine/Tests/DBAL/Types/ObjectTest.php +++ b/tests/Doctrine/Tests/DBAL/Types/ObjectTest.php @@ -35,7 +35,7 @@ public function testObjectConvertsToPHPValue() public function testConversionFailure() { error_reporting( (E_ALL | E_STRICT) - \E_NOTICE ); - $this->setExpectedException('Doctrine\DBAL\Types\ConversionException'); + $this->expectException('Doctrine\DBAL\Types\ConversionException'); $this->_type->convertToPHPValue('abcdefg', $this->_platform); } diff --git a/tests/Doctrine/Tests/DBAL/Types/TimeImmutableTypeTest.php b/tests/Doctrine/Tests/DBAL/Types/TimeImmutableTypeTest.php index 64d4075f7c6..0dca385245c 100644 --- a/tests/Doctrine/Tests/DBAL/Types/TimeImmutableTypeTest.php +++ b/tests/Doctrine/Tests/DBAL/Types/TimeImmutableTypeTest.php @@ -7,7 +7,7 @@ use Doctrine\DBAL\Types\TimeImmutableType; use Doctrine\DBAL\Types\Type; -class TimeImmutableTypeTest extends \PHPUnit_Framework_TestCase +class TimeImmutableTypeTest extends \PHPUnit\Framework\TestCase { /** * @var \Doctrine\DBAL\Platforms\AbstractPlatform|\Prophecy\Prophecy\ObjectProphecy diff --git a/tests/Doctrine/Tests/DBAL/Types/TimeTest.php b/tests/Doctrine/Tests/DBAL/Types/TimeTest.php index 8e4dbb940b3..6bc4c43982b 100644 --- a/tests/Doctrine/Tests/DBAL/Types/TimeTest.php +++ b/tests/Doctrine/Tests/DBAL/Types/TimeTest.php @@ -31,7 +31,7 @@ public function testDateFieldResetInPHPValue() public function testInvalidTimeFormatConversion() { - $this->setExpectedException('Doctrine\DBAL\Types\ConversionException'); + $this->expectException('Doctrine\DBAL\Types\ConversionException'); $this->type->convertToPHPValue('abcdefg', $this->platform); } } diff --git a/tests/Doctrine/Tests/DBAL/Types/VarDateTimeImmutableTypeTest.php b/tests/Doctrine/Tests/DBAL/Types/VarDateTimeImmutableTypeTest.php index 4702352e201..144d055d2fa 100644 --- a/tests/Doctrine/Tests/DBAL/Types/VarDateTimeImmutableTypeTest.php +++ b/tests/Doctrine/Tests/DBAL/Types/VarDateTimeImmutableTypeTest.php @@ -7,7 +7,7 @@ use Doctrine\DBAL\Types\VarDateTimeImmutableType; use Doctrine\DBAL\Types\Type; -class VarDateTimeImmutableTypeTest extends \PHPUnit_Framework_TestCase +class VarDateTimeImmutableTypeTest extends \PHPUnit\Framework\TestCase { /** * @var \Doctrine\DBAL\Platforms\AbstractPlatform|\Prophecy\Prophecy\ObjectProphecy diff --git a/tests/Doctrine/Tests/DBAL/Types/VarDateTimeTest.php b/tests/Doctrine/Tests/DBAL/Types/VarDateTimeTest.php index 145d376a28d..8c185fe45d6 100644 --- a/tests/Doctrine/Tests/DBAL/Types/VarDateTimeTest.php +++ b/tests/Doctrine/Tests/DBAL/Types/VarDateTimeTest.php @@ -41,7 +41,7 @@ public function testDateTimeConvertsToPHPValue() public function testInvalidDateTimeFormatConversion() { - $this->setExpectedException('Doctrine\DBAL\Types\ConversionException'); + $this->expectException('Doctrine\DBAL\Types\ConversionException'); $this->_type->convertToPHPValue('abcdefg', $this->_platform); } diff --git a/tests/Doctrine/Tests/DbalFunctionalTestCase.php b/tests/Doctrine/Tests/DbalFunctionalTestCase.php index 557de1ab5be..5d125c1b8aa 100644 --- a/tests/Doctrine/Tests/DbalFunctionalTestCase.php +++ b/tests/Doctrine/Tests/DbalFunctionalTestCase.php @@ -47,10 +47,10 @@ protected function tearDown() } } - protected function onNotSuccessfulTest($e) + protected function onNotSuccessfulTest(\Throwable $t) { - if ($e instanceof \PHPUnit_Framework_AssertionFailedError) { - throw $e; + if ($t instanceof \PHPUnit\Framework\AssertionFailedError) { + throw $t; } if(isset($this->_sqlLoggerStack->queries) && count($this->_sqlLoggerStack->queries)) { @@ -70,7 +70,7 @@ protected function onNotSuccessfulTest($e) $i--; } - $trace = $e->getTrace(); + $trace = $t->getTrace(); $traceMsg = ""; foreach($trace as $part) { if(isset($part['file'])) { @@ -83,10 +83,10 @@ protected function onNotSuccessfulTest($e) } } - $message = "[".get_class($e)."] ".$e->getMessage().PHP_EOL.PHP_EOL."With queries:".PHP_EOL.$queries.PHP_EOL."Trace:".PHP_EOL.$traceMsg; + $message = "[".get_class($t)."] ".$t->getMessage().PHP_EOL.PHP_EOL."With queries:".PHP_EOL.$queries.PHP_EOL."Trace:".PHP_EOL.$traceMsg; - throw new \Exception($message, (int)$e->getCode(), $e); + throw new \Exception($message, (int)$t->getCode(), $t); } - throw $e; + throw $t; } } diff --git a/tests/Doctrine/Tests/DbalPerformanceTestListener.php b/tests/Doctrine/Tests/DbalPerformanceTestListener.php index 2ae784ffca4..9930845812d 100644 --- a/tests/Doctrine/Tests/DbalPerformanceTestListener.php +++ b/tests/Doctrine/Tests/DbalPerformanceTestListener.php @@ -7,14 +7,14 @@ * * @author Bill Schaller */ -class DbalPerformanceTestListener extends \PHPUnit_Framework_BaseTestListener +class DbalPerformanceTestListener extends \PHPUnit\Framework\BaseTestListener { private $timings = []; /** * {@inheritdoc} */ - public function endTest(\PHPUnit_Framework_Test $test, $time) + public function endTest(\PHPUnit\Framework\Test $test, $time) { // This listener only applies to performance tests. if ($test instanceof \Doctrine\Tests\DbalPerformanceTestCase) diff --git a/tests/Doctrine/Tests/DbalTestCase.php b/tests/Doctrine/Tests/DbalTestCase.php index 887ecf54e98..b577893e6f1 100644 --- a/tests/Doctrine/Tests/DbalTestCase.php +++ b/tests/Doctrine/Tests/DbalTestCase.php @@ -5,6 +5,6 @@ /** * Base testcase class for all dbal testcases. */ -abstract class DbalTestCase extends \PHPUnit_Framework_TestCase +abstract class DbalTestCase extends \PHPUnit\Framework\TestCase { } diff --git a/tests/travis/mariadb.travis.xml b/tests/travis/mariadb.travis.xml index 4661e504323..d761d4b338d 100644 --- a/tests/travis/mariadb.travis.xml +++ b/tests/travis/mariadb.travis.xml @@ -1,9 +1,11 @@ @@ -35,4 +37,3 @@ - diff --git a/tests/travis/mysql.travis.xml b/tests/travis/mysql.travis.xml index 4661e504323..d761d4b338d 100644 --- a/tests/travis/mysql.travis.xml +++ b/tests/travis/mysql.travis.xml @@ -1,9 +1,11 @@ @@ -35,4 +37,3 @@ - diff --git a/tests/travis/mysqli.travis.xml b/tests/travis/mysqli.travis.xml index 84bdac32c04..e46a39f007d 100644 --- a/tests/travis/mysqli.travis.xml +++ b/tests/travis/mysqli.travis.xml @@ -1,9 +1,11 @@ @@ -35,4 +37,3 @@ - diff --git a/tests/travis/pgsql.travis.xml b/tests/travis/pgsql.travis.xml index 0298a5ce1cb..9df0a46dc95 100644 --- a/tests/travis/pgsql.travis.xml +++ b/tests/travis/pgsql.travis.xml @@ -1,9 +1,11 @@ diff --git a/tests/travis/sqlite.travis.xml b/tests/travis/sqlite.travis.xml index c6b8d0833fb..f2f1c5b7b5b 100644 --- a/tests/travis/sqlite.travis.xml +++ b/tests/travis/sqlite.travis.xml @@ -1,9 +1,11 @@ @@ -14,11 +16,13 @@ ../Doctrine/Tests/DBAL + - + ./../../lib/Doctrine + performance From 48fa395856d00121c16e3d5a1a15e6f18bab7609 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lu=C3=ADs=20Cobucci?= Date: Fri, 8 Sep 2017 13:28:40 -0300 Subject: [PATCH 3/5] Fix risky tests --- .../Tests/DBAL/Functional/ConnectionTest.php | 15 +++---- .../Tests/DBAL/Functional/DataAccessTest.php | 15 ++++--- .../Schema/MySqlSchemaManagerTest.php | 8 +++- .../SchemaManagerFunctionalTestCase.php | 43 +++++++++++++++---- .../DBAL/Platforms/OraclePlatformTest.php | 42 ++++++++++-------- .../DBAL/Platforms/SqlitePlatformTest.php | 34 ++++++++------- .../DBAL/Schema/SqliteSchemaManagerTest.php | 1 - .../Doctrine/Tests/DBAL/Schema/TableTest.php | 14 ++++-- 8 files changed, 110 insertions(+), 62 deletions(-) diff --git a/tests/Doctrine/Tests/DBAL/Functional/ConnectionTest.php b/tests/Doctrine/Tests/DBAL/Functional/ConnectionTest.php index de9fee35f1a..29b6117bee7 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/ConnectionTest.php +++ b/tests/Doctrine/Tests/DBAL/Functional/ConnectionTest.php @@ -108,12 +108,8 @@ public function testTransactionNestingBehaviorCantBeChangedInActiveTransaction() } $this->_conn->beginTransaction(); - try { - $this->_conn->setNestTransactionsWithSavepoints(true); - $this->fail('An exception should have been thrown by chaning the nesting transaction behavior within an transaction.'); - } catch(ConnectionException $e) { - $this->_conn->rollBack(); - } + $this->expectException(ConnectionException::class); + $this->_conn->setNestTransactionsWithSavepoints(true); } public function testSetNestedTransactionsThroughSavepointsNotSupportedThrowsException() @@ -228,17 +224,20 @@ public function testTransactionalWithThrowable() public function testTransactional() { - $this->_conn->transactional(function($conn) { + $res = $this->_conn->transactional(function($conn) { /* @var $conn \Doctrine\DBAL\Connection */ $conn->executeQuery($conn->getDatabasePlatform()->getDummySelectSQL()); }); + + self::assertNull($res); } public function testTransactionalReturnValue() { - $res = $this->_conn->transactional(function($conn) { + $res = $this->_conn->transactional(function() { return 42; }); + $this->assertEquals(42, $res); } diff --git a/tests/Doctrine/Tests/DBAL/Functional/DataAccessTest.php b/tests/Doctrine/Tests/DBAL/Functional/DataAccessTest.php index b7970a17f1a..7c191dc9844 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/DataAccessTest.php +++ b/tests/Doctrine/Tests/DBAL/Functional/DataAccessTest.php @@ -771,9 +771,11 @@ public function testSetFetchModeClassFetch() */ public function testEmptyFetchColumnReturnsFalse() { + $this->_conn->beginTransaction(); $this->_conn->exec('DELETE FROM fetch_table'); $this->assertFalse($this->_conn->fetchColumn('SELECT test_int FROM fetch_table')); $this->assertFalse($this->_conn->query('SELECT test_int FROM fetch_table')->fetchColumn()); + $this->_conn->rollBack(); } /** @@ -785,10 +787,11 @@ public function testSetFetchModeOnDbalStatement() $stmt = $this->_conn->executeQuery($sql, array(1, "foo")); $stmt->setFetchMode(\PDO::FETCH_NUM); - while ($row = $stmt->fetch()) { - $this->assertTrue(isset($row[0])); - $this->assertTrue(isset($row[1])); - } + $row = $stmt->fetch(); + + self::assertArrayHasKey(0, $row); + self::assertArrayHasKey(1, $row); + self::assertFalse($stmt->fetch()); } /** @@ -810,11 +813,11 @@ public function testFetchColumnNullValue() { $this->_conn->executeUpdate( 'INSERT INTO fetch_table (test_int, test_string) VALUES (?, ?)', - array(1, 'foo') + array(2, 'foo') ); $this->assertNull( - $this->_conn->fetchColumn('SELECT test_datetime FROM fetch_table WHERE test_int = ?', array(1)) + $this->_conn->fetchColumn('SELECT test_datetime FROM fetch_table WHERE test_int = ?', array(2)) ); } diff --git a/tests/Doctrine/Tests/DBAL/Functional/Schema/MySqlSchemaManagerTest.php b/tests/Doctrine/Tests/DBAL/Functional/Schema/MySqlSchemaManagerTest.php index 9383848500b..b50b79b6c14 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/Schema/MySqlSchemaManagerTest.php +++ b/tests/Doctrine/Tests/DBAL/Functional/Schema/MySqlSchemaManagerTest.php @@ -24,7 +24,6 @@ public function testSwitchPrimaryKeyColumns() $tableOld = new Table("switch_primary_key_columns"); $tableOld->addColumn('foo_id', 'integer'); $tableOld->addColumn('bar_id', 'integer'); - $tableNew = clone $tableOld; $this->_sm->createTable($tableOld); $tableFetched = $this->_sm->listTableDetails("switch_primary_key_columns"); @@ -33,6 +32,13 @@ public function testSwitchPrimaryKeyColumns() $comparator = new Comparator; $this->_sm->alterTable($comparator->diffTable($tableFetched, $tableNew)); + + $table = $this->_sm->listTableDetails('switch_primary_key_columns'); + $primaryKey = $table->getPrimaryKeyColumns(); + + self::assertCount(2, $primaryKey); + self::assertContains('bar_id', $primaryKey); + self::assertContains('foo_id', $primaryKey); } public function testDiffTableBug() diff --git a/tests/Doctrine/Tests/DBAL/Functional/Schema/SchemaManagerFunctionalTestCase.php b/tests/Doctrine/Tests/DBAL/Functional/Schema/SchemaManagerFunctionalTestCase.php index cf9a6654bf3..0532e11d9b0 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/Schema/SchemaManagerFunctionalTestCase.php +++ b/tests/Doctrine/Tests/DBAL/Functional/Schema/SchemaManagerFunctionalTestCase.php @@ -83,12 +83,27 @@ public function testDropsDatabaseWithActiveConnections() */ public function testDropAndCreateSequence() { - if(!$this->_conn->getDatabasePlatform()->supportsSequences()) { + if ( ! $this->_conn->getDatabasePlatform()->supportsSequences()) { $this->markTestSkipped($this->_conn->getDriver()->getName().' does not support sequences.'); } - $sequence = new \Doctrine\DBAL\Schema\Sequence('dropcreate_sequences_test_seq', 20, 10); - $this->_sm->dropAndCreateSequence($sequence); + $name = 'dropcreate_sequences_test_seq'; + + $this->_sm->dropAndCreateSequence(new \Doctrine\DBAL\Schema\Sequence($name, 20, 10)); + + self::assertTrue($this->hasElementWithName($this->_sm->listSequences(), $name)); + } + + private function hasElementWithName(array $items, string $name) : bool + { + $filteredList = array_filter( + $items, + function (\Doctrine\DBAL\Schema\AbstractAsset $item) use ($name) : bool { + return $item->getShortestName($item->getNamespaceName()) === $name; + } + ); + + return count($filteredList) === 1; } public function testListSequences() @@ -569,7 +584,7 @@ public function testCreateAndListViews() $this->_sm->dropAndCreateView($view); - $views = $this->_sm->listViews(); + self::assertTrue($this->hasElementWithName($this->_sm->listViews(), $name)); } public function testAutoincrementDetection() @@ -648,6 +663,13 @@ public function testUpdateSchemaWithForeignKeyRenaming() $tableDiff = $c->diffTable($tableFK, $tableFKNew); $this->_sm->alterTable($tableDiff); + + $table = $this->_sm->listTableDetails('test_fk_rename'); + $foreignKeys = $table->getForeignKeys(); + + self::assertTrue($table->hasColumn('rename_fk_id')); + self::assertCount(1, $foreignKeys); + self::assertSame(['rename_fk_id'], array_map('strtolower', current($foreignKeys)->getColumns())); } /** @@ -830,12 +852,17 @@ public function testChangeColumnsTypeWithDefaultValue() public function testListTableWithBlob() { $table = new Table('test_blob_table'); - $table->addColumn('id', 'integer', array('comment' => 'This is a comment')); - $table->addColumn('binarydata', 'blob', array()); - $table->setPrimaryKey(array('id')); + $table->addColumn('id', 'integer', ['comment' => 'This is a comment']); + $table->addColumn('binarydata', 'blob', []); + $table->setPrimaryKey(['id']); $this->_sm->createTable($table); - $this->_sm->listTableDetails('test_blob_table'); + + $created = $this->_sm->listTableDetails('test_blob_table'); + + self::assertTrue($created->hasColumn('id')); + self::assertTrue($created->hasColumn('binarydata')); + self::assertTrue($created->hasPrimaryKey()); } /** diff --git a/tests/Doctrine/Tests/DBAL/Platforms/OraclePlatformTest.php b/tests/Doctrine/Tests/DBAL/Platforms/OraclePlatformTest.php index 15a5870a936..33cef473961 100644 --- a/tests/Doctrine/Tests/DBAL/Platforms/OraclePlatformTest.php +++ b/tests/Doctrine/Tests/DBAL/Platforms/OraclePlatformTest.php @@ -2,6 +2,7 @@ namespace Doctrine\Tests\DBAL\Platforms; +use Doctrine\DBAL\DBALException; use Doctrine\DBAL\Platforms\OraclePlatform; use Doctrine\DBAL\Schema\Column; use Doctrine\DBAL\Schema\Comparator; @@ -13,17 +14,17 @@ class OraclePlatformTest extends AbstractPlatformTestCase { public static function dataValidIdentifiers() { - return array( - array('a'), - array('foo'), - array('Foo'), - array('Foo123'), - array('Foo#bar_baz$'), - array('"a"'), - array('"1"'), - array('"foo_bar"'), - array('"@$%&!"'), - ); + return [ + ['a'], + ['foo'], + ['Foo'], + ['Foo123'], + ['Foo#bar_baz$'], + ['"a"'], + ['"1"'], + ['"foo_bar"'], + ['"@$%&!"'], + ]; } /** @@ -33,17 +34,19 @@ public function testValidIdentifiers($identifier) { $platform = $this->createPlatform(); $platform->assertValidIdentifier($identifier); + + $this->addToAssertionCount(1); } public static function dataInvalidIdentifiers() { - return array( - array('1'), - array('abc&'), - array('abc-def'), - array('"'), - array('"foo"bar"'), - ); + return [ + ['1'], + ['abc&'], + ['abc-def'], + ['"'], + ['"foo"bar"'], + ]; } /** @@ -51,7 +54,8 @@ public static function dataInvalidIdentifiers() */ public function testInvalidIdentifiers($identifier) { - $this->expectException('Doctrine\DBAL\DBALException'); + $this->expectException(DBALException::class); + $platform = $this->createPlatform(); $platform->assertValidIdentifier($identifier); } diff --git a/tests/Doctrine/Tests/DBAL/Platforms/SqlitePlatformTest.php b/tests/Doctrine/Tests/DBAL/Platforms/SqlitePlatformTest.php index 9ed0744de88..190a9717903 100644 --- a/tests/Doctrine/Tests/DBAL/Platforms/SqlitePlatformTest.php +++ b/tests/Doctrine/Tests/DBAL/Platforms/SqlitePlatformTest.php @@ -336,25 +336,29 @@ public function testAlterTableAddColumns() $this->assertEquals($expected, $this->_platform->getAlterTableSQL($diff)); } - public function testAlterTableAddComplexColumns() + /** + * @dataProvider complexDiffProvider + */ + public function testAlterTableAddComplexColumns(TableDiff $diff) : void { - $diff = new TableDiff('user'); - $diff->addedColumns['time'] = new Column('time', Type::getType('date'), array('default' => 'CURRENT_DATE')); + $this->expectException(DBALException::class); + + $this->_platform->getAlterTableSQL($diff); + } + + public function complexDiffProvider() : array + { + $date = new TableDiff('user'); + $date->addedColumns['time'] = new Column('time', Type::getType('date'), array('default' => 'CURRENT_DATE')); - try { - $this->_platform->getAlterTableSQL($diff); - $this->fail(); - } catch (DBALException $e) { - } - $diff = new TableDiff('user'); - $diff->addedColumns['id'] = new Column('id', Type::getType('integer'), array('autoincrement' => true)); + $id = new TableDiff('user'); + $id->addedColumns['id'] = new Column('id', Type::getType('integer'), array('autoincrement' => true)); - try { - $this->_platform->getAlterTableSQL($diff); - $this->fail(); - } catch (DBALException $e) { - } + return [ + 'date column with default value' => [$date], + 'id column with auto increment' => [$id], + ]; } public function testCreateTableWithDeferredForeignKeys() diff --git a/tests/Doctrine/Tests/DBAL/Schema/SqliteSchemaManagerTest.php b/tests/Doctrine/Tests/DBAL/Schema/SqliteSchemaManagerTest.php index 2ef6b244b69..656d8717804 100644 --- a/tests/Doctrine/Tests/DBAL/Schema/SqliteSchemaManagerTest.php +++ b/tests/Doctrine/Tests/DBAL/Schema/SqliteSchemaManagerTest.php @@ -7,7 +7,6 @@ class SqliteSchemaManagerTest extends \PHPUnit\Framework\TestCase { - /** * @dataProvider getDataColumnCollation */ diff --git a/tests/Doctrine/Tests/DBAL/Schema/TableTest.php b/tests/Doctrine/Tests/DBAL/Schema/TableTest.php index 147e4de33b8..c0f5484ad1f 100644 --- a/tests/Doctrine/Tests/DBAL/Schema/TableTest.php +++ b/tests/Doctrine/Tests/DBAL/Schema/TableTest.php @@ -2,6 +2,7 @@ namespace Doctrine\Tests\DBAL\Schema; +use Doctrine\DBAL\DBALException; use Doctrine\DBAL\Schema\Column; use Doctrine\DBAL\Schema\ForeignKeyConstraint; use Doctrine\DBAL\Schema\Index; @@ -12,8 +13,9 @@ class TableTest extends \Doctrine\Tests\DbalTestCase { public function testCreateWithInvalidTableName() { - $this->expectException('Doctrine\DBAL\DBALException'); - $table = new \Doctrine\DBAL\Schema\Table(''); + $this->expectException(DBALException::class); + + new \Doctrine\DBAL\Schema\Table(''); } public function testGetName() @@ -601,7 +603,9 @@ public function testAddIndexWithQuotedColumns() $table = new Table("test"); $table->addColumn('"foo"', 'integer'); $table->addColumn('bar', 'integer'); - $table->addIndex(array('"foo"', '"bar"')); + $table->addIndex(['"foo"', '"bar"']); + + self::assertTrue($table->columnsAreIndexed(['"foo"', '"bar"'])); } /** @@ -612,7 +616,9 @@ public function testAddForeignKeyWithQuotedColumnsAndTable() $table = new Table("test"); $table->addColumn('"foo"', 'integer'); $table->addColumn('bar', 'integer'); - $table->addForeignKeyConstraint('"boing"', array('"foo"', '"bar"'), array("id")); + $table->addForeignKeyConstraint('"boing"', ['"foo"', '"bar"'], ["id"]); + + self::assertCount(1, $table->getForeignKeys()); } /** From 62eb475891cd9aa18cbc802532683b3c5b40d5fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lu=C3=ADs=20Cobucci?= Date: Fri, 8 Sep 2017 13:32:40 -0300 Subject: [PATCH 4/5] Use `self::assert*()` instead of `$this->assert*()` --- .../DBAL/Cache/QueryCacheProfileTest.php | 10 +- .../Doctrine/Tests/DBAL/ConfigurationTest.php | 6 +- tests/Doctrine/Tests/DBAL/ConnectionTest.php | 62 +-- .../Doctrine/Tests/DBAL/DBALExceptionTest.php | 8 +- .../Tests/DBAL/Driver/AbstractDriverTest.php | 18 +- .../DBAL/Driver/AbstractMySQLDriverTest.php | 2 +- .../DBAL/Driver/AbstractOracleDriverTest.php | 4 +- .../Driver/AbstractPostgreSQLDriverTest.php | 2 +- .../DBAL/Driver/AbstractSQLiteDriverTest.php | 2 +- .../Driver/DrizzlePDOMySql/DriverTest.php | 2 +- .../DBAL/Driver/IBMDB2/DB2ConnectionTest.php | 2 +- .../DBAL/Driver/IBMDB2/DB2DriverTest.php | 2 +- .../Tests/DBAL/Driver/Mysqli/DriverTest.php | 2 +- .../Driver/Mysqli/MysqliConnectionTest.php | 2 +- .../Tests/DBAL/Driver/OCI8/DriverTest.php | 2 +- .../DBAL/Driver/OCI8/OCI8ConnectionTest.php | 2 +- .../Tests/DBAL/Driver/PDOExceptionTest.php | 10 +- .../Tests/DBAL/Driver/PDOIbm/DriverTest.php | 2 +- .../Tests/DBAL/Driver/PDOMySql/DriverTest.php | 2 +- .../DBAL/Driver/PDOOracle/DriverTest.php | 2 +- .../Tests/DBAL/Driver/PDOPgSql/DriverTest.php | 14 +- .../DBAL/Driver/PDOSqlite/DriverTest.php | 2 +- .../DBAL/Driver/PDOSqlsrv/DriverTest.php | 2 +- .../DBAL/Driver/SQLAnywhere/DriverTest.php | 2 +- .../SQLAnywhere/SQLAnywhereConnectionTest.php | 2 +- .../Tests/DBAL/Driver/SQLSrv/DriverTest.php | 2 +- .../Driver/SQLSrv/SQLSrvConnectionTest.php | 2 +- .../Doctrine/Tests/DBAL/DriverManagerTest.php | 14 +- .../DBAL/Events/MysqlSessionInitTest.php | 2 +- .../DBAL/Events/OracleSessionInitTest.php | 2 +- .../Tests/DBAL/Events/SQLSessionInitTest.php | 2 +- .../InvalidArgumentExceptionTest.php | 4 +- .../Tests/DBAL/Functional/BlobTest.php | 20 +- .../Tests/DBAL/Functional/ConnectionTest.php | 60 +-- .../Tests/DBAL/Functional/DataAccessTest.php | 234 +++++----- .../Functional/Driver/AbstractDriverTest.php | 4 +- .../Driver/Mysqli/ConnectionTest.php | 4 +- .../Driver/OCI8/OCI8ConnectionTest.php | 2 +- .../Functional/Driver/OCI8/StatementTest.php | 2 +- .../Functional/Driver/PDOConnectionTest.php | 2 +- .../Functional/Driver/PDOPgSql/DriverTest.php | 4 +- .../Driver/PDOPgsqlConnectionTest.php | 2 +- .../Driver/SQLAnywhere/ConnectionTest.php | 4 +- .../Driver/SQLAnywhere/DriverTest.php | 2 +- .../Driver/SQLAnywhere/StatementTest.php | 8 +- .../Functional/MasterSlaveConnectionTest.php | 34 +- .../DBAL/Functional/ModifyLimitQueryTest.php | 4 +- .../DBAL/Functional/NamedParametersTest.php | 2 +- .../Tests/DBAL/Functional/PortabilityTest.php | 18 +- .../Tests/DBAL/Functional/ResultCacheTest.php | 40 +- .../Schema/Db2SchemaManagerTest.php | 8 +- .../Schema/DrizzleSchemaManagerTest.php | 16 +- .../Schema/MySqlSchemaManagerTest.php | 84 ++-- .../Schema/OracleSchemaManagerTest.php | 116 ++--- .../Schema/PostgreSqlSchemaManagerTest.php | 98 ++--- .../Schema/SQLAnywhereSchemaManagerTest.php | 28 +- .../Schema/SQLServerSchemaManagerTest.php | 122 ++--- .../SchemaManagerFunctionalTestCase.php | 416 +++++++++--------- .../Schema/SqliteSchemaManagerTest.php | 56 +-- .../Tests/DBAL/Functional/StatementTest.php | 40 +- .../DBAL/Functional/TableGeneratorTest.php | 10 +- .../DBAL/Functional/TemporaryTableTest.php | 4 +- .../DBAL/Functional/Ticket/DBAL168Test.php | 4 +- .../DBAL/Functional/Ticket/DBAL202Test.php | 4 +- .../DBAL/Functional/Ticket/DBAL421Test.php | 4 +- .../DBAL/Functional/Ticket/DBAL461Test.php | 2 +- .../DBAL/Functional/Ticket/DBAL510Test.php | 2 +- .../DBAL/Functional/Ticket/DBAL630Test.php | 20 +- .../DBAL/Functional/Ticket/DBAL752Test.php | 36 +- .../DBAL/Functional/TypeConversionTest.php | 8 +- .../Tests/DBAL/Functional/WriteTest.php | 62 +-- .../Tests/DBAL/Logging/DebugStackTest.php | 8 +- .../AbstractMySQLPlatformTestCase.php | 178 ++++---- .../Platforms/AbstractPlatformTestCase.php | 142 +++--- .../AbstractPostgreSqlPlatformTestCase.php | 150 +++---- .../AbstractSQLServerPlatformTestCase.php | 266 +++++------ .../Tests/DBAL/Platforms/DB2PlatformTest.php | 216 ++++----- .../DBAL/Platforms/MySQL57PlatformTest.php | 8 +- .../DBAL/Platforms/MySqlPlatformTest.php | 2 +- .../DBAL/Platforms/OraclePlatformTest.php | 134 +++--- .../Platforms/PostgreSQL91PlatformTest.php | 2 +- .../Platforms/PostgreSQL92PlatformTest.php | 16 +- .../Platforms/PostgreSQL94PlatformTest.php | 8 +- .../DBAL/Platforms/PostgreSqlPlatformTest.php | 2 +- .../ReservedKeywordsValidatorTest.php | 6 +- .../Platforms/SQLAnywhere11PlatformTest.php | 2 +- .../Platforms/SQLAnywhere12PlatformTest.php | 30 +- .../Platforms/SQLAnywhere16PlatformTest.php | 6 +- .../Platforms/SQLAnywherePlatformTest.php | 306 ++++++------- .../DBAL/Platforms/SQLAzurePlatformTest.php | 2 +- .../Platforms/SQLServer2008PlatformTest.php | 2 +- .../Platforms/SQLServer2012PlatformTest.php | 70 +-- .../DBAL/Platforms/SQLServerPlatformTest.php | 4 +- .../DBAL/Platforms/SqlitePlatformTest.php | 118 ++--- .../Tests/DBAL/Portability/StatementTest.php | 24 +- .../Expression/CompositeExpressionTest.php | 18 +- .../Expression/ExpressionBuilderTest.php | 30 +- .../Tests/DBAL/Query/QueryBuilderTest.php | 192 ++++---- .../Tests/DBAL/SQLParserUtilsTest.php | 8 +- .../Tests/DBAL/Schema/ColumnDiffTest.php | 6 +- .../Doctrine/Tests/DBAL/Schema/ColumnTest.php | 62 +-- .../Tests/DBAL/Schema/ComparatorTest.php | 212 ++++----- .../DBAL/Schema/DB2SchemaManagerTest.php | 2 +- .../DBAL/Schema/ForeignKeyConstraintTest.php | 2 +- .../Doctrine/Tests/DBAL/Schema/IndexTest.php | 90 ++-- .../DBAL/Schema/MySqlSchemaManagerTest.php | 8 +- .../DBAL/Schema/Platforms/MySQLSchemaTest.php | 6 +- .../Schema/PostgreSQLSchemaManagerTest.php | 2 +- .../Tests/DBAL/Schema/SchemaDiffTest.php | 4 +- .../Doctrine/Tests/DBAL/Schema/SchemaTest.php | 160 +++---- .../Tests/DBAL/Schema/SequenceTest.php | 16 +- .../DBAL/Schema/SqliteSchemaManagerTest.php | 2 +- .../SingleDatabaseSynchronizerTest.php | 8 +- .../Tests/DBAL/Schema/TableDiffTest.php | 8 +- .../Doctrine/Tests/DBAL/Schema/TableTest.php | 370 ++++++++-------- .../Visitor/CreateSchemaSqlCollectorTest.php | 16 +- .../Visitor/RemoveNamespacedAssetsTest.php | 6 +- .../Schema/Visitor/SchemaSqlCollectorTest.php | 4 +- .../Sharding/PoolingShardConnectionTest.php | 52 +-- .../DBAL/Sharding/PoolingShardManagerTest.php | 10 +- .../DBAL/Sharding/SQLAzure/FunctionalTest.php | 6 +- .../SQLAzure/MultiTenantVisitorTest.php | 10 +- .../SQLAzureFederationsSynchronizerTest.php | 6 +- .../SQLAzure/SQLAzureShardManagerTest.php | 4 +- .../MultiTenantShardChoserTest.php | 4 +- .../DBAL/Tools/Console/RunSqlCommandTest.php | 16 +- tests/Doctrine/Tests/DBAL/Types/ArrayTest.php | 8 +- .../Tests/DBAL/Types/BaseDateTypeTestCase.php | 8 +- .../Doctrine/Tests/DBAL/Types/BinaryTest.php | 14 +- tests/Doctrine/Tests/DBAL/Types/BlobTest.php | 8 +- .../Doctrine/Tests/DBAL/Types/BooleanTest.php | 6 +- .../DBAL/Types/ConversionExceptionTest.php | 12 +- .../DBAL/Types/DateImmutableTypeTest.php | 22 +- .../Tests/DBAL/Types/DateIntervalTest.php | 12 +- tests/Doctrine/Tests/DBAL/Types/DateTest.php | 12 +- .../DBAL/Types/DateTimeImmutableTypeTest.php | 22 +- .../Tests/DBAL/Types/DateTimeTest.php | 8 +- .../Types/DateTimeTzImmutableTypeTest.php | 20 +- .../Tests/DBAL/Types/DateTimeTzTest.php | 6 +- .../Doctrine/Tests/DBAL/Types/DecimalTest.php | 4 +- tests/Doctrine/Tests/DBAL/Types/FloatTest.php | 8 +- .../Tests/DBAL/Types/GuidTypeTest.php | 10 +- .../Doctrine/Tests/DBAL/Types/IntegerTest.php | 6 +- .../Tests/DBAL/Types/JsonArrayTest.php | 16 +- tests/Doctrine/Tests/DBAL/Types/JsonTest.php | 16 +- .../Doctrine/Tests/DBAL/Types/ObjectTest.php | 8 +- .../Tests/DBAL/Types/SmallIntTest.php | 6 +- .../Doctrine/Tests/DBAL/Types/StringTest.php | 16 +- .../DBAL/Types/TimeImmutableTypeTest.php | 22 +- tests/Doctrine/Tests/DBAL/Types/TimeTest.php | 6 +- .../Types/VarDateTimeImmutableTypeTest.php | 18 +- .../Tests/DBAL/Types/VarDateTimeTest.php | 18 +- tests/Doctrine/Tests/DBAL/UtilTest.php | 6 +- .../Tests/DbalPerformanceTestCase.php | 4 +- 154 files changed, 2572 insertions(+), 2572 deletions(-) diff --git a/tests/Doctrine/Tests/DBAL/Cache/QueryCacheProfileTest.php b/tests/Doctrine/Tests/DBAL/Cache/QueryCacheProfileTest.php index 88219f215d5..fcc46382d18 100644 --- a/tests/Doctrine/Tests/DBAL/Cache/QueryCacheProfileTest.php +++ b/tests/Doctrine/Tests/DBAL/Cache/QueryCacheProfileTest.php @@ -40,7 +40,7 @@ public function testShouldUseTheGivenCacheKeyIfPresent() $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 @@ public function testShouldGenerateAnAutomaticKeyIfNoKeyHasBeenGiven() $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 @@ public function testShouldGenerateDifferentKeysForSameQueryAndParamsAndDifferent $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 @@ public function testShouldGenerateSameKeysIfNoneOfTheParamsChanges() $connectionParams ); - $this->assertEquals($firstCacheKey, $secondCacheKey, 'Cache keys should be the same'); + self::assertEquals($firstCacheKey, $secondCacheKey, 'Cache keys should be the same'); } } diff --git a/tests/Doctrine/Tests/DBAL/ConfigurationTest.php b/tests/Doctrine/Tests/DBAL/ConfigurationTest.php index 3d95cc7cf21..4379b3b35a9 100644 --- a/tests/Doctrine/Tests/DBAL/ConfigurationTest.php +++ b/tests/Doctrine/Tests/DBAL/ConfigurationTest.php @@ -51,7 +51,7 @@ protected function setUp() */ public function testReturnsDefaultConnectionAutoCommitMode() { - $this->assertTrue($this->config->getAutoCommit()); + self::assertTrue($this->config->getAutoCommit()); } /** @@ -63,10 +63,10 @@ public function testSetsDefaultConnectionAutoCommitMode() { $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()); } } diff --git a/tests/Doctrine/Tests/DBAL/ConnectionTest.php b/tests/Doctrine/Tests/DBAL/ConnectionTest.php index 55ec93fe110..43ed2b214cb 100644 --- a/tests/Doctrine/Tests/DBAL/ConnectionTest.php +++ b/tests/Doctrine/Tests/DBAL/ConnectionTest.php @@ -56,12 +56,12 @@ public function getExecuteUpdateMockConnection() 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 @@ public function testGetConfiguration() { $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 @@ public function testEventManagerPassedToPlatform() { $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 @@ public function testEchoSQLLogger() { $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 @@ public function testDebugSQLStack() { $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 @@ public function testDebugSQLStack() */ public function testIsAutoCommit() { - $this->assertTrue($this->_conn->isAutoCommit()); + self::assertTrue($this->_conn->isAutoCommit()); } /** @@ -218,9 +218,9 @@ public function testIsAutoCommit() 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 @@ public function testConnectStartsTransactionInNoAutoCommitMode() $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 @@ public function testCommitStartsTransactionInNoAutoCommitMode() $conn->connect(); $conn->commit(); - $this->assertTrue($conn->isTransactionActive()); + self::assertTrue($conn->isTransactionActive()); } /** @@ -276,7 +276,7 @@ public function testRollBackStartsTransactionInNoAutoCommitMode() $conn->connect(); $conn->rollBack(); - $this->assertTrue($conn->isTransactionActive()); + self::assertTrue($conn->isTransactionActive()); } /** @@ -295,13 +295,13 @@ public function testSwitchingAutoCommitModeCommitsAllCurrentTransactions() $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 @@ public function testFetchAssoc() ->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 @@ public function testFetchArray() ->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 @@ public function testFetchColumn() ->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 @@ public function testConnectionIsClosedButNotUnset() // 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 @@ public function testFetchAll() ->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 @@ public function testConnectionDoesNotMaintainTwoReferencesToExternalPDO() $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 @@ public function testPassingExternalPDOMeansConnectionIsConnected() $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 @@ public function testPlatformDetectionIsTriggerOnlyOnceOnRetrievingPlatform() ->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 @@ public function testConnectionParamsArePassedToTheQueryCacheProfileInExecuteCach /* @var $driver Driver */ $driver = $this->createMock(Driver::class); - $this->assertInstanceOf( + self::assertInstanceOf( ArrayStatement::class, (new Connection($this->params, $driver))->executeCacheQuery($query, $params, $types, $queryCacheProfileMock) ); diff --git a/tests/Doctrine/Tests/DBAL/DBALExceptionTest.php b/tests/Doctrine/Tests/DBAL/DBALExceptionTest.php index f3b813feb78..6c7a8ee8fcb 100644 --- a/tests/Doctrine/Tests/DBAL/DBALExceptionTest.php +++ b/tests/Doctrine/Tests/DBAL/DBALExceptionTest.php @@ -15,7 +15,7 @@ public function testDriverExceptionDuringQueryAcceptsBinaryData() /* @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 @@ public function getSQLState() }; $ex = new DriverException('', $inner); $e = DBALException::driverExceptionDuringQuery($driver, $ex, ''); - $this->assertSame($ex, $e); + self::assertSame($ex, $e); } public function testDriverRequiredWithUrl() @@ -48,8 +48,8 @@ public function testDriverRequiredWithUrl() $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', diff --git a/tests/Doctrine/Tests/DBAL/Driver/AbstractDriverTest.php b/tests/Doctrine/Tests/DBAL/Driver/AbstractDriverTest.php index 070e62fa434..ed4dd21d0fa 100644 --- a/tests/Doctrine/Tests/DBAL/Driver/AbstractDriverTest.php +++ b/tests/Doctrine/Tests/DBAL/Driver/AbstractDriverTest.php @@ -95,11 +95,11 @@ public function getSQLState() $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 @@ public function testCreatesDatabasePlatformForVersion() } 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 @@ public function testReturnsDatabaseName() ->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 @@ public function testReturnsSchemaManager() $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); } /** diff --git a/tests/Doctrine/Tests/DBAL/Driver/AbstractMySQLDriverTest.php b/tests/Doctrine/Tests/DBAL/Driver/AbstractMySQLDriverTest.php index 25833fcce4b..87676a1920d 100644 --- a/tests/Doctrine/Tests/DBAL/Driver/AbstractMySQLDriverTest.php +++ b/tests/Doctrine/Tests/DBAL/Driver/AbstractMySQLDriverTest.php @@ -34,7 +34,7 @@ public function testReturnsDatabaseName() ->method('query') ->will($this->returnValue($statement)); - $this->assertSame($database, $this->driver->getDatabase($connection)); + self::assertSame($database, $this->driver->getDatabase($connection)); } protected function createDriver() diff --git a/tests/Doctrine/Tests/DBAL/Driver/AbstractOracleDriverTest.php b/tests/Doctrine/Tests/DBAL/Driver/AbstractOracleDriverTest.php index 0d2dee512bf..59d3c20ae0b 100644 --- a/tests/Doctrine/Tests/DBAL/Driver/AbstractOracleDriverTest.php +++ b/tests/Doctrine/Tests/DBAL/Driver/AbstractOracleDriverTest.php @@ -22,7 +22,7 @@ public function testReturnsDatabaseName() ->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 @@ public function testReturnsDatabaseNameWithConnectDescriptor() ->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() diff --git a/tests/Doctrine/Tests/DBAL/Driver/AbstractPostgreSQLDriverTest.php b/tests/Doctrine/Tests/DBAL/Driver/AbstractPostgreSQLDriverTest.php index 5e4221c1d28..e8350cfcc45 100644 --- a/tests/Doctrine/Tests/DBAL/Driver/AbstractPostgreSQLDriverTest.php +++ b/tests/Doctrine/Tests/DBAL/Driver/AbstractPostgreSQLDriverTest.php @@ -34,7 +34,7 @@ public function testReturnsDatabaseName() ->method('query') ->will($this->returnValue($statement)); - $this->assertSame($database, $this->driver->getDatabase($connection)); + self::assertSame($database, $this->driver->getDatabase($connection)); } protected function createDriver() diff --git a/tests/Doctrine/Tests/DBAL/Driver/AbstractSQLiteDriverTest.php b/tests/Doctrine/Tests/DBAL/Driver/AbstractSQLiteDriverTest.php index a112f52e512..e1ce3f10127 100644 --- a/tests/Doctrine/Tests/DBAL/Driver/AbstractSQLiteDriverTest.php +++ b/tests/Doctrine/Tests/DBAL/Driver/AbstractSQLiteDriverTest.php @@ -23,7 +23,7 @@ public function testReturnsDatabaseName() ->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() diff --git a/tests/Doctrine/Tests/DBAL/Driver/DrizzlePDOMySql/DriverTest.php b/tests/Doctrine/Tests/DBAL/Driver/DrizzlePDOMySql/DriverTest.php index e3b0d17e565..49261714e34 100644 --- a/tests/Doctrine/Tests/DBAL/Driver/DrizzlePDOMySql/DriverTest.php +++ b/tests/Doctrine/Tests/DBAL/Driver/DrizzlePDOMySql/DriverTest.php @@ -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() diff --git a/tests/Doctrine/Tests/DBAL/Driver/IBMDB2/DB2ConnectionTest.php b/tests/Doctrine/Tests/DBAL/Driver/IBMDB2/DB2ConnectionTest.php index 2042dcac803..85343862ea3 100644 --- a/tests/Doctrine/Tests/DBAL/Driver/IBMDB2/DB2ConnectionTest.php +++ b/tests/Doctrine/Tests/DBAL/Driver/IBMDB2/DB2ConnectionTest.php @@ -28,6 +28,6 @@ protected function setUp() public function testDoesNotRequireQueryForServerVersion() { - $this->assertFalse($this->connectionMock->requiresQueryForServerVersion()); + self::assertFalse($this->connectionMock->requiresQueryForServerVersion()); } } diff --git a/tests/Doctrine/Tests/DBAL/Driver/IBMDB2/DB2DriverTest.php b/tests/Doctrine/Tests/DBAL/Driver/IBMDB2/DB2DriverTest.php index 238c2473eb3..214c889aa0c 100644 --- a/tests/Doctrine/Tests/DBAL/Driver/IBMDB2/DB2DriverTest.php +++ b/tests/Doctrine/Tests/DBAL/Driver/IBMDB2/DB2DriverTest.php @@ -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() diff --git a/tests/Doctrine/Tests/DBAL/Driver/Mysqli/DriverTest.php b/tests/Doctrine/Tests/DBAL/Driver/Mysqli/DriverTest.php index 0c25a7752bf..f38ff8a5529 100644 --- a/tests/Doctrine/Tests/DBAL/Driver/Mysqli/DriverTest.php +++ b/tests/Doctrine/Tests/DBAL/Driver/Mysqli/DriverTest.php @@ -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() diff --git a/tests/Doctrine/Tests/DBAL/Driver/Mysqli/MysqliConnectionTest.php b/tests/Doctrine/Tests/DBAL/Driver/Mysqli/MysqliConnectionTest.php index 5e119219b1d..e7e1af62bf8 100644 --- a/tests/Doctrine/Tests/DBAL/Driver/Mysqli/MysqliConnectionTest.php +++ b/tests/Doctrine/Tests/DBAL/Driver/Mysqli/MysqliConnectionTest.php @@ -30,7 +30,7 @@ protected function setUp() public function testDoesNotRequireQueryForServerVersion() { - $this->assertFalse($this->connectionMock->requiresQueryForServerVersion()); + self::assertFalse($this->connectionMock->requiresQueryForServerVersion()); } public function testRestoresErrorHandlerOnException() diff --git a/tests/Doctrine/Tests/DBAL/Driver/OCI8/DriverTest.php b/tests/Doctrine/Tests/DBAL/Driver/OCI8/DriverTest.php index b6a81844fbd..77e763a66bb 100644 --- a/tests/Doctrine/Tests/DBAL/Driver/OCI8/DriverTest.php +++ b/tests/Doctrine/Tests/DBAL/Driver/OCI8/DriverTest.php @@ -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() diff --git a/tests/Doctrine/Tests/DBAL/Driver/OCI8/OCI8ConnectionTest.php b/tests/Doctrine/Tests/DBAL/Driver/OCI8/OCI8ConnectionTest.php index 658a9b96d5f..938d86322ed 100644 --- a/tests/Doctrine/Tests/DBAL/Driver/OCI8/OCI8ConnectionTest.php +++ b/tests/Doctrine/Tests/DBAL/Driver/OCI8/OCI8ConnectionTest.php @@ -28,6 +28,6 @@ protected function setUp() public function testDoesNotRequireQueryForServerVersion() { - $this->assertFalse($this->connectionMock->requiresQueryForServerVersion()); + self::assertFalse($this->connectionMock->requiresQueryForServerVersion()); } } diff --git a/tests/Doctrine/Tests/DBAL/Driver/PDOExceptionTest.php b/tests/Doctrine/Tests/DBAL/Driver/PDOExceptionTest.php index 7845e4bf5ff..4040c2ac3e0 100644 --- a/tests/Doctrine/Tests/DBAL/Driver/PDOExceptionTest.php +++ b/tests/Doctrine/Tests/DBAL/Driver/PDOExceptionTest.php @@ -44,26 +44,26 @@ protected function setUp() 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()); } } diff --git a/tests/Doctrine/Tests/DBAL/Driver/PDOIbm/DriverTest.php b/tests/Doctrine/Tests/DBAL/Driver/PDOIbm/DriverTest.php index 28cf9709fee..6361f05575c 100644 --- a/tests/Doctrine/Tests/DBAL/Driver/PDOIbm/DriverTest.php +++ b/tests/Doctrine/Tests/DBAL/Driver/PDOIbm/DriverTest.php @@ -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() diff --git a/tests/Doctrine/Tests/DBAL/Driver/PDOMySql/DriverTest.php b/tests/Doctrine/Tests/DBAL/Driver/PDOMySql/DriverTest.php index 46be71ccebf..a965765780d 100644 --- a/tests/Doctrine/Tests/DBAL/Driver/PDOMySql/DriverTest.php +++ b/tests/Doctrine/Tests/DBAL/Driver/PDOMySql/DriverTest.php @@ -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() diff --git a/tests/Doctrine/Tests/DBAL/Driver/PDOOracle/DriverTest.php b/tests/Doctrine/Tests/DBAL/Driver/PDOOracle/DriverTest.php index 146260524cc..f9e0da70f1c 100644 --- a/tests/Doctrine/Tests/DBAL/Driver/PDOOracle/DriverTest.php +++ b/tests/Doctrine/Tests/DBAL/Driver/PDOOracle/DriverTest.php @@ -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() diff --git a/tests/Doctrine/Tests/DBAL/Driver/PDOPgSql/DriverTest.php b/tests/Doctrine/Tests/DBAL/Driver/PDOPgSql/DriverTest.php index 495f690482b..c162ef96491 100644 --- a/tests/Doctrine/Tests/DBAL/Driver/PDOPgSql/DriverTest.php +++ b/tests/Doctrine/Tests/DBAL/Driver/PDOPgSql/DriverTest.php @@ -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 @@ public function testConnectionDisablesPreparesOnPhp56() $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 @@ public function testConnectionDoesNotDisablePreparesOnPhp56WhenAttributeDefined( 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 @@ public function testConnectionDisablePreparesOnPhp56WhenDisablePreparesIsExplici 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'); diff --git a/tests/Doctrine/Tests/DBAL/Driver/PDOSqlite/DriverTest.php b/tests/Doctrine/Tests/DBAL/Driver/PDOSqlite/DriverTest.php index f147845555f..49a604ccd07 100644 --- a/tests/Doctrine/Tests/DBAL/Driver/PDOSqlite/DriverTest.php +++ b/tests/Doctrine/Tests/DBAL/Driver/PDOSqlite/DriverTest.php @@ -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() diff --git a/tests/Doctrine/Tests/DBAL/Driver/PDOSqlsrv/DriverTest.php b/tests/Doctrine/Tests/DBAL/Driver/PDOSqlsrv/DriverTest.php index 6a60248a4b0..bf060365838 100644 --- a/tests/Doctrine/Tests/DBAL/Driver/PDOSqlsrv/DriverTest.php +++ b/tests/Doctrine/Tests/DBAL/Driver/PDOSqlsrv/DriverTest.php @@ -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() diff --git a/tests/Doctrine/Tests/DBAL/Driver/SQLAnywhere/DriverTest.php b/tests/Doctrine/Tests/DBAL/Driver/SQLAnywhere/DriverTest.php index 9053dce613c..54b1912a911 100644 --- a/tests/Doctrine/Tests/DBAL/Driver/SQLAnywhere/DriverTest.php +++ b/tests/Doctrine/Tests/DBAL/Driver/SQLAnywhere/DriverTest.php @@ -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() diff --git a/tests/Doctrine/Tests/DBAL/Driver/SQLAnywhere/SQLAnywhereConnectionTest.php b/tests/Doctrine/Tests/DBAL/Driver/SQLAnywhere/SQLAnywhereConnectionTest.php index b98a0d02bcd..da4b4462699 100644 --- a/tests/Doctrine/Tests/DBAL/Driver/SQLAnywhere/SQLAnywhereConnectionTest.php +++ b/tests/Doctrine/Tests/DBAL/Driver/SQLAnywhere/SQLAnywhereConnectionTest.php @@ -28,6 +28,6 @@ protected function setUp() public function testRequiresQueryForServerVersion() { - $this->assertTrue($this->connectionMock->requiresQueryForServerVersion()); + self::assertTrue($this->connectionMock->requiresQueryForServerVersion()); } } diff --git a/tests/Doctrine/Tests/DBAL/Driver/SQLSrv/DriverTest.php b/tests/Doctrine/Tests/DBAL/Driver/SQLSrv/DriverTest.php index cf9f0c08631..b99516f7048 100644 --- a/tests/Doctrine/Tests/DBAL/Driver/SQLSrv/DriverTest.php +++ b/tests/Doctrine/Tests/DBAL/Driver/SQLSrv/DriverTest.php @@ -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() diff --git a/tests/Doctrine/Tests/DBAL/Driver/SQLSrv/SQLSrvConnectionTest.php b/tests/Doctrine/Tests/DBAL/Driver/SQLSrv/SQLSrvConnectionTest.php index 807815a93d0..5cc8f847b41 100644 --- a/tests/Doctrine/Tests/DBAL/Driver/SQLSrv/SQLSrvConnectionTest.php +++ b/tests/Doctrine/Tests/DBAL/Driver/SQLSrv/SQLSrvConnectionTest.php @@ -28,6 +28,6 @@ protected function setUp() public function testDoesNotRequireQueryForServerVersion() { - $this->assertFalse($this->connectionMock->requiresQueryForServerVersion()); + self::assertFalse($this->connectionMock->requiresQueryForServerVersion()); } } diff --git a/tests/Doctrine/Tests/DBAL/DriverManagerTest.php b/tests/Doctrine/Tests/DBAL/DriverManagerTest.php index d71d51c3b98..d5155de2f73 100644 --- a/tests/Doctrine/Tests/DBAL/DriverManagerTest.php +++ b/tests/Doctrine/Tests/DBAL/DriverManagerTest.php @@ -24,7 +24,7 @@ public function testValidPdoInstance() '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 @@ public function testPdoInstanceSetErrorMode() ); $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 @@ public function testCustomPlatform() ); $conn = \Doctrine\DBAL\DriverManager::getConnection($options); - $this->assertSame($mockPlatform, $conn->getDatabasePlatform()); + self::assertSame($mockPlatform, $conn->getDatabasePlatform()); } public function testCustomWrapper() @@ -80,7 +80,7 @@ public function testCustomWrapper() ); $conn = \Doctrine\DBAL\DriverManager::getConnection($options); - $this->assertInstanceOf($wrapperClass, $conn); + self::assertInstanceOf($wrapperClass, $conn); } public function testInvalidWrapperClass() @@ -113,7 +113,7 @@ public function testValidDriverClass() ); $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 @@ public function testDatabaseUrl($url, $expected) $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]); } } } diff --git a/tests/Doctrine/Tests/DBAL/Events/MysqlSessionInitTest.php b/tests/Doctrine/Tests/DBAL/Events/MysqlSessionInitTest.php index 670133ed23b..2a19d2c5fee 100644 --- a/tests/Doctrine/Tests/DBAL/Events/MysqlSessionInitTest.php +++ b/tests/Doctrine/Tests/DBAL/Events/MysqlSessionInitTest.php @@ -26,6 +26,6 @@ public function testPostConnect() public function testGetSubscribedEvents() { $listener = new MysqlSessionInit(); - $this->assertEquals(array(Events::postConnect), $listener->getSubscribedEvents()); + self::assertEquals(array(Events::postConnect), $listener->getSubscribedEvents()); } } diff --git a/tests/Doctrine/Tests/DBAL/Events/OracleSessionInitTest.php b/tests/Doctrine/Tests/DBAL/Events/OracleSessionInitTest.php index 5a9b5cc511d..60648a13dbd 100644 --- a/tests/Doctrine/Tests/DBAL/Events/OracleSessionInitTest.php +++ b/tests/Doctrine/Tests/DBAL/Events/OracleSessionInitTest.php @@ -54,6 +54,6 @@ public function getPostConnectWithSessionParameterValuesData() public function testGetSubscribedEvents() { $listener = new OracleSessionInit(); - $this->assertEquals(array(Events::postConnect), $listener->getSubscribedEvents()); + self::assertEquals(array(Events::postConnect), $listener->getSubscribedEvents()); } } diff --git a/tests/Doctrine/Tests/DBAL/Events/SQLSessionInitTest.php b/tests/Doctrine/Tests/DBAL/Events/SQLSessionInitTest.php index e1572d5d9e0..2b25301da98 100644 --- a/tests/Doctrine/Tests/DBAL/Events/SQLSessionInitTest.php +++ b/tests/Doctrine/Tests/DBAL/Events/SQLSessionInitTest.php @@ -28,6 +28,6 @@ public function testPostConnect() 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()); } } diff --git a/tests/Doctrine/Tests/DBAL/Exception/InvalidArgumentExceptionTest.php b/tests/Doctrine/Tests/DBAL/Exception/InvalidArgumentExceptionTest.php index 967f4551615..9984e3d0223 100644 --- a/tests/Doctrine/Tests/DBAL/Exception/InvalidArgumentExceptionTest.php +++ b/tests/Doctrine/Tests/DBAL/Exception/InvalidArgumentExceptionTest.php @@ -34,7 +34,7 @@ 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()); } } diff --git a/tests/Doctrine/Tests/DBAL/Functional/BlobTest.php b/tests/Doctrine/Tests/DBAL/Functional/BlobTest.php index 86cd3f5a56a..bbe396848e3 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/BlobTest.php +++ b/tests/Doctrine/Tests/DBAL/Functional/BlobTest.php @@ -41,12 +41,12 @@ public function testInsert() 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 @@ public function testSelect() 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 @@ private function assertBinaryContains($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('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 +} diff --git a/tests/Doctrine/Tests/DBAL/Functional/ConnectionTest.php b/tests/Doctrine/Tests/DBAL/Functional/ConnectionTest.php index 29b6117bee7..05528e1e3fd 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/ConnectionTest.php +++ b/tests/Doctrine/Tests/DBAL/Functional/ConnectionTest.php @@ -23,7 +23,7 @@ protected function tearDown() 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 @@ public function testTransactionNestingBehavior() { 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 @@ public function testTransactionNestingBehaviorWithSavepoints() $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 @@ public function testTransactionBehaviorWithRollback() { 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 @@ public function testTransactionBehaviour() { 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 @@ public function testTransactionalWithException() }); $this->fail('Expected exception'); } catch (\RuntimeException $expected) { - $this->assertEquals(0, $this->_conn->getTransactionNestingLevel()); + self::assertEquals(0, $this->_conn->getTransactionNestingLevel()); } } @@ -218,7 +218,7 @@ public function testTransactionalWithThrowable() }); $this->fail('Expected exception'); } catch (\Error $expected) { - $this->assertEquals(0, $this->_conn->getTransactionNestingLevel()); + self::assertEquals(0, $this->_conn->getTransactionNestingLevel()); } } @@ -238,7 +238,7 @@ public function testTransactionalReturnValue() return 42; }); - $this->assertEquals(42, $res); + self::assertEquals(42, $res); } /** @@ -246,13 +246,13 @@ public function testTransactionalReturnValue() */ 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 @@ public function testConnectWithoutExplicitDatabaseName() $this->_conn->getEventManager() ); - $this->assertTrue($connection->connect()); + self::assertTrue($connection->connect()); $connection->close(); } @@ -296,9 +296,9 @@ public function testDeterminesDatabasePlatformWhenConnectingToNonExistentDatabas $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(); } diff --git a/tests/Doctrine/Tests/DBAL/Functional/DataAccessTest.php b/tests/Doctrine/Tests/DBAL/Functional/DataAccessTest.php index 7c191dc9844..bf02c830c54 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/DataAccessTest.php +++ b/tests/Doctrine/Tests/DBAL/Functional/DataAccessTest.php @@ -35,7 +35,7 @@ public function testPrepareWithBindValue() { $sql = "SELECT test_int, test_string FROM fetch_table WHERE test_int = ? AND test_string = ?"; $stmt = $this->_conn->prepare($sql); - $this->assertInstanceOf('Doctrine\DBAL\Statement', $stmt); + self::assertInstanceOf('Doctrine\DBAL\Statement', $stmt); $stmt->bindValue(1, 1); $stmt->bindValue(2, 'foo'); @@ -43,7 +43,7 @@ public function testPrepareWithBindValue() $row = $stmt->fetch(\PDO::FETCH_ASSOC); $row = array_change_key_case($row, \CASE_LOWER); - $this->assertEquals(array('test_int' => 1, 'test_string' => 'foo'), $row); + self::assertEquals(array('test_int' => 1, 'test_string' => 'foo'), $row); } public function testPrepareWithBindParam() @@ -53,7 +53,7 @@ public function testPrepareWithBindParam() $sql = "SELECT test_int, test_string FROM fetch_table WHERE test_int = ? AND test_string = ?"; $stmt = $this->_conn->prepare($sql); - $this->assertInstanceOf('Doctrine\DBAL\Statement', $stmt); + self::assertInstanceOf('Doctrine\DBAL\Statement', $stmt); $stmt->bindParam(1, $paramInt); $stmt->bindParam(2, $paramStr); @@ -61,7 +61,7 @@ public function testPrepareWithBindParam() $row = $stmt->fetch(\PDO::FETCH_ASSOC); $row = array_change_key_case($row, \CASE_LOWER); - $this->assertEquals(array('test_int' => 1, 'test_string' => 'foo'), $row); + self::assertEquals(array('test_int' => 1, 'test_string' => 'foo'), $row); } public function testPrepareWithFetchAll() @@ -71,7 +71,7 @@ public function testPrepareWithFetchAll() $sql = "SELECT test_int, test_string FROM fetch_table WHERE test_int = ? AND test_string = ?"; $stmt = $this->_conn->prepare($sql); - $this->assertInstanceOf('Doctrine\DBAL\Statement', $stmt); + self::assertInstanceOf('Doctrine\DBAL\Statement', $stmt); $stmt->bindParam(1, $paramInt); $stmt->bindParam(2, $paramStr); @@ -79,7 +79,7 @@ public function testPrepareWithFetchAll() $rows = $stmt->fetchAll(\PDO::FETCH_ASSOC); $rows[0] = array_change_key_case($rows[0], \CASE_LOWER); - $this->assertEquals(array('test_int' => 1, 'test_string' => 'foo'), $rows[0]); + self::assertEquals(array('test_int' => 1, 'test_string' => 'foo'), $rows[0]); } /** @@ -92,7 +92,7 @@ public function testPrepareWithFetchAllBoth() $sql = "SELECT test_int, test_string FROM fetch_table WHERE test_int = ? AND test_string = ?"; $stmt = $this->_conn->prepare($sql); - $this->assertInstanceOf('Doctrine\DBAL\Statement', $stmt); + self::assertInstanceOf('Doctrine\DBAL\Statement', $stmt); $stmt->bindParam(1, $paramInt); $stmt->bindParam(2, $paramStr); @@ -100,7 +100,7 @@ public function testPrepareWithFetchAllBoth() $rows = $stmt->fetchAll(\PDO::FETCH_BOTH); $rows[0] = array_change_key_case($rows[0], \CASE_LOWER); - $this->assertEquals(array('test_int' => 1, 'test_string' => 'foo', 0 => 1, 1 => 'foo'), $rows[0]); + self::assertEquals(array('test_int' => 1, 'test_string' => 'foo', 0 => 1, 1 => 'foo'), $rows[0]); } public function testPrepareWithFetchColumn() @@ -110,14 +110,14 @@ public function testPrepareWithFetchColumn() $sql = "SELECT test_int FROM fetch_table WHERE test_int = ? AND test_string = ?"; $stmt = $this->_conn->prepare($sql); - $this->assertInstanceOf('Doctrine\DBAL\Statement', $stmt); + self::assertInstanceOf('Doctrine\DBAL\Statement', $stmt); $stmt->bindParam(1, $paramInt); $stmt->bindParam(2, $paramStr); $stmt->execute(); $column = $stmt->fetchColumn(); - $this->assertEquals(1, $column); + self::assertEquals(1, $column); } public function testPrepareWithIterator() @@ -127,7 +127,7 @@ public function testPrepareWithIterator() $sql = "SELECT test_int, test_string FROM fetch_table WHERE test_int = ? AND test_string = ?"; $stmt = $this->_conn->prepare($sql); - $this->assertInstanceOf('Doctrine\DBAL\Statement', $stmt); + self::assertInstanceOf('Doctrine\DBAL\Statement', $stmt); $stmt->bindParam(1, $paramInt); $stmt->bindParam(2, $paramStr); @@ -139,7 +139,7 @@ public function testPrepareWithIterator() $rows[] = array_change_key_case($row, \CASE_LOWER); } - $this->assertEquals(array('test_int' => 1, 'test_string' => 'foo'), $rows[0]); + self::assertEquals(array('test_int' => 1, 'test_string' => 'foo'), $rows[0]); } public function testPrepareWithQuoted() @@ -151,7 +151,7 @@ public function testPrepareWithQuoted() $sql = "SELECT test_int, test_string FROM " . $this->_conn->quoteIdentifier($table) . " ". "WHERE test_int = " . $this->_conn->quote($paramInt) . " AND test_string = " . $this->_conn->quote($paramStr); $stmt = $this->_conn->prepare($sql); - $this->assertInstanceOf('Doctrine\DBAL\Statement', $stmt); + self::assertInstanceOf('Doctrine\DBAL\Statement', $stmt); } public function testPrepareWithExecuteParams() @@ -161,13 +161,13 @@ public function testPrepareWithExecuteParams() $sql = "SELECT test_int, test_string FROM fetch_table WHERE test_int = ? AND test_string = ?"; $stmt = $this->_conn->prepare($sql); - $this->assertInstanceOf('Doctrine\DBAL\Statement', $stmt); + self::assertInstanceOf('Doctrine\DBAL\Statement', $stmt); $stmt->execute(array($paramInt, $paramStr)); $row = $stmt->fetch(\PDO::FETCH_ASSOC); - $this->assertTrue($row !== false); + self::assertTrue($row !== false); $row = array_change_key_case($row, \CASE_LOWER); - $this->assertEquals(array('test_int' => 1, 'test_string' => 'foo'), $row); + self::assertEquals(array('test_int' => 1, 'test_string' => 'foo'), $row); } public function testFetchAll() @@ -175,14 +175,14 @@ public function testFetchAll() $sql = "SELECT test_int, test_string FROM fetch_table WHERE test_int = ? AND test_string = ?"; $data = $this->_conn->fetchAll($sql, array(1, 'foo')); - $this->assertEquals(1, count($data)); + self::assertEquals(1, count($data)); $row = $data[0]; - $this->assertEquals(2, count($row)); + self::assertEquals(2, count($row)); $row = array_change_key_case($row, \CASE_LOWER); - $this->assertEquals(1, $row['test_int']); - $this->assertEquals('foo', $row['test_string']); + self::assertEquals(1, $row['test_int']); + self::assertEquals('foo', $row['test_string']); } /** @@ -195,14 +195,14 @@ public function testFetchAllWithTypes() $sql = "SELECT test_int, test_datetime FROM fetch_table WHERE test_int = ? AND test_datetime = ?"; $data = $this->_conn->fetchAll($sql, array(1, $datetime), array(PDO::PARAM_STR, Type::DATETIME)); - $this->assertEquals(1, count($data)); + self::assertEquals(1, count($data)); $row = $data[0]; - $this->assertEquals(2, count($row)); + self::assertEquals(2, count($row)); $row = array_change_key_case($row, \CASE_LOWER); - $this->assertEquals(1, $row['test_int']); - $this->assertStringStartsWith($datetimeString, $row['test_datetime']); + self::assertEquals(1, $row['test_int']); + self::assertStringStartsWith($datetimeString, $row['test_datetime']); } /** @@ -227,14 +227,14 @@ public function testFetchBoth() $sql = "SELECT test_int, test_string FROM fetch_table WHERE test_int = ? AND test_string = ?"; $row = $this->_conn->executeQuery($sql, array(1, 'foo'))->fetch(\PDO::FETCH_BOTH); - $this->assertTrue($row !== false); + self::assertTrue($row !== false); $row = array_change_key_case($row, \CASE_LOWER); - $this->assertEquals(1, $row['test_int']); - $this->assertEquals('foo', $row['test_string']); - $this->assertEquals(1, $row[0]); - $this->assertEquals('foo', $row[1]); + self::assertEquals(1, $row['test_int']); + self::assertEquals('foo', $row['test_string']); + self::assertEquals(1, $row[0]); + self::assertEquals('foo', $row[1]); } public function testFetchNoResult() @@ -249,12 +249,12 @@ public function testFetchAssoc() $sql = "SELECT test_int, test_string FROM fetch_table WHERE test_int = ? AND test_string = ?"; $row = $this->_conn->fetchAssoc($sql, array(1, 'foo')); - $this->assertTrue($row !== false); + self::assertTrue($row !== false); $row = array_change_key_case($row, \CASE_LOWER); - $this->assertEquals(1, $row['test_int']); - $this->assertEquals('foo', $row['test_string']); + self::assertEquals(1, $row['test_int']); + self::assertEquals('foo', $row['test_string']); } public function testFetchAssocWithTypes() @@ -264,12 +264,12 @@ public function testFetchAssocWithTypes() $sql = "SELECT test_int, test_datetime FROM fetch_table WHERE test_int = ? AND test_datetime = ?"; $row = $this->_conn->fetchAssoc($sql, array(1, $datetime), array(PDO::PARAM_STR, Type::DATETIME)); - $this->assertTrue($row !== false); + self::assertTrue($row !== false); $row = array_change_key_case($row, \CASE_LOWER); - $this->assertEquals(1, $row['test_int']); - $this->assertStringStartsWith($datetimeString, $row['test_datetime']); + self::assertEquals(1, $row['test_int']); + self::assertStringStartsWith($datetimeString, $row['test_datetime']); } /** @@ -293,8 +293,8 @@ public function testFetchArray() $sql = "SELECT test_int, test_string FROM fetch_table WHERE test_int = ? AND test_string = ?"; $row = $this->_conn->fetchArray($sql, array(1, 'foo')); - $this->assertEquals(1, $row[0]); - $this->assertEquals('foo', $row[1]); + self::assertEquals(1, $row[0]); + self::assertEquals('foo', $row[1]); } public function testFetchArrayWithTypes() @@ -304,12 +304,12 @@ public function testFetchArrayWithTypes() $sql = "SELECT test_int, test_datetime FROM fetch_table WHERE test_int = ? AND test_datetime = ?"; $row = $this->_conn->fetchArray($sql, array(1, $datetime), array(PDO::PARAM_STR, Type::DATETIME)); - $this->assertTrue($row !== false); + self::assertTrue($row !== false); $row = array_change_key_case($row, \CASE_LOWER); - $this->assertEquals(1, $row[0]); - $this->assertStringStartsWith($datetimeString, $row[1]); + self::assertEquals(1, $row[0]); + self::assertStringStartsWith($datetimeString, $row[1]); } /** @@ -333,12 +333,12 @@ public function testFetchColumn() $sql = "SELECT test_int, test_string FROM fetch_table WHERE test_int = ? AND test_string = ?"; $testInt = $this->_conn->fetchColumn($sql, array(1, 'foo'), 0); - $this->assertEquals(1, $testInt); + self::assertEquals(1, $testInt); $sql = "SELECT test_int, test_string FROM fetch_table WHERE test_int = ? AND test_string = ?"; $testString = $this->_conn->fetchColumn($sql, array(1, 'foo'), 1); - $this->assertEquals('foo', $testString); + self::assertEquals('foo', $testString); } public function testFetchColumnWithTypes() @@ -348,9 +348,9 @@ public function testFetchColumnWithTypes() $sql = "SELECT test_int, test_datetime FROM fetch_table WHERE test_int = ? AND test_datetime = ?"; $column = $this->_conn->fetchColumn($sql, array(1, $datetime), 1, array(PDO::PARAM_STR, Type::DATETIME)); - $this->assertTrue($column !== false); + self::assertTrue($column !== false); - $this->assertStringStartsWith($datetimeString, $column); + self::assertStringStartsWith($datetimeString, $column); } /** @@ -380,7 +380,7 @@ public function testExecuteQueryBindDateTimeType() array(1 => Type::DATETIME) ); - $this->assertEquals(1, $stmt->fetchColumn()); + self::assertEquals(1, $stmt->fetchColumn()); } /** @@ -396,8 +396,8 @@ public function testExecuteUpdateBindDateTimeType() array(1 => PDO::PARAM_INT, 2 => PDO::PARAM_STR, 3 => Type::DATETIME) ); - $this->assertEquals(1, $affectedRows); - $this->assertEquals(1, $this->_conn->executeQuery( + self::assertEquals(1, $affectedRows); + self::assertEquals(1, $this->_conn->executeQuery( 'SELECT count(*) AS c FROM fetch_table WHERE test_datetime = ?', array(1 => $datetime), array(1 => Type::DATETIME) @@ -414,7 +414,7 @@ public function testPrepareQueryBindValueDateTimeType() $stmt->bindValue(1, new \DateTime('2010-01-01 10:10:10'), Type::DATETIME); $stmt->execute(); - $this->assertEquals(1, $stmt->fetchColumn()); + self::assertEquals(1, $stmt->fetchColumn()); } /** @@ -430,15 +430,15 @@ public function testNativeArrayListSupport() array(array(100, 101, 102, 103, 104)), array(Connection::PARAM_INT_ARRAY)); $data = $stmt->fetchAll(PDO::FETCH_NUM); - $this->assertEquals(5, count($data)); - $this->assertEquals(array(array(100), array(101), array(102), array(103), array(104)), $data); + self::assertEquals(5, count($data)); + self::assertEquals(array(array(100), array(101), array(102), array(103), array(104)), $data); $stmt = $this->_conn->executeQuery('SELECT test_int FROM fetch_table WHERE test_string IN (?)', array(array('foo100', 'foo101', 'foo102', 'foo103', 'foo104')), array(Connection::PARAM_STR_ARRAY)); $data = $stmt->fetchAll(PDO::FETCH_NUM); - $this->assertEquals(5, count($data)); - $this->assertEquals(array(array(100), array(101), array(102), array(103), array(104)), $data); + self::assertEquals(5, count($data)); + self::assertEquals(array(array(100), array(101), array(102), array(103), array(104)), $data); } /** @@ -453,7 +453,7 @@ public function testTrimExpression($value, $position, $char, $expectedResult) $row = $this->_conn->fetchAssoc($sql); $row = array_change_key_case($row, CASE_LOWER); - $this->assertEquals($expectedResult, $row['trimmed']); + self::assertEquals($expectedResult, $row['trimmed']); } public function getTrimExpressionData() @@ -528,23 +528,23 @@ public function testDateArithmetics() $row = array_change_key_case($row, CASE_LOWER); $diff = (strtotime('2010-01-01') - strtotime(date('Y-m-d'))) / 3600 / 24; - $this->assertEquals($diff, $row['diff'], "Date difference should be approx. ".$diff." days.", 1); - $this->assertEquals('2010-01-01 10:10:11', date('Y-m-d H:i:s', strtotime($row['add_seconds'])), "Adding second should end up on 2010-01-01 10:10:11"); - $this->assertEquals('2010-01-01 10:10:09', date('Y-m-d H:i:s', strtotime($row['sub_seconds'])), "Subtracting second should end up on 2010-01-01 10:10:09"); - $this->assertEquals('2010-01-01 10:15:10', date('Y-m-d H:i:s', strtotime($row['add_minutes'])), "Adding minutes should end up on 2010-01-01 10:15:10"); - $this->assertEquals('2010-01-01 10:05:10', date('Y-m-d H:i:s', strtotime($row['sub_minutes'])), "Subtracting minutes should end up on 2010-01-01 10:05:10"); - $this->assertEquals('2010-01-01 13:10', date('Y-m-d H:i', strtotime($row['add_hour'])), "Adding date should end up on 2010-01-01 13:10"); - $this->assertEquals('2010-01-01 07:10', date('Y-m-d H:i', strtotime($row['sub_hour'])), "Subtracting date should end up on 2010-01-01 07:10"); - $this->assertEquals('2010-01-11', date('Y-m-d', strtotime($row['add_days'])), "Adding date should end up on 2010-01-11"); - $this->assertEquals('2009-12-22', date('Y-m-d', strtotime($row['sub_days'])), "Subtracting date should end up on 2009-12-22"); - $this->assertEquals('2010-01-08', date('Y-m-d', strtotime($row['add_weeks'])), "Adding week should end up on 2010-01-08"); - $this->assertEquals('2009-12-25', date('Y-m-d', strtotime($row['sub_weeks'])), "Subtracting week should end up on 2009-12-25"); - $this->assertEquals('2010-03-01', date('Y-m-d', strtotime($row['add_month'])), "Adding month should end up on 2010-03-01"); - $this->assertEquals('2009-11-01', date('Y-m-d', strtotime($row['sub_month'])), "Subtracting month should end up on 2009-11-01"); - $this->assertEquals('2010-10-01', date('Y-m-d', strtotime($row['add_quarters'])), "Adding quarters should end up on 2010-04-01"); - $this->assertEquals('2009-04-01', date('Y-m-d', strtotime($row['sub_quarters'])), "Subtracting quarters should end up on 2009-10-01"); - $this->assertEquals('2016-01-01', date('Y-m-d', strtotime($row['add_years'])), "Adding years should end up on 2016-01-01"); - $this->assertEquals('2004-01-01', date('Y-m-d', strtotime($row['sub_years'])), "Subtracting years should end up on 2004-01-01"); + self::assertEquals($diff, $row['diff'], "Date difference should be approx. ".$diff." days.", 1); + self::assertEquals('2010-01-01 10:10:11', date('Y-m-d H:i:s', strtotime($row['add_seconds'])), "Adding second should end up on 2010-01-01 10:10:11"); + self::assertEquals('2010-01-01 10:10:09', date('Y-m-d H:i:s', strtotime($row['sub_seconds'])), "Subtracting second should end up on 2010-01-01 10:10:09"); + self::assertEquals('2010-01-01 10:15:10', date('Y-m-d H:i:s', strtotime($row['add_minutes'])), "Adding minutes should end up on 2010-01-01 10:15:10"); + self::assertEquals('2010-01-01 10:05:10', date('Y-m-d H:i:s', strtotime($row['sub_minutes'])), "Subtracting minutes should end up on 2010-01-01 10:05:10"); + self::assertEquals('2010-01-01 13:10', date('Y-m-d H:i', strtotime($row['add_hour'])), "Adding date should end up on 2010-01-01 13:10"); + self::assertEquals('2010-01-01 07:10', date('Y-m-d H:i', strtotime($row['sub_hour'])), "Subtracting date should end up on 2010-01-01 07:10"); + self::assertEquals('2010-01-11', date('Y-m-d', strtotime($row['add_days'])), "Adding date should end up on 2010-01-11"); + self::assertEquals('2009-12-22', date('Y-m-d', strtotime($row['sub_days'])), "Subtracting date should end up on 2009-12-22"); + self::assertEquals('2010-01-08', date('Y-m-d', strtotime($row['add_weeks'])), "Adding week should end up on 2010-01-08"); + self::assertEquals('2009-12-25', date('Y-m-d', strtotime($row['sub_weeks'])), "Subtracting week should end up on 2009-12-25"); + self::assertEquals('2010-03-01', date('Y-m-d', strtotime($row['add_month'])), "Adding month should end up on 2010-03-01"); + self::assertEquals('2009-11-01', date('Y-m-d', strtotime($row['sub_month'])), "Subtracting month should end up on 2009-11-01"); + self::assertEquals('2010-10-01', date('Y-m-d', strtotime($row['add_quarters'])), "Adding quarters should end up on 2010-04-01"); + self::assertEquals('2009-04-01', date('Y-m-d', strtotime($row['sub_quarters'])), "Subtracting quarters should end up on 2009-10-01"); + self::assertEquals('2016-01-01', date('Y-m-d', strtotime($row['add_years'])), "Adding years should end up on 2016-01-01"); + self::assertEquals('2004-01-01', date('Y-m-d', strtotime($row['sub_years'])), "Subtracting years should end up on 2004-01-01"); } public function testLocateExpression() @@ -566,15 +566,15 @@ public function testLocateExpression() $row = $this->_conn->fetchAssoc($sql); $row = array_change_key_case($row, CASE_LOWER); - $this->assertEquals(2, $row['locate1']); - $this->assertEquals(1, $row['locate2']); - $this->assertEquals(0, $row['locate3']); - $this->assertEquals(1, $row['locate4']); - $this->assertEquals(1, $row['locate5']); - $this->assertEquals(4, $row['locate6']); - $this->assertEquals(0, $row['locate7']); - $this->assertEquals(2, $row['locate8']); - $this->assertEquals(0, $row['locate9']); + self::assertEquals(2, $row['locate1']); + self::assertEquals(1, $row['locate2']); + self::assertEquals(0, $row['locate3']); + self::assertEquals(1, $row['locate4']); + self::assertEquals(1, $row['locate5']); + self::assertEquals(4, $row['locate6']); + self::assertEquals(0, $row['locate7']); + self::assertEquals(2, $row['locate8']); + self::assertEquals(0, $row['locate9']); } public function testQuoteSQLInjection() @@ -582,7 +582,7 @@ public function testQuoteSQLInjection() $sql = "SELECT * FROM fetch_table WHERE test_string = " . $this->_conn->quote("bar' OR '1'='1"); $rows = $this->_conn->fetchAll($sql); - $this->assertEquals(0, count($rows), "no result should be returned, otherwise SQL injection is possible"); + self::assertEquals(0, count($rows), "no result should be returned, otherwise SQL injection is possible"); } /** @@ -617,23 +617,23 @@ public function testBitComparisonExpressionSupport() $data = $stmt->fetchAll(PDO::FETCH_ASSOC); - $this->assertEquals(4, count($data)); - $this->assertEquals(count($bitmap), count($data)); + self::assertEquals(4, count($data)); + self::assertEquals(count($bitmap), count($data)); foreach ($data as $row) { $row = array_change_key_case($row, CASE_LOWER); - $this->assertArrayHasKey('test_int', $row); + self::assertArrayHasKey('test_int', $row); $id = $row['test_int']; - $this->assertArrayHasKey($id, $bitmap); - $this->assertArrayHasKey($id, $bitmap); + self::assertArrayHasKey($id, $bitmap); + self::assertArrayHasKey($id, $bitmap); - $this->assertArrayHasKey('bit_or', $row); - $this->assertArrayHasKey('bit_and', $row); + self::assertArrayHasKey('bit_or', $row); + self::assertArrayHasKey('bit_and', $row); - $this->assertEquals($row['bit_or'], $bitmap[$id]['bit_or']); - $this->assertEquals($row['bit_and'], $bitmap[$id]['bit_and']); + self::assertEquals($row['bit_or'], $bitmap[$id]['bit_or']); + self::assertEquals($row['bit_and'], $bitmap[$id]['bit_and']); } } @@ -643,7 +643,7 @@ public function testSetDefaultFetchMode() $stmt->setFetchMode(\PDO::FETCH_NUM); $row = array_keys($stmt->fetch()); - $this->assertEquals(0, count( array_filter($row, function($v) { return ! is_numeric($v); })), "should be no non-numerical elements in the result."); + self::assertEquals(0, count( array_filter($row, function($v) { return ! is_numeric($v); })), "should be no non-numerical elements in the result."); } /** @@ -660,18 +660,18 @@ public function testFetchAllStyleObject() $results = $stmt->fetchAll(\PDO::FETCH_OBJ); - $this->assertCount(1, $results); - $this->assertInstanceOf('stdClass', $results[0]); + self::assertCount(1, $results); + self::assertInstanceOf('stdClass', $results[0]); - $this->assertEquals( + self::assertEquals( 1, property_exists($results[0], 'test_int') ? $results[0]->test_int : $results[0]->TEST_INT ); - $this->assertEquals( + self::assertEquals( 'foo', property_exists($results[0], 'test_string') ? $results[0]->test_string : $results[0]->TEST_STRING ); - $this->assertStringStartsWith( + self::assertStringStartsWith( '2010-01-01 10:10:10', property_exists($results[0], 'test_datetime') ? $results[0]->test_datetime : $results[0]->TEST_DATETIME ); @@ -694,12 +694,12 @@ public function testFetchAllSupportFetchClass() __NAMESPACE__.'\\MyFetchClass' ); - $this->assertEquals(1, count($results)); - $this->assertInstanceOf(__NAMESPACE__.'\\MyFetchClass', $results[0]); + self::assertEquals(1, count($results)); + self::assertInstanceOf(__NAMESPACE__.'\\MyFetchClass', $results[0]); - $this->assertEquals(1, $results[0]->test_int); - $this->assertEquals('foo', $results[0]->test_string); - $this->assertStringStartsWith('2010-01-01 10:10:10', $results[0]->test_datetime); + self::assertEquals(1, $results[0]->test_int); + self::assertEquals('foo', $results[0]->test_string); + self::assertStringStartsWith('2010-01-01 10:10:10', $results[0]->test_datetime); } /** @@ -716,7 +716,7 @@ public function testFetchAllStyleColumn() $sql = "SELECT test_int FROM fetch_table"; $rows = $this->_conn->query($sql)->fetchAll(\PDO::FETCH_COLUMN); - $this->assertEquals(array(1, 10), $rows); + self::assertEquals(array(1, 10), $rows); } /** @@ -733,12 +733,12 @@ public function testSetFetchModeClassFetchAll() $results = $stmt->fetchAll(); - $this->assertEquals(1, count($results)); - $this->assertInstanceOf(__NAMESPACE__.'\\MyFetchClass', $results[0]); + self::assertEquals(1, count($results)); + self::assertInstanceOf(__NAMESPACE__.'\\MyFetchClass', $results[0]); - $this->assertEquals(1, $results[0]->test_int); - $this->assertEquals('foo', $results[0]->test_string); - $this->assertStringStartsWith('2010-01-01 10:10:10', $results[0]->test_datetime); + self::assertEquals(1, $results[0]->test_int); + self::assertEquals('foo', $results[0]->test_string); + self::assertStringStartsWith('2010-01-01 10:10:10', $results[0]->test_datetime); } /** @@ -758,12 +758,12 @@ public function testSetFetchModeClassFetch() $results[] = $row; } - $this->assertEquals(1, count($results)); - $this->assertInstanceOf(__NAMESPACE__.'\\MyFetchClass', $results[0]); + self::assertEquals(1, count($results)); + self::assertInstanceOf(__NAMESPACE__.'\\MyFetchClass', $results[0]); - $this->assertEquals(1, $results[0]->test_int); - $this->assertEquals('foo', $results[0]->test_string); - $this->assertStringStartsWith('2010-01-01 10:10:10', $results[0]->test_datetime); + self::assertEquals(1, $results[0]->test_int); + self::assertEquals('foo', $results[0]->test_string); + self::assertStringStartsWith('2010-01-01 10:10:10', $results[0]->test_datetime); } /** @@ -773,8 +773,8 @@ public function testEmptyFetchColumnReturnsFalse() { $this->_conn->beginTransaction(); $this->_conn->exec('DELETE FROM fetch_table'); - $this->assertFalse($this->_conn->fetchColumn('SELECT test_int FROM fetch_table')); - $this->assertFalse($this->_conn->query('SELECT test_int FROM fetch_table')->fetchColumn()); + self::assertFalse($this->_conn->fetchColumn('SELECT test_int FROM fetch_table')); + self::assertFalse($this->_conn->query('SELECT test_int FROM fetch_table')->fetchColumn()); $this->_conn->rollBack(); } @@ -803,7 +803,7 @@ public function testEmptyParameters() $stmt = $this->_conn->executeQuery($sql, array(array()), array(\Doctrine\DBAL\Connection::PARAM_INT_ARRAY)); $rows = $stmt->fetchAll(); - $this->assertEquals(array(), $rows); + self::assertEquals(array(), $rows); } /** @@ -816,7 +816,7 @@ public function testFetchColumnNullValue() array(2, 'foo') ); - $this->assertNull( + self::assertNull( $this->_conn->fetchColumn('SELECT test_datetime FROM fetch_table WHERE test_int = ?', array(2)) ); } @@ -832,7 +832,7 @@ public function testFetchColumnNonExistingIndex() ); } - $this->assertNull( + self::assertNull( $this->_conn->fetchColumn('SELECT test_int FROM fetch_table WHERE test_int = ?', array(1), 1) ); } @@ -842,7 +842,7 @@ public function testFetchColumnNonExistingIndex() */ public function testFetchColumnNoResult() { - $this->assertFalse( + self::assertFalse( $this->_conn->fetchColumn('SELECT test_int FROM fetch_table WHERE test_int = ?', array(-1)) ); } diff --git a/tests/Doctrine/Tests/DBAL/Functional/Driver/AbstractDriverTest.php b/tests/Doctrine/Tests/DBAL/Functional/Driver/AbstractDriverTest.php index 35991a8a47f..5eee3ae9ade 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/Driver/AbstractDriverTest.php +++ b/tests/Doctrine/Tests/DBAL/Functional/Driver/AbstractDriverTest.php @@ -34,7 +34,7 @@ public function testConnectsWithoutDatabaseNameParameter() $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 @@ public function testReturnsDatabaseNameWithoutDatabaseNameParameter() $this->_conn->getEventManager() ); - $this->assertSame( + self::assertSame( $this->getDatabaseNameForConnectionWithoutDatabaseNameParameter(), $this->driver->getDatabase($connection) ); diff --git a/tests/Doctrine/Tests/DBAL/Functional/Driver/Mysqli/ConnectionTest.php b/tests/Doctrine/Tests/DBAL/Functional/Driver/Mysqli/ConnectionTest.php index ddcbe830342..a320aca3fd2 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/Driver/Mysqli/ConnectionTest.php +++ b/tests/Doctrine/Tests/DBAL/Functional/Driver/Mysqli/ConnectionTest.php @@ -28,7 +28,7 @@ public function testDriverOptions() ); $connection = $this->getConnection($driverOptions); - $this->assertInstanceOf("\Doctrine\DBAL\Driver\Mysqli\MysqliConnection", $connection); + self::assertInstanceOf("\Doctrine\DBAL\Driver\Mysqli\MysqliConnection", $connection); } /** @@ -42,7 +42,7 @@ public function testUnsupportedDriverOption() public function testPing() { $conn = $this->getConnection(array()); - $this->assertTrue($conn->ping()); + self::assertTrue($conn->ping()); } private function getConnection(array $driverOptions) diff --git a/tests/Doctrine/Tests/DBAL/Functional/Driver/OCI8/OCI8ConnectionTest.php b/tests/Doctrine/Tests/DBAL/Functional/Driver/OCI8/OCI8ConnectionTest.php index 21f3ef18fb0..3c41e51a12e 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/Driver/OCI8/OCI8ConnectionTest.php +++ b/tests/Doctrine/Tests/DBAL/Functional/Driver/OCI8/OCI8ConnectionTest.php @@ -47,6 +47,6 @@ public function testLastInsertIdAcceptsFqn() $schema = $this->_conn->getDatabase(); $sequence = $platform->getIdentitySequenceName($schema . '.DBAL2595', 'id'); - $this->assertSame(1, $this->driverConnection->lastInsertId($sequence)); + self::assertSame(1, $this->driverConnection->lastInsertId($sequence)); } } diff --git a/tests/Doctrine/Tests/DBAL/Functional/Driver/OCI8/StatementTest.php b/tests/Doctrine/Tests/DBAL/Functional/Driver/OCI8/StatementTest.php index d84ba271925..9de812f7358 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/Driver/OCI8/StatementTest.php +++ b/tests/Doctrine/Tests/DBAL/Functional/Driver/OCI8/StatementTest.php @@ -25,7 +25,7 @@ protected function setUp() */ public function testQueryConversion($query, array $params, array $expected) { - $this->assertEquals( + self::assertEquals( $expected, $this->_conn->executeQuery($query, $params)->fetch() ); diff --git a/tests/Doctrine/Tests/DBAL/Functional/Driver/PDOConnectionTest.php b/tests/Doctrine/Tests/DBAL/Functional/Driver/PDOConnectionTest.php index 78b7b57ff90..558bbdd7f27 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/Driver/PDOConnectionTest.php +++ b/tests/Doctrine/Tests/DBAL/Functional/Driver/PDOConnectionTest.php @@ -38,7 +38,7 @@ protected function tearDown() public function testDoesNotRequireQueryForServerVersion() { - $this->assertFalse($this->driverConnection->requiresQueryForServerVersion()); + self::assertFalse($this->driverConnection->requiresQueryForServerVersion()); } /** diff --git a/tests/Doctrine/Tests/DBAL/Functional/Driver/PDOPgSql/DriverTest.php b/tests/Doctrine/Tests/DBAL/Functional/Driver/PDOPgSql/DriverTest.php index d084d14fe56..829a0e52e60 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/Driver/PDOPgSql/DriverTest.php +++ b/tests/Doctrine/Tests/DBAL/Functional/Driver/PDOPgSql/DriverTest.php @@ -38,7 +38,7 @@ public function testDatabaseParameters($databaseName, $defaultDatabaseName, $exp $this->_conn->getEventManager() ); - $this->assertSame( + self::assertSame( $expectedDatabaseName, $this->driver->getDatabase($connection) ); @@ -82,7 +82,7 @@ public function testConnectsWithApplicationNameParameter() $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; } diff --git a/tests/Doctrine/Tests/DBAL/Functional/Driver/PDOPgsqlConnectionTest.php b/tests/Doctrine/Tests/DBAL/Functional/Driver/PDOPgsqlConnectionTest.php index c198e9608bf..c4d7382d525 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/Driver/PDOPgsqlConnectionTest.php +++ b/tests/Doctrine/Tests/DBAL/Functional/Driver/PDOPgsqlConnectionTest.php @@ -40,7 +40,7 @@ public function testConnectsWithValidCharsetOption($charset) $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)); } /** diff --git a/tests/Doctrine/Tests/DBAL/Functional/Driver/SQLAnywhere/ConnectionTest.php b/tests/Doctrine/Tests/DBAL/Functional/Driver/SQLAnywhere/ConnectionTest.php index 31873416e90..764e4ef102a 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/Driver/SQLAnywhere/ConnectionTest.php +++ b/tests/Doctrine/Tests/DBAL/Functional/Driver/SQLAnywhere/ConnectionTest.php @@ -29,7 +29,7 @@ public function testNonPersistentConnection() $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 @@ public function testPersistentConnection() $conn->connect(); - $this->assertTrue($conn->isConnected(), 'No SQLAnywhere-persistent connection established'); + self::assertTrue($conn->isConnected(), 'No SQLAnywhere-persistent connection established'); } } diff --git a/tests/Doctrine/Tests/DBAL/Functional/Driver/SQLAnywhere/DriverTest.php b/tests/Doctrine/Tests/DBAL/Functional/Driver/SQLAnywhere/DriverTest.php index 0a4b13a55e0..735ad673768 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/Driver/SQLAnywhere/DriverTest.php +++ b/tests/Doctrine/Tests/DBAL/Functional/Driver/SQLAnywhere/DriverTest.php @@ -35,7 +35,7 @@ public function testReturnsDatabaseNameWithoutDatabaseNameParameter() // 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)); } /** diff --git a/tests/Doctrine/Tests/DBAL/Functional/Driver/SQLAnywhere/StatementTest.php b/tests/Doctrine/Tests/DBAL/Functional/Driver/SQLAnywhere/StatementTest.php index 9e758485174..719edb9925c 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/Driver/SQLAnywhere/StatementTest.php +++ b/tests/Doctrine/Tests/DBAL/Functional/Driver/SQLAnywhere/StatementTest.php @@ -29,10 +29,10 @@ public function testNonPersistentStatement() $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 @@ public function testPersistentStatement() $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'); } } diff --git a/tests/Doctrine/Tests/DBAL/Functional/MasterSlaveConnectionTest.php b/tests/Doctrine/Tests/DBAL/Functional/MasterSlaveConnectionTest.php index 78c7de01f7f..f6ef685a079 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/MasterSlaveConnectionTest.php +++ b/tests/Doctrine/Tests/DBAL/Functional/MasterSlaveConnectionTest.php @@ -53,11 +53,11 @@ public function testMasterOnConnect() { $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 @@ public function testNoMasterOnExecuteQuery() $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 @@ public function testMasterOnWriteOperation() $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 @@ public function testKeepSlaveBeginTransactionStaysOnMaster() $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 @@ public function testKeepSlaveInsertStaysOnMaster() $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()); } } diff --git a/tests/Doctrine/Tests/DBAL/Functional/ModifyLimitQueryTest.php b/tests/Doctrine/Tests/DBAL/Functional/ModifyLimitQueryTest.php index a4f7706c4ea..f03dc0f11f1 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/ModifyLimitQueryTest.php +++ b/tests/Doctrine/Tests/DBAL/Functional/ModifyLimitQueryTest.php @@ -168,9 +168,9 @@ public function assertLimitResult($expectedResults, $sql, $limit, $offset, $dete * 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); } } } diff --git a/tests/Doctrine/Tests/DBAL/Functional/NamedParametersTest.php b/tests/Doctrine/Tests/DBAL/Functional/NamedParametersTest.php index 83971abde6b..974cca52db7 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/NamedParametersTest.php +++ b/tests/Doctrine/Tests/DBAL/Functional/NamedParametersTest.php @@ -157,7 +157,7 @@ public function testTicket($query,$params,$types,$expected) $result[$k] = array_change_key_case($v, CASE_LOWER); } - $this->assertEquals($result, $expected); + self::assertEquals($result, $expected); } } diff --git a/tests/Doctrine/Tests/DBAL/Functional/PortabilityTest.php b/tests/Doctrine/Tests/DBAL/Functional/PortabilityTest.php index 91fdfd4bef9..e6ad903b5ec 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/PortabilityTest.php +++ b/tests/Doctrine/Tests/DBAL/Functional/PortabilityTest.php @@ -108,7 +108,7 @@ public function testConnFetchMode() 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 @@ public function assertFetchResultRows($rows) 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 @@ public function testPortabilitySqlServer() $connection->connect($params); - $this->assertEquals($portability, $connection->getPortability()); + self::assertEquals($portability, $connection->getPortability()); } /** @@ -154,7 +154,7 @@ public function testFetchAllColumn($field, array $expected) $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 @@ public function testFetchAllNullColumn() $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); } } diff --git a/tests/Doctrine/Tests/DBAL/Functional/ResultCacheTest.php b/tests/Doctrine/Tests/DBAL/Functional/ResultCacheTest.php index 1f19394a39a..056df3c14b4 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/ResultCacheTest.php +++ b/tests/Doctrine/Tests/DBAL/Functional/ResultCacheTest.php @@ -44,7 +44,7 @@ protected function tearDown() public function testCacheFetchAssoc() { - $this->assertCacheNonCacheSelectSameFetchModeAreEqual($this->expectedResult, \PDO::FETCH_ASSOC); + self::assertCacheNonCacheSelectSameFetchModeAreEqual($this->expectedResult, \PDO::FETCH_ASSOC); } public function testFetchNum() @@ -53,7 +53,7 @@ public function testFetchNum() 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 @@ public function testFetchBoth() 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 @@ public function testFetchColumn() 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 @@ public function testMixingFetch() $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 @@ public function assertStandardAndIteratorFetchAreEqual($fetchMode) $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 @@ public function testDontCloseNoCache() $data[] = $row; } - $this->assertEquals(2, count($this->sqlLogger->queries)); + self::assertEquals(2, count($this->sqlLogger->queries)); } public function testDontFinishNoCache() @@ -141,23 +141,23 @@ public function testDontFinishNoCache() $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 @@ public function testEmptyResultCache() $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 @@ public function testChangeCacheImpl() $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) diff --git a/tests/Doctrine/Tests/DBAL/Functional/Schema/Db2SchemaManagerTest.php b/tests/Doctrine/Tests/DBAL/Functional/Schema/Db2SchemaManagerTest.php index 7d3b52950a1..cf3bb2da97b 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/Schema/Db2SchemaManagerTest.php +++ b/tests/Doctrine/Tests/DBAL/Functional/Schema/Db2SchemaManagerTest.php @@ -19,10 +19,10 @@ public function testGetBooleanColumn() $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()); } } diff --git a/tests/Doctrine/Tests/DBAL/Functional/Schema/DrizzleSchemaManagerTest.php b/tests/Doctrine/Tests/DBAL/Functional/Schema/DrizzleSchemaManagerTest.php index d59b480cfea..5b63b363a51 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/Schema/DrizzleSchemaManagerTest.php +++ b/tests/Doctrine/Tests/DBAL/Functional/Schema/DrizzleSchemaManagerTest.php @@ -20,11 +20,11 @@ public function testListTableWithBinary() $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 @@ public function testColumnCollation() $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')); } } diff --git a/tests/Doctrine/Tests/DBAL/Functional/Schema/MySqlSchemaManagerTest.php b/tests/Doctrine/Tests/DBAL/Functional/Schema/MySqlSchemaManagerTest.php index b50b79b6c14..d6070cc4c86 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/Schema/MySqlSchemaManagerTest.php +++ b/tests/Doctrine/Tests/DBAL/Functional/Schema/MySqlSchemaManagerTest.php @@ -61,7 +61,7 @@ public function testDiffTableBug() $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 @@ public function testFulltextIndex() $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 @@ public function testSpatialIndex() $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 @@ public function testAlterTableAddPrimaryKey() $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 @@ public function testDropPrimaryKeyWithAutoincrementColumn() $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 @@ public function testDoesNotPropagateDefaultValuesForUnsupportedColumnTypes() $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 @@ public function testDoesNotPropagateDefaultValuesForUnsupportedColumnTypes() $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 @@ public function testColumnCollation() $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 @@ public function testListLobTypeColumns() $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 @@ public function testDiffListGuidTableColumn() $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 @@ public function testListDecimalTypeColumns() $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 @@ public function testListFloatTypeColumns() $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()); } } diff --git a/tests/Doctrine/Tests/DBAL/Functional/Schema/OracleSchemaManagerTest.php b/tests/Doctrine/Tests/DBAL/Functional/Schema/OracleSchemaManagerTest.php index bea26913920..921d86473c2 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/Schema/OracleSchemaManagerTest.php +++ b/tests/Doctrine/Tests/DBAL/Functional/Schema/OracleSchemaManagerTest.php @@ -35,7 +35,7 @@ public function testRenameTable() $tables = $this->_sm->listTables(); - $this->assertHasTable($tables, 'list_tables_test_new_name'); + self::assertHasTable($tables, 'list_tables_test_new_name'); } public function testListTableWithBinary() @@ -52,11 +52,11 @@ public function testListTableWithBinary() $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()); } /** @@ -78,9 +78,9 @@ public function testAlterTableColumnNotNull() $columns = $this->_sm->listTableColumns($tableName); - $this->assertTrue($columns['id']->getNotnull()); - $this->assertTrue($columns['foo']->getNotnull()); - $this->assertTrue($columns['bar']->getNotnull()); + self::assertTrue($columns['id']->getNotnull()); + self::assertTrue($columns['foo']->getNotnull()); + self::assertTrue($columns['bar']->getNotnull()); $diffTable = clone $table; $diffTable->changeColumn('foo', array('notnull' => false)); @@ -90,9 +90,9 @@ public function testAlterTableColumnNotNull() $columns = $this->_sm->listTableColumns($tableName); - $this->assertTrue($columns['id']->getNotnull()); - $this->assertFalse($columns['foo']->getNotnull()); - $this->assertTrue($columns['bar']->getNotnull()); + self::assertTrue($columns['id']->getNotnull()); + self::assertFalse($columns['foo']->getNotnull()); + self::assertTrue($columns['bar']->getNotnull()); } public function testListDatabases() @@ -105,7 +105,7 @@ public function testListDatabases() $databases = $this->_sm->listDatabases(); $databases = array_map('strtolower', $databases); - $this->assertContains('c##test_create_database', $databases); + self::assertContains('c##test_create_database', $databases); } /** @@ -156,64 +156,64 @@ public function testListTableDetailsWithDifferentIdentifierQuotingRequirements() $platform = $this->_sm->getDatabasePlatform(); // Primary table assertions - $this->assertSame($primaryTableName, $onlinePrimaryTable->getQuotedName($platform)); + self::assertSame($primaryTableName, $onlinePrimaryTable->getQuotedName($platform)); - $this->assertTrue($onlinePrimaryTable->hasColumn('"Id"')); - $this->assertSame('"Id"', $onlinePrimaryTable->getColumn('"Id"')->getQuotedName($platform)); - $this->assertTrue($onlinePrimaryTable->hasPrimaryKey()); - $this->assertSame(array('"Id"'), $onlinePrimaryTable->getPrimaryKey()->getQuotedColumns($platform)); + self::assertTrue($onlinePrimaryTable->hasColumn('"Id"')); + self::assertSame('"Id"', $onlinePrimaryTable->getColumn('"Id"')->getQuotedName($platform)); + self::assertTrue($onlinePrimaryTable->hasPrimaryKey()); + self::assertSame(array('"Id"'), $onlinePrimaryTable->getPrimaryKey()->getQuotedColumns($platform)); - $this->assertTrue($onlinePrimaryTable->hasColumn('select')); - $this->assertSame('"select"', $onlinePrimaryTable->getColumn('select')->getQuotedName($platform)); + self::assertTrue($onlinePrimaryTable->hasColumn('select')); + self::assertSame('"select"', $onlinePrimaryTable->getColumn('select')->getQuotedName($platform)); - $this->assertTrue($onlinePrimaryTable->hasColumn('foo')); - $this->assertSame('FOO', $onlinePrimaryTable->getColumn('foo')->getQuotedName($platform)); + self::assertTrue($onlinePrimaryTable->hasColumn('foo')); + self::assertSame('FOO', $onlinePrimaryTable->getColumn('foo')->getQuotedName($platform)); - $this->assertTrue($onlinePrimaryTable->hasColumn('BAR')); - $this->assertSame('BAR', $onlinePrimaryTable->getColumn('BAR')->getQuotedName($platform)); + self::assertTrue($onlinePrimaryTable->hasColumn('BAR')); + self::assertSame('BAR', $onlinePrimaryTable->getColumn('BAR')->getQuotedName($platform)); - $this->assertTrue($onlinePrimaryTable->hasColumn('"BAZ"')); - $this->assertSame('BAZ', $onlinePrimaryTable->getColumn('"BAZ"')->getQuotedName($platform)); + self::assertTrue($onlinePrimaryTable->hasColumn('"BAZ"')); + self::assertSame('BAZ', $onlinePrimaryTable->getColumn('"BAZ"')->getQuotedName($platform)); - $this->assertTrue($onlinePrimaryTable->hasIndex('from')); - $this->assertTrue($onlinePrimaryTable->getIndex('from')->hasColumnAtPosition('"select"')); - $this->assertSame(array('"select"'), $onlinePrimaryTable->getIndex('from')->getQuotedColumns($platform)); + self::assertTrue($onlinePrimaryTable->hasIndex('from')); + self::assertTrue($onlinePrimaryTable->getIndex('from')->hasColumnAtPosition('"select"')); + self::assertSame(array('"select"'), $onlinePrimaryTable->getIndex('from')->getQuotedColumns($platform)); - $this->assertTrue($onlinePrimaryTable->hasIndex('foo_index')); - $this->assertTrue($onlinePrimaryTable->getIndex('foo_index')->hasColumnAtPosition('foo')); - $this->assertSame(array('FOO'), $onlinePrimaryTable->getIndex('foo_index')->getQuotedColumns($platform)); + self::assertTrue($onlinePrimaryTable->hasIndex('foo_index')); + self::assertTrue($onlinePrimaryTable->getIndex('foo_index')->hasColumnAtPosition('foo')); + self::assertSame(array('FOO'), $onlinePrimaryTable->getIndex('foo_index')->getQuotedColumns($platform)); - $this->assertTrue($onlinePrimaryTable->hasIndex('BAR_INDEX')); - $this->assertTrue($onlinePrimaryTable->getIndex('BAR_INDEX')->hasColumnAtPosition('BAR')); - $this->assertSame(array('BAR'), $onlinePrimaryTable->getIndex('BAR_INDEX')->getQuotedColumns($platform)); + self::assertTrue($onlinePrimaryTable->hasIndex('BAR_INDEX')); + self::assertTrue($onlinePrimaryTable->getIndex('BAR_INDEX')->hasColumnAtPosition('BAR')); + self::assertSame(array('BAR'), $onlinePrimaryTable->getIndex('BAR_INDEX')->getQuotedColumns($platform)); - $this->assertTrue($onlinePrimaryTable->hasIndex('BAZ_INDEX')); - $this->assertTrue($onlinePrimaryTable->getIndex('BAZ_INDEX')->hasColumnAtPosition('"BAZ"')); - $this->assertSame(array('BAZ'), $onlinePrimaryTable->getIndex('BAZ_INDEX')->getQuotedColumns($platform)); + self::assertTrue($onlinePrimaryTable->hasIndex('BAZ_INDEX')); + self::assertTrue($onlinePrimaryTable->getIndex('BAZ_INDEX')->hasColumnAtPosition('"BAZ"')); + self::assertSame(array('BAZ'), $onlinePrimaryTable->getIndex('BAZ_INDEX')->getQuotedColumns($platform)); // Foreign table assertions - $this->assertTrue($onlineForeignTable->hasColumn('id')); - $this->assertSame('ID', $onlineForeignTable->getColumn('id')->getQuotedName($platform)); - $this->assertTrue($onlineForeignTable->hasPrimaryKey()); - $this->assertSame(array('ID'), $onlineForeignTable->getPrimaryKey()->getQuotedColumns($platform)); + self::assertTrue($onlineForeignTable->hasColumn('id')); + self::assertSame('ID', $onlineForeignTable->getColumn('id')->getQuotedName($platform)); + self::assertTrue($onlineForeignTable->hasPrimaryKey()); + self::assertSame(array('ID'), $onlineForeignTable->getPrimaryKey()->getQuotedColumns($platform)); - $this->assertTrue($onlineForeignTable->hasColumn('"Fk"')); - $this->assertSame('"Fk"', $onlineForeignTable->getColumn('"Fk"')->getQuotedName($platform)); + self::assertTrue($onlineForeignTable->hasColumn('"Fk"')); + self::assertSame('"Fk"', $onlineForeignTable->getColumn('"Fk"')->getQuotedName($platform)); - $this->assertTrue($onlineForeignTable->hasIndex('"Fk_index"')); - $this->assertTrue($onlineForeignTable->getIndex('"Fk_index"')->hasColumnAtPosition('"Fk"')); - $this->assertSame(array('"Fk"'), $onlineForeignTable->getIndex('"Fk_index"')->getQuotedColumns($platform)); + self::assertTrue($onlineForeignTable->hasIndex('"Fk_index"')); + self::assertTrue($onlineForeignTable->getIndex('"Fk_index"')->hasColumnAtPosition('"Fk"')); + self::assertSame(array('"Fk"'), $onlineForeignTable->getIndex('"Fk_index"')->getQuotedColumns($platform)); - $this->assertTrue($onlineForeignTable->hasForeignKey('"Primary_Table_Fk"')); - $this->assertSame( + self::assertTrue($onlineForeignTable->hasForeignKey('"Primary_Table_Fk"')); + self::assertSame( $primaryTableName, $onlineForeignTable->getForeignKey('"Primary_Table_Fk"')->getQuotedForeignTableName($platform) ); - $this->assertSame( + self::assertSame( array('"Fk"'), $onlineForeignTable->getForeignKey('"Primary_Table_Fk"')->getQuotedLocalColumns($platform) ); - $this->assertSame( + self::assertSame( array('"Id"'), $onlineForeignTable->getForeignKey('"Primary_Table_Fk"')->getQuotedForeignColumns($platform) ); @@ -229,7 +229,7 @@ public function testListTableColumnsSameTableNamesInDifferentSchemas() TestUtil::getTempConnection()->getSchemaManager()->dropAndCreateTable($otherTable); $columns = $this->_sm->listTableColumns($table->getName(), $this->_conn->getUsername()); - $this->assertCount(7, $columns); + self::assertCount(7, $columns); } /** @@ -249,10 +249,10 @@ public function testListTableIndexesPrimaryKeyConstraintNameDiffersFromIndexName $tableIndexes = $this->_sm->listTableIndexes('list_table_indexes_pk_id_test'); - $this->assertArrayHasKey('primary', $tableIndexes, 'listTableIndexes() has to return a "primary" array key.'); - $this->assertEquals(array('id'), array_map('strtolower', $tableIndexes['primary']->getColumns())); - $this->assertTrue($tableIndexes['primary']->isUnique()); - $this->assertTrue($tableIndexes['primary']->isPrimary()); + self::assertArrayHasKey('primary', $tableIndexes, 'listTableIndexes() has to return a "primary" array key.'); + self::assertEquals(array('id'), array_map('strtolower', $tableIndexes['primary']->getColumns())); + self::assertTrue($tableIndexes['primary']->isUnique()); + self::assertTrue($tableIndexes['primary']->isPrimary()); } /** @@ -269,8 +269,8 @@ public function testListTableDateTypeColumns() $columns = $this->_sm->listTableColumns('tbl_date'); - $this->assertSame('date', $columns['col_date']->getType()->getName()); - $this->assertSame('datetime', $columns['col_datetime']->getType()->getName()); - $this->assertSame('datetimetz', $columns['col_datetimetz']->getType()->getName()); + self::assertSame('date', $columns['col_date']->getType()->getName()); + self::assertSame('datetime', $columns['col_datetime']->getType()->getName()); + self::assertSame('datetimetz', $columns['col_datetimetz']->getType()->getName()); } } diff --git a/tests/Doctrine/Tests/DBAL/Functional/Schema/PostgreSqlSchemaManagerTest.php b/tests/Doctrine/Tests/DBAL/Functional/Schema/PostgreSqlSchemaManagerTest.php index a67711f4b7e..b6312259360 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/Schema/PostgreSqlSchemaManagerTest.php +++ b/tests/Doctrine/Tests/DBAL/Functional/Schema/PostgreSqlSchemaManagerTest.php @@ -28,7 +28,7 @@ public function testGetSearchPath() $params = $this->_conn->getParams(); $paths = $this->_sm->getSchemaSearchPaths(); - $this->assertEquals([$params['user'], 'public'], $paths); + self::assertEquals([$params['user'], 'public'], $paths); } /** @@ -38,9 +38,9 @@ public function testGetSchemaNames() { $names = $this->_sm->getSchemaNames(); - $this->assertInternalType('array', $names); - $this->assertTrue(count($names) > 0); - $this->assertContains('public', $names, 'The public schema should be found.'); + self::assertInternalType('array', $names); + self::assertTrue(count($names) > 0); + self::assertContains('public', $names, 'The public schema should be found.'); } /** @@ -55,13 +55,13 @@ public function testSupportDomainTypeFallback() $this->_conn->exec($createTableSQL); $table = $this->_conn->getSchemaManager()->listTableDetails('domain_type_test'); - $this->assertInstanceOf('Doctrine\DBAL\Types\DecimalType', $table->getColumn('value')->getType()); + self::assertInstanceOf('Doctrine\DBAL\Types\DecimalType', $table->getColumn('value')->getType()); Type::addType('MyMoney', 'Doctrine\Tests\DBAL\Functional\Schema\MoneyType'); $this->_conn->getDatabasePlatform()->registerDoctrineTypeMapping('MyMoney', 'MyMoney'); $table = $this->_conn->getSchemaManager()->listTableDetails('domain_type_test'); - $this->assertInstanceOf('Doctrine\Tests\DBAL\Functional\Schema\MoneyType', $table->getColumn('value')->getType()); + self::assertInstanceOf('Doctrine\Tests\DBAL\Functional\Schema\MoneyType', $table->getColumn('value')->getType()); } /** @@ -75,7 +75,7 @@ public function testDetectsAutoIncrement() $this->_sm->createTable($autoincTable); $autoincTable = $this->_sm->listTableDetails('autoinc_table'); - $this->assertTrue($autoincTable->getColumn('id')->getAutoincrement()); + self::assertTrue($autoincTable->getColumn('id')->getAutoincrement()); } /** @@ -87,7 +87,7 @@ public function testAlterTableAutoIncrementAdd() $column = $tableFrom->addColumn('id', 'integer'); $this->_sm->createTable($tableFrom); $tableFrom = $this->_sm->listTableDetails('autoinc_table_add'); - $this->assertFalse($tableFrom->getColumn('id')->getAutoincrement()); + self::assertFalse($tableFrom->getColumn('id')->getAutoincrement()); $tableTo = new \Doctrine\DBAL\Schema\Table('autoinc_table_add'); $column = $tableTo->addColumn('id', 'integer'); @@ -96,7 +96,7 @@ public function testAlterTableAutoIncrementAdd() $c = new \Doctrine\DBAL\Schema\Comparator(); $diff = $c->diffTable($tableFrom, $tableTo); $sql = $this->_conn->getDatabasePlatform()->getAlterTableSQL($diff); - $this->assertEquals(array( + self::assertEquals(array( "CREATE SEQUENCE autoinc_table_add_id_seq", "SELECT setval('autoinc_table_add_id_seq', (SELECT MAX(id) FROM autoinc_table_add))", "ALTER TABLE autoinc_table_add ALTER id SET DEFAULT nextval('autoinc_table_add_id_seq')", @@ -104,7 +104,7 @@ public function testAlterTableAutoIncrementAdd() $this->_sm->alterTable($diff); $tableFinal = $this->_sm->listTableDetails('autoinc_table_add'); - $this->assertTrue($tableFinal->getColumn('id')->getAutoincrement()); + self::assertTrue($tableFinal->getColumn('id')->getAutoincrement()); } /** @@ -117,19 +117,19 @@ public function testAlterTableAutoIncrementDrop() $column->setAutoincrement(true); $this->_sm->createTable($tableFrom); $tableFrom = $this->_sm->listTableDetails('autoinc_table_drop'); - $this->assertTrue($tableFrom->getColumn('id')->getAutoincrement()); + self::assertTrue($tableFrom->getColumn('id')->getAutoincrement()); $tableTo = new \Doctrine\DBAL\Schema\Table('autoinc_table_drop'); $column = $tableTo->addColumn('id', 'integer'); $c = new \Doctrine\DBAL\Schema\Comparator(); $diff = $c->diffTable($tableFrom, $tableTo); - $this->assertInstanceOf('Doctrine\DBAL\Schema\TableDiff', $diff, "There should be a difference and not false being returned from the table comparison"); - $this->assertEquals(array("ALTER TABLE autoinc_table_drop ALTER id DROP DEFAULT"), $this->_conn->getDatabasePlatform()->getAlterTableSQL($diff)); + self::assertInstanceOf('Doctrine\DBAL\Schema\TableDiff', $diff, "There should be a difference and not false being returned from the table comparison"); + self::assertEquals(array("ALTER TABLE autoinc_table_drop ALTER id DROP DEFAULT"), $this->_conn->getDatabasePlatform()->getAlterTableSQL($diff)); $this->_sm->alterTable($diff); $tableFinal = $this->_sm->listTableDetails('autoinc_table_drop'); - $this->assertFalse($tableFinal->getColumn('id')->getAutoincrement()); + self::assertFalse($tableFinal->getColumn('id')->getAutoincrement()); } /** @@ -154,16 +154,16 @@ public function testTableWithSchema() $this->_sm->createTable($nestedSchemaTable); $tables = $this->_sm->listTableNames(); - $this->assertContains('nested.schematable', $tables, "The table should be detected with its non-public schema."); + self::assertContains('nested.schematable', $tables, "The table should be detected with its non-public schema."); $nestedSchemaTable = $this->_sm->listTableDetails('nested.schematable'); - $this->assertTrue($nestedSchemaTable->hasColumn('id')); - $this->assertEquals(array('id'), $nestedSchemaTable->getPrimaryKey()->getColumns()); + self::assertTrue($nestedSchemaTable->hasColumn('id')); + self::assertEquals(array('id'), $nestedSchemaTable->getPrimaryKey()->getColumns()); $relatedFks = $nestedSchemaTable->getForeignKeys(); - $this->assertEquals(1, count($relatedFks)); + self::assertEquals(1, count($relatedFks)); $relatedFk = array_pop($relatedFks); - $this->assertEquals("nested.schemarelated", $relatedFk->getForeignTableName()); + self::assertEquals("nested.schemarelated", $relatedFk->getForeignTableName()); } /** @@ -180,7 +180,7 @@ public function testReturnQuotedAssets() $table = $this->_sm->listTableDetails('dbal91_something'); - $this->assertEquals( + self::assertEquals( array( "CREATE TABLE dbal91_something (id INT NOT NULL, \"table\" INT DEFAULT NULL, PRIMARY KEY(id))", "CREATE INDEX IDX_A9401304ECA7352B ON dbal91_something (\"table\")", @@ -203,11 +203,11 @@ public function testFilterSchemaExpression() $this->_conn->getConfiguration()->setFilterSchemaAssetsExpression('#^dbal204_#'); $names = $this->_sm->listTableNames(); - $this->assertEquals(2, count($names)); + self::assertEquals(2, count($names)); $this->_conn->getConfiguration()->setFilterSchemaAssetsExpression('#^dbal204_test#'); $names = $this->_sm->listTableNames(); - $this->assertEquals(1, count($names)); + self::assertEquals(1, count($names)); } public function testListForeignKeys() @@ -231,15 +231,15 @@ public function testListForeignKeys() $this->_sm->createForeignKey($foreignKey, 'test_create_fk1'); } $fkeys = $this->_sm->listTableForeignKeys('test_create_fk1'); - $this->assertEquals(count($foreignKeys), count($fkeys), "Table 'test_create_fk1' has to have " . count($foreignKeys) . " foreign keys."); + self::assertEquals(count($foreignKeys), count($fkeys), "Table 'test_create_fk1' has to have " . count($foreignKeys) . " foreign keys."); for ($i = 0; $i < count($fkeys); $i++) { - $this->assertEquals(array("foreign_key_test$i"), array_map('strtolower', $fkeys[$i]->getLocalColumns())); - $this->assertEquals(array('id'), array_map('strtolower', $fkeys[$i]->getForeignColumns())); - $this->assertEquals('test_create_fk2', strtolower($fkeys[0]->getForeignTableName())); + self::assertEquals(array("foreign_key_test$i"), array_map('strtolower', $fkeys[$i]->getLocalColumns())); + self::assertEquals(array('id'), array_map('strtolower', $fkeys[$i]->getForeignColumns())); + self::assertEquals('test_create_fk2', strtolower($fkeys[0]->getForeignTableName())); if ($foreignKeys[$i]->getOption('onDelete') == 'NO ACTION') { - $this->assertFalse($fkeys[$i]->hasOption('onDelete'), 'Unexpected option: '. $fkeys[$i]->getOption('onDelete')); + self::assertFalse($fkeys[$i]->hasOption('onDelete'), 'Unexpected option: '. $fkeys[$i]->getOption('onDelete')); } else { - $this->assertEquals($foreignKeys[$i]->getOption('onDelete'), $fkeys[$i]->getOption('onDelete')); + self::assertEquals($foreignKeys[$i]->getOption('onDelete'), $fkeys[$i]->getOption('onDelete')); } } } @@ -258,7 +258,7 @@ public function testDefaultValueCharacterVarying() $databaseTable = $this->_sm->listTableDetails($testTable->getName()); - $this->assertEquals('foo', $databaseTable->getColumn('def')->getDefault()); + self::assertEquals('foo', $databaseTable->getColumn('def')->getDefault()); } /** @@ -277,7 +277,7 @@ public function testBooleanDefault() $c = new \Doctrine\DBAL\Schema\Comparator(); $diff = $c->diffTable($table, $databaseTable); - $this->assertFalse($diff); + self::assertFalse($diff); } public function testListTableWithBinary() @@ -294,11 +294,11 @@ public function testListTableWithBinary() $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 testListQuotedTable() @@ -316,7 +316,7 @@ public function testListQuotedTable() $comparator = new Schema\Comparator(); - $this->assertFalse($comparator->diffTable($offlineTable, $onlineTable)); + self::assertFalse($comparator->diffTable($offlineTable, $onlineTable)); } public function testListTablesExcludesViews() @@ -334,13 +334,13 @@ public function testListTablesExcludesViews() $foundTable = false; foreach ($tables as $table) { - $this->assertInstanceOf('Doctrine\DBAL\Schema\Table', $table, 'No Table instance was found in tables array.'); + self::assertInstanceOf('Doctrine\DBAL\Schema\Table', $table, 'No Table instance was found in tables array.'); if (strtolower($table->getName()) == 'list_tables_excludes_views_test_view') { $foundTable = true; } } - $this->assertFalse($foundTable, 'View "list_tables_excludes_views_test_view" must not be found in table list'); + self::assertFalse($foundTable, 'View "list_tables_excludes_views_test_view" must not be found in table list'); } /** @@ -360,10 +360,10 @@ public function testPartialIndexes() $comparator = new Schema\Comparator(); - $this->assertFalse($comparator->diffTable($offlineTable, $onlineTable)); - $this->assertTrue($onlineTable->hasIndex('simple_partial_index')); - $this->assertTrue($onlineTable->getIndex('simple_partial_index')->hasOption('where')); - $this->assertSame('(id IS NULL)', $onlineTable->getIndex('simple_partial_index')->getOption('where')); + self::assertFalse($comparator->diffTable($offlineTable, $onlineTable)); + self::assertTrue($onlineTable->hasIndex('simple_partial_index')); + self::assertTrue($onlineTable->getIndex('simple_partial_index')->hasOption('where')); + self::assertSame('(id IS NULL)', $onlineTable->getIndex('simple_partial_index')->getOption('where')); } /** @@ -383,8 +383,8 @@ public function testJsonbColumn(string $type): void /** @var Schema\Column[] $columns */ $columns = $this->_sm->listTableColumns('test_jsonb'); - $this->assertSame(TYPE::JSON, $columns['foo']->getType()->getName()); - $this->assertTrue(true, $columns['foo']->getPlatformOption('jsonb')); + self::assertSame(TYPE::JSON, $columns['foo']->getType()->getName()); + self::assertTrue(true, $columns['foo']->getPlatformOption('jsonb')); } public function jsonbColumnTypeProvider(): array @@ -412,12 +412,12 @@ public function testListNegativeColumnDefaultValue() $columns = $this->_sm->listTableColumns('test_default_negative'); - $this->assertEquals(-1, $columns['col_smallint']->getDefault()); - $this->assertEquals(-1, $columns['col_integer']->getDefault()); - $this->assertEquals(-1, $columns['col_bigint']->getDefault()); - $this->assertEquals(-1.1, $columns['col_float']->getDefault()); - $this->assertEquals(-1.1, $columns['col_decimal']->getDefault()); - $this->assertEquals('(-1)', $columns['col_string']->getDefault()); + self::assertEquals(-1, $columns['col_smallint']->getDefault()); + self::assertEquals(-1, $columns['col_integer']->getDefault()); + self::assertEquals(-1, $columns['col_bigint']->getDefault()); + self::assertEquals(-1.1, $columns['col_float']->getDefault()); + self::assertEquals(-1.1, $columns['col_decimal']->getDefault()); + self::assertEquals('(-1)', $columns['col_string']->getDefault()); } } diff --git a/tests/Doctrine/Tests/DBAL/Functional/Schema/SQLAnywhereSchemaManagerTest.php b/tests/Doctrine/Tests/DBAL/Functional/Schema/SQLAnywhereSchemaManagerTest.php index fa58cd4bf47..c9d4de4ab5e 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/Schema/SQLAnywhereSchemaManagerTest.php +++ b/tests/Doctrine/Tests/DBAL/Functional/Schema/SQLAnywhereSchemaManagerTest.php @@ -21,10 +21,10 @@ public function testCreateAndListViews() $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 @@ public function testDropAndCreateAdvancedIndex() ); $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 @@ public function testListTableColumnsWithFixedStringTypeColumn() $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()); } } diff --git a/tests/Doctrine/Tests/DBAL/Functional/Schema/SQLServerSchemaManagerTest.php b/tests/Doctrine/Tests/DBAL/Functional/Schema/SQLServerSchemaManagerTest.php index 74306bb199b..35260f0fae7 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/Schema/SQLServerSchemaManagerTest.php +++ b/tests/Doctrine/Tests/DBAL/Functional/Schema/SQLServerSchemaManagerTest.php @@ -32,7 +32,7 @@ public function testDropColumnConstraints() $this->_sm->alterTable($diff); $columns = $this->_sm->listTableColumns('sqlsrv_drop_column'); - $this->assertEquals(1, count($columns)); + self::assertEquals(1, count($columns)); } public function testColumnCollation() @@ -43,14 +43,14 @@ public function testColumnCollation() $this->_sm->dropAndCreateTable($table); $columns = $this->_sm->listTableColumns($tableName); - $this->assertTrue($columns[$columnName]->hasPlatformOption('collation')); // SQL Server should report a default collation on the column + self::assertTrue($columns[$columnName]->hasPlatformOption('collation')); // SQL Server should report a default collation on the column $column->setPlatformOption('collation', $collation = 'Icelandic_CS_AS'); $this->_sm->dropAndCreateTable($table); $columns = $this->_sm->listTableColumns($tableName); - $this->assertEquals($collation, $columns[$columnName]->getPlatformOption('collation')); + self::assertEquals($collation, $columns[$columnName]->getPlatformOption('collation')); } public function testDefaultConstraints() @@ -70,14 +70,14 @@ public function testDefaultConstraints() $this->_sm->createTable($table); $columns = $this->_sm->listTableColumns('sqlsrv_default_constraints'); - $this->assertNull($columns['no_default']->getDefault()); - $this->assertEquals(666, $columns['df_integer']->getDefault()); - $this->assertEquals('foobar', $columns['df_string_1']->getDefault()); - $this->assertEquals('Doctrine rocks!!!', $columns['df_string_2']->getDefault()); - $this->assertEquals('another default value', $columns['df_string_3']->getDefault()); - $this->assertEquals(1, $columns['df_boolean']->getDefault()); - $this->assertSame($platform->getCurrentDateSQL(), $columns['df_current_date']->getDefault()); - $this->assertSame($platform->getCurrentTimeSQL(), $columns['df_current_time']->getDefault()); + self::assertNull($columns['no_default']->getDefault()); + self::assertEquals(666, $columns['df_integer']->getDefault()); + self::assertEquals('foobar', $columns['df_string_1']->getDefault()); + self::assertEquals('Doctrine rocks!!!', $columns['df_string_2']->getDefault()); + self::assertEquals('another default value', $columns['df_string_3']->getDefault()); + self::assertEquals(1, $columns['df_boolean']->getDefault()); + self::assertSame($platform->getCurrentDateSQL(), $columns['df_current_date']->getDefault()); + self::assertSame($platform->getCurrentTimeSQL(), $columns['df_current_time']->getDefault()); $diff = new TableDiff( 'sqlsrv_default_constraints', @@ -128,13 +128,13 @@ public function testDefaultConstraints() $this->_sm->alterTable($diff); $columns = $this->_sm->listTableColumns('sqlsrv_default_constraints'); - $this->assertNull($columns['no_default']->getDefault()); - $this->assertEquals('CURRENT_TIMESTAMP', $columns['df_current_timestamp']->getDefault()); - $this->assertEquals(0, $columns['df_integer']->getDefault()); - $this->assertNull($columns['df_string_2']->getDefault()); - $this->assertEquals('another default value', $columns['df_string_3']->getDefault()); - $this->assertEquals(0, $columns['df_boolean']->getDefault()); - $this->assertEquals('column to rename', $columns['df_string_renamed']->getDefault()); + self::assertNull($columns['no_default']->getDefault()); + self::assertEquals('CURRENT_TIMESTAMP', $columns['df_current_timestamp']->getDefault()); + self::assertEquals(0, $columns['df_integer']->getDefault()); + self::assertNull($columns['df_string_2']->getDefault()); + self::assertEquals('another default value', $columns['df_string_3']->getDefault()); + self::assertEquals(0, $columns['df_boolean']->getDefault()); + self::assertEquals('column to rename', $columns['df_string_renamed']->getDefault()); /** * Test that column default constraints can still be referenced after table rename @@ -166,8 +166,8 @@ public function testDefaultConstraints() $this->_sm->alterTable($diff); $columns = $this->_sm->listTableColumns('sqlsrv_default_constraints'); - $this->assertNull($columns['df_current_timestamp']->getDefault()); - $this->assertEquals(666, $columns['df_integer']->getDefault()); + self::assertNull($columns['df_current_timestamp']->getDefault()); + self::assertEquals(666, $columns['df_integer']->getDefault()); } /** @@ -193,19 +193,19 @@ public function testColumnComments() $this->_sm->createTable($table); $columns = $this->_sm->listTableColumns("sqlsrv_column_comment"); - $this->assertEquals(12, count($columns)); - $this->assertNull($columns['id']->getComment()); - $this->assertNull($columns['comment_null']->getComment()); - $this->assertNull($columns['comment_false']->getComment()); - $this->assertNull($columns['comment_empty_string']->getComment()); - $this->assertEquals('0', $columns['comment_integer_0']->getComment()); - $this->assertEquals('0', $columns['comment_float_0']->getComment()); - $this->assertEquals('0', $columns['comment_string_0']->getComment()); - $this->assertEquals('Doctrine 0wnz you!', $columns['comment']->getComment()); - $this->assertEquals('Doctrine 0wnz comments for explicitly quoted columns!', $columns['comment_quoted']->getComment()); - $this->assertEquals('Doctrine 0wnz comments for reserved keyword columns!', $columns['[create]']->getComment()); - $this->assertNull($columns['commented_type']->getComment()); - $this->assertEquals('Doctrine array type.', $columns['commented_type_with_comment']->getComment()); + self::assertEquals(12, count($columns)); + self::assertNull($columns['id']->getComment()); + self::assertNull($columns['comment_null']->getComment()); + self::assertNull($columns['comment_false']->getComment()); + self::assertNull($columns['comment_empty_string']->getComment()); + self::assertEquals('0', $columns['comment_integer_0']->getComment()); + self::assertEquals('0', $columns['comment_float_0']->getComment()); + self::assertEquals('0', $columns['comment_string_0']->getComment()); + self::assertEquals('Doctrine 0wnz you!', $columns['comment']->getComment()); + self::assertEquals('Doctrine 0wnz comments for explicitly quoted columns!', $columns['comment_quoted']->getComment()); + self::assertEquals('Doctrine 0wnz comments for reserved keyword columns!', $columns['[create]']->getComment()); + self::assertNull($columns['commented_type']->getComment()); + self::assertEquals('Doctrine array type.', $columns['commented_type_with_comment']->getComment()); $tableDiff = new TableDiff('sqlsrv_column_comment'); $tableDiff->fromTable = $table; @@ -309,30 +309,30 @@ public function testColumnComments() $this->_sm->alterTable($tableDiff); $columns = $this->_sm->listTableColumns("sqlsrv_column_comment"); - $this->assertEquals(23, count($columns)); - $this->assertEquals('primary', $columns['id']->getComment()); - $this->assertNull($columns['comment_null']->getComment()); - $this->assertEquals('false', $columns['comment_false']->getComment()); - $this->assertNull($columns['comment_empty_string']->getComment()); - $this->assertEquals('0', $columns['comment_double_0']->getComment()); - $this->assertNull($columns['comment_string_0']->getComment()); - $this->assertNull($columns['comment']->getComment()); - $this->assertEquals('Doctrine array.', $columns['comment_quoted']->getComment()); - $this->assertNull($columns['[create]']->getComment()); - $this->assertEquals('foo', $columns['commented_type']->getComment()); - $this->assertNull($columns['commented_type_with_comment']->getComment()); - $this->assertNull($columns['added_comment_none']->getComment()); - $this->assertNull($columns['added_comment_null']->getComment()); - $this->assertNull($columns['added_comment_false']->getComment()); - $this->assertNull($columns['added_comment_empty_string']->getComment()); - $this->assertEquals('0', $columns['added_comment_integer_0']->getComment()); - $this->assertEquals('0', $columns['added_comment_float_0']->getComment()); - $this->assertEquals('0', $columns['added_comment_string_0']->getComment()); - $this->assertEquals('Doctrine', $columns['added_comment']->getComment()); - $this->assertEquals('rulez', $columns['added_comment_quoted']->getComment()); - $this->assertEquals('666', $columns['[select]']->getComment()); - $this->assertNull($columns['added_commented_type']->getComment()); - $this->assertEquals('666', $columns['added_commented_type_with_comment']->getComment()); + self::assertEquals(23, count($columns)); + self::assertEquals('primary', $columns['id']->getComment()); + self::assertNull($columns['comment_null']->getComment()); + self::assertEquals('false', $columns['comment_false']->getComment()); + self::assertNull($columns['comment_empty_string']->getComment()); + self::assertEquals('0', $columns['comment_double_0']->getComment()); + self::assertNull($columns['comment_string_0']->getComment()); + self::assertNull($columns['comment']->getComment()); + self::assertEquals('Doctrine array.', $columns['comment_quoted']->getComment()); + self::assertNull($columns['[create]']->getComment()); + self::assertEquals('foo', $columns['commented_type']->getComment()); + self::assertNull($columns['commented_type_with_comment']->getComment()); + self::assertNull($columns['added_comment_none']->getComment()); + self::assertNull($columns['added_comment_null']->getComment()); + self::assertNull($columns['added_comment_false']->getComment()); + self::assertNull($columns['added_comment_empty_string']->getComment()); + self::assertEquals('0', $columns['added_comment_integer_0']->getComment()); + self::assertEquals('0', $columns['added_comment_float_0']->getComment()); + self::assertEquals('0', $columns['added_comment_string_0']->getComment()); + self::assertEquals('Doctrine', $columns['added_comment']->getComment()); + self::assertEquals('rulez', $columns['added_comment_quoted']->getComment()); + self::assertEquals('666', $columns['[select]']->getComment()); + self::assertNull($columns['added_commented_type']->getComment()); + self::assertEquals('666', $columns['added_commented_type_with_comment']->getComment()); } public function testPkOrdering() @@ -352,12 +352,12 @@ public function testPkOrdering() $indexes = $this->_sm->listTableIndexes('sqlsrv_pk_ordering'); - $this->assertCount(1, $indexes); + self::assertCount(1, $indexes); $firstIndex = current($indexes); $columns = $firstIndex->getColumns(); - $this->assertCount(2, $columns); - $this->assertEquals('colB', $columns[0]); - $this->assertEquals('colA', $columns[1]); + self::assertCount(2, $columns); + self::assertEquals('colB', $columns[0]); + self::assertEquals('colA', $columns[1]); } } diff --git a/tests/Doctrine/Tests/DBAL/Functional/Schema/SchemaManagerFunctionalTestCase.php b/tests/Doctrine/Tests/DBAL/Functional/Schema/SchemaManagerFunctionalTestCase.php index 0532e11d9b0..9b22414e9d1 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/Schema/SchemaManagerFunctionalTestCase.php +++ b/tests/Doctrine/Tests/DBAL/Functional/Schema/SchemaManagerFunctionalTestCase.php @@ -54,9 +54,9 @@ public function testDropsDatabaseWithActiveConnections() $knownDatabases = $this->_sm->listDatabases(); if ($this->_conn->getDatabasePlatform() instanceof OraclePlatform) { - $this->assertContains('TEST_DROP_DATABASE', $knownDatabases); + self::assertContains('TEST_DROP_DATABASE', $knownDatabases); } else { - $this->assertContains('test_drop_database', $knownDatabases); + self::assertContains('test_drop_database', $knownDatabases); } $params = $this->_conn->getParams(); @@ -71,11 +71,11 @@ public function testDropsDatabaseWithActiveConnections() $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->assertNotContains('test_drop_database', $this->_sm->listDatabases()); + self::assertNotContains('test_drop_database', $this->_sm->listDatabases()); } /** @@ -117,19 +117,19 @@ public function testListSequences() $sequences = $this->_sm->listSequences(); - $this->assertInternalType('array', $sequences, 'listSequences() should return an array.'); + self::assertInternalType('array', $sequences, 'listSequences() should return an array.'); $foundSequence = null; foreach($sequences as $sequence) { - $this->assertInstanceOf('Doctrine\DBAL\Schema\Sequence', $sequence, 'Array elements of listSequences() should be Sequence instances.'); + self::assertInstanceOf('Doctrine\DBAL\Schema\Sequence', $sequence, 'Array elements of listSequences() should be Sequence instances.'); if(strtolower($sequence->getName()) == 'list_sequences_test_seq') { $foundSequence = $sequence; } } - $this->assertNotNull($foundSequence, "Sequence with name 'list_sequences_test_seq' was not found."); - $this->assertEquals(20, $foundSequence->getAllocationSize(), "Allocation Size is expected to be 20."); - $this->assertEquals(10, $foundSequence->getInitialValue(), "Initial Value is expected to be 10."); + self::assertNotNull($foundSequence, "Sequence with name 'list_sequences_test_seq' was not found."); + self::assertEquals(20, $foundSequence->getAllocationSize(), "Allocation Size is expected to be 20."); + self::assertEquals(10, $foundSequence->getInitialValue(), "Initial Value is expected to be 10."); } public function testListDatabases() @@ -143,7 +143,7 @@ public function testListDatabases() $databases = array_map('strtolower', $databases); - $this->assertContains('test_create_database', $databases); + self::assertContains('test_create_database', $databases); } /** @@ -166,7 +166,7 @@ public function testListNamespaceNames() $namespaces = array_map('strtolower', $namespaces); } - $this->assertContains('test_create_schema', $namespaces); + self::assertContains('test_create_schema', $namespaces); } public function testListTables() @@ -174,22 +174,22 @@ public function testListTables() $this->createTestTable('list_tables_test'); $tables = $this->_sm->listTables(); - $this->assertInternalType('array', $tables); - $this->assertTrue(count($tables) > 0, "List Tables has to find at least one table named 'list_tables_test'."); + self::assertInternalType('array', $tables); + self::assertTrue(count($tables) > 0, "List Tables has to find at least one table named 'list_tables_test'."); $foundTable = false; foreach ($tables as $table) { - $this->assertInstanceOf('Doctrine\DBAL\Schema\Table', $table); + self::assertInstanceOf('Doctrine\DBAL\Schema\Table', $table); if (strtolower($table->getName()) == 'list_tables_test') { $foundTable = true; - $this->assertTrue($table->hasColumn('id')); - $this->assertTrue($table->hasColumn('test')); - $this->assertTrue($table->hasColumn('foreign_key_test')); + self::assertTrue($table->hasColumn('id')); + self::assertTrue($table->hasColumn('test')); + self::assertTrue($table->hasColumn('foreign_key_test')); } } - $this->assertTrue( $foundTable , "The 'list_tables_test' table has to be found."); + self::assertTrue( $foundTable , "The 'list_tables_test' table has to be found."); } public function createListTableColumns() @@ -216,66 +216,66 @@ public function testListTableColumns() $columns = $this->_sm->listTableColumns('list_table_columns'); $columnsKeys = array_keys($columns); - $this->assertArrayHasKey('id', $columns); - $this->assertEquals(0, array_search('id', $columnsKeys)); - $this->assertEquals('id', strtolower($columns['id']->getname())); - $this->assertInstanceOf('Doctrine\DBAL\Types\IntegerType', $columns['id']->gettype()); - $this->assertEquals(false, $columns['id']->getunsigned()); - $this->assertEquals(true, $columns['id']->getnotnull()); - $this->assertEquals(null, $columns['id']->getdefault()); - $this->assertInternalType('array', $columns['id']->getPlatformOptions()); - - $this->assertArrayHasKey('test', $columns); - $this->assertEquals(1, array_search('test', $columnsKeys)); - $this->assertEquals('test', strtolower($columns['test']->getname())); - $this->assertInstanceOf('Doctrine\DBAL\Types\StringType', $columns['test']->gettype()); - $this->assertEquals(255, $columns['test']->getlength()); - $this->assertEquals(false, $columns['test']->getfixed()); - $this->assertEquals(false, $columns['test']->getnotnull()); - $this->assertEquals('expected default', $columns['test']->getdefault()); - $this->assertInternalType('array', $columns['test']->getPlatformOptions()); - - $this->assertEquals('foo', strtolower($columns['foo']->getname())); - $this->assertEquals(2, array_search('foo', $columnsKeys)); - $this->assertInstanceOf('Doctrine\DBAL\Types\TextType', $columns['foo']->gettype()); - $this->assertEquals(false, $columns['foo']->getunsigned()); - $this->assertEquals(false, $columns['foo']->getfixed()); - $this->assertEquals(true, $columns['foo']->getnotnull()); - $this->assertEquals(null, $columns['foo']->getdefault()); - $this->assertInternalType('array', $columns['foo']->getPlatformOptions()); - - $this->assertEquals('bar', strtolower($columns['bar']->getname())); - $this->assertEquals(3, array_search('bar', $columnsKeys)); - $this->assertInstanceOf('Doctrine\DBAL\Types\DecimalType', $columns['bar']->gettype()); - $this->assertEquals(null, $columns['bar']->getlength()); - $this->assertEquals(10, $columns['bar']->getprecision()); - $this->assertEquals(4, $columns['bar']->getscale()); - $this->assertEquals(false, $columns['bar']->getunsigned()); - $this->assertEquals(false, $columns['bar']->getfixed()); - $this->assertEquals(false, $columns['bar']->getnotnull()); - $this->assertEquals(null, $columns['bar']->getdefault()); - $this->assertInternalType('array', $columns['bar']->getPlatformOptions()); - - $this->assertEquals('baz1', strtolower($columns['baz1']->getname())); - $this->assertEquals(4, array_search('baz1', $columnsKeys)); - $this->assertInstanceOf('Doctrine\DBAL\Types\DateTimeType', $columns['baz1']->gettype()); - $this->assertEquals(true, $columns['baz1']->getnotnull()); - $this->assertEquals(null, $columns['baz1']->getdefault()); - $this->assertInternalType('array', $columns['baz1']->getPlatformOptions()); - - $this->assertEquals('baz2', strtolower($columns['baz2']->getname())); - $this->assertEquals(5, array_search('baz2', $columnsKeys)); - $this->assertContains($columns['baz2']->gettype()->getName(), array('time', 'date', 'datetime')); - $this->assertEquals(true, $columns['baz2']->getnotnull()); - $this->assertEquals(null, $columns['baz2']->getdefault()); - $this->assertInternalType('array', $columns['baz2']->getPlatformOptions()); - - $this->assertEquals('baz3', strtolower($columns['baz3']->getname())); - $this->assertEquals(6, array_search('baz3', $columnsKeys)); - $this->assertContains($columns['baz3']->gettype()->getName(), array('time', 'date', 'datetime')); - $this->assertEquals(true, $columns['baz3']->getnotnull()); - $this->assertEquals(null, $columns['baz3']->getdefault()); - $this->assertInternalType('array', $columns['baz3']->getPlatformOptions()); + self::assertArrayHasKey('id', $columns); + self::assertEquals(0, array_search('id', $columnsKeys)); + self::assertEquals('id', strtolower($columns['id']->getname())); + self::assertInstanceOf('Doctrine\DBAL\Types\IntegerType', $columns['id']->gettype()); + self::assertEquals(false, $columns['id']->getunsigned()); + self::assertEquals(true, $columns['id']->getnotnull()); + self::assertEquals(null, $columns['id']->getdefault()); + self::assertInternalType('array', $columns['id']->getPlatformOptions()); + + self::assertArrayHasKey('test', $columns); + self::assertEquals(1, array_search('test', $columnsKeys)); + self::assertEquals('test', strtolower($columns['test']->getname())); + self::assertInstanceOf('Doctrine\DBAL\Types\StringType', $columns['test']->gettype()); + self::assertEquals(255, $columns['test']->getlength()); + self::assertEquals(false, $columns['test']->getfixed()); + self::assertEquals(false, $columns['test']->getnotnull()); + self::assertEquals('expected default', $columns['test']->getdefault()); + self::assertInternalType('array', $columns['test']->getPlatformOptions()); + + self::assertEquals('foo', strtolower($columns['foo']->getname())); + self::assertEquals(2, array_search('foo', $columnsKeys)); + self::assertInstanceOf('Doctrine\DBAL\Types\TextType', $columns['foo']->gettype()); + self::assertEquals(false, $columns['foo']->getunsigned()); + self::assertEquals(false, $columns['foo']->getfixed()); + self::assertEquals(true, $columns['foo']->getnotnull()); + self::assertEquals(null, $columns['foo']->getdefault()); + self::assertInternalType('array', $columns['foo']->getPlatformOptions()); + + self::assertEquals('bar', strtolower($columns['bar']->getname())); + self::assertEquals(3, array_search('bar', $columnsKeys)); + self::assertInstanceOf('Doctrine\DBAL\Types\DecimalType', $columns['bar']->gettype()); + self::assertEquals(null, $columns['bar']->getlength()); + self::assertEquals(10, $columns['bar']->getprecision()); + self::assertEquals(4, $columns['bar']->getscale()); + self::assertEquals(false, $columns['bar']->getunsigned()); + self::assertEquals(false, $columns['bar']->getfixed()); + self::assertEquals(false, $columns['bar']->getnotnull()); + self::assertEquals(null, $columns['bar']->getdefault()); + self::assertInternalType('array', $columns['bar']->getPlatformOptions()); + + self::assertEquals('baz1', strtolower($columns['baz1']->getname())); + self::assertEquals(4, array_search('baz1', $columnsKeys)); + self::assertInstanceOf('Doctrine\DBAL\Types\DateTimeType', $columns['baz1']->gettype()); + self::assertEquals(true, $columns['baz1']->getnotnull()); + self::assertEquals(null, $columns['baz1']->getdefault()); + self::assertInternalType('array', $columns['baz1']->getPlatformOptions()); + + self::assertEquals('baz2', strtolower($columns['baz2']->getname())); + self::assertEquals(5, array_search('baz2', $columnsKeys)); + self::assertContains($columns['baz2']->gettype()->getName(), array('time', 'date', 'datetime')); + self::assertEquals(true, $columns['baz2']->getnotnull()); + self::assertEquals(null, $columns['baz2']->getdefault()); + self::assertInternalType('array', $columns['baz2']->getPlatformOptions()); + + self::assertEquals('baz3', strtolower($columns['baz3']->getname())); + self::assertEquals(6, array_search('baz3', $columnsKeys)); + self::assertContains($columns['baz3']->gettype()->getName(), array('time', 'date', 'datetime')); + self::assertEquals(true, $columns['baz3']->getnotnull()); + self::assertEquals(null, $columns['baz3']->getdefault()); + self::assertInternalType('array', $columns['baz3']->getPlatformOptions()); } /** @@ -292,10 +292,10 @@ public function testListTableColumnsWithFixedStringColumn() $columns = $this->_sm->listTableColumns($tableName); - $this->assertArrayHasKey('column_char', $columns); - $this->assertInstanceOf('Doctrine\DBAL\Types\StringType', $columns['column_char']->getType()); - $this->assertTrue($columns['column_char']->getFixed()); - $this->assertSame(2, $columns['column_char']->getLength()); + self::assertArrayHasKey('column_char', $columns); + self::assertInstanceOf('Doctrine\DBAL\Types\StringType', $columns['column_char']->getType()); + self::assertTrue($columns['column_char']->getFixed()); + self::assertSame(2, $columns['column_char']->getLength()); } public function testListTableColumnsDispatchEvent() @@ -365,7 +365,7 @@ public function testDiffListTableColumns() $comparator = new \Doctrine\DBAL\Schema\Comparator(); $diff = $comparator->diffTable($offlineTable, $onlineTable); - $this->assertFalse($diff, "No differences should be detected with the offline vs online schema."); + self::assertFalse($diff, "No differences should be detected with the offline vs online schema."); } public function testListTableIndexes() @@ -378,22 +378,22 @@ public function testListTableIndexes() $tableIndexes = $this->_sm->listTableIndexes('list_table_indexes_test'); - $this->assertEquals(3, count($tableIndexes)); + self::assertEquals(3, count($tableIndexes)); - $this->assertArrayHasKey('primary', $tableIndexes, 'listTableIndexes() has to return a "primary" array key.'); - $this->assertEquals(array('id', 'other_id'), array_map('strtolower', $tableIndexes['primary']->getColumns())); - $this->assertTrue($tableIndexes['primary']->isUnique()); - $this->assertTrue($tableIndexes['primary']->isPrimary()); + self::assertArrayHasKey('primary', $tableIndexes, 'listTableIndexes() has to return a "primary" array key.'); + self::assertEquals(array('id', 'other_id'), array_map('strtolower', $tableIndexes['primary']->getColumns())); + self::assertTrue($tableIndexes['primary']->isUnique()); + self::assertTrue($tableIndexes['primary']->isPrimary()); - $this->assertEquals('test_index_name', strtolower($tableIndexes['test_index_name']->getName())); - $this->assertEquals(array('test'), array_map('strtolower', $tableIndexes['test_index_name']->getColumns())); - $this->assertTrue($tableIndexes['test_index_name']->isUnique()); - $this->assertFalse($tableIndexes['test_index_name']->isPrimary()); + self::assertEquals('test_index_name', strtolower($tableIndexes['test_index_name']->getName())); + self::assertEquals(array('test'), array_map('strtolower', $tableIndexes['test_index_name']->getColumns())); + self::assertTrue($tableIndexes['test_index_name']->isUnique()); + self::assertFalse($tableIndexes['test_index_name']->isPrimary()); - $this->assertEquals('test_composite_idx', strtolower($tableIndexes['test_composite_idx']->getName())); - $this->assertEquals(array('id', 'test'), array_map('strtolower', $tableIndexes['test_composite_idx']->getColumns())); - $this->assertFalse($tableIndexes['test_composite_idx']->isUnique()); - $this->assertFalse($tableIndexes['test_composite_idx']->isPrimary()); + self::assertEquals('test_composite_idx', strtolower($tableIndexes['test_composite_idx']->getName())); + self::assertEquals(array('id', 'test'), array_map('strtolower', $tableIndexes['test_composite_idx']->getColumns())); + self::assertFalse($tableIndexes['test_composite_idx']->isUnique()); + self::assertFalse($tableIndexes['test_composite_idx']->isPrimary()); } public function testDropAndCreateIndex() @@ -404,12 +404,12 @@ public function testDropAndCreateIndex() $this->_sm->dropAndCreateIndex($table->getIndex('test'), $table); $tableIndexes = $this->_sm->listTableIndexes('test_create_index'); - $this->assertInternalType('array', $tableIndexes); + self::assertInternalType('array', $tableIndexes); - $this->assertEquals('test', strtolower($tableIndexes['test']->getName())); - $this->assertEquals(array('test'), array_map('strtolower', $tableIndexes['test']->getColumns())); - $this->assertTrue($tableIndexes['test']->isUnique()); - $this->assertFalse($tableIndexes['test']->isPrimary()); + self::assertEquals('test', strtolower($tableIndexes['test']->getName())); + self::assertEquals(array('test'), array_map('strtolower', $tableIndexes['test']->getColumns())); + self::assertTrue($tableIndexes['test']->isUnique()); + self::assertFalse($tableIndexes['test']->isPrimary()); } public function testCreateTableWithForeignKeys() @@ -429,15 +429,15 @@ public function testCreateTableWithForeignKeys() $fkTable = $this->_sm->listTableDetails('test_create_fk'); $fkConstraints = $fkTable->getForeignKeys(); - $this->assertEquals(1, count($fkConstraints), "Table 'test_create_fk1' has to have one foreign key."); + self::assertEquals(1, count($fkConstraints), "Table 'test_create_fk1' has to have one foreign key."); $fkConstraint = current($fkConstraints); - $this->assertInstanceOf('\Doctrine\DBAL\Schema\ForeignKeyConstraint', $fkConstraint); - $this->assertEquals('test_foreign', strtolower($fkConstraint->getForeignTableName())); - $this->assertEquals(array('foreign_key_test'), array_map('strtolower', $fkConstraint->getColumns())); - $this->assertEquals(array('id'), array_map('strtolower', $fkConstraint->getForeignColumns())); + self::assertInstanceOf('\Doctrine\DBAL\Schema\ForeignKeyConstraint', $fkConstraint); + self::assertEquals('test_foreign', strtolower($fkConstraint->getForeignTableName())); + self::assertEquals(array('foreign_key_test'), array_map('strtolower', $fkConstraint->getColumns())); + self::assertEquals(array('id'), array_map('strtolower', $fkConstraint->getForeignColumns())); - $this->assertTrue($fkTable->columnsAreIndexed($fkConstraint->getColumns()), "The columns of a foreign key constraint should always be indexed."); + self::assertTrue($fkTable->columnsAreIndexed($fkConstraint->getColumns()), "The columns of a foreign key constraint should always be indexed."); } public function testListForeignKeys() @@ -457,15 +457,15 @@ public function testListForeignKeys() $fkeys = $this->_sm->listTableForeignKeys('test_create_fk1'); - $this->assertEquals(1, count($fkeys), "Table 'test_create_fk1' has to have one foreign key."); + self::assertEquals(1, count($fkeys), "Table 'test_create_fk1' has to have one foreign key."); - $this->assertInstanceOf('Doctrine\DBAL\Schema\ForeignKeyConstraint', $fkeys[0]); - $this->assertEquals(array('foreign_key_test'), array_map('strtolower', $fkeys[0]->getLocalColumns())); - $this->assertEquals(array('id'), array_map('strtolower', $fkeys[0]->getForeignColumns())); - $this->assertEquals('test_create_fk2', strtolower($fkeys[0]->getForeignTableName())); + self::assertInstanceOf('Doctrine\DBAL\Schema\ForeignKeyConstraint', $fkeys[0]); + self::assertEquals(array('foreign_key_test'), array_map('strtolower', $fkeys[0]->getLocalColumns())); + self::assertEquals(array('id'), array_map('strtolower', $fkeys[0]->getForeignColumns())); + self::assertEquals('test_create_fk2', strtolower($fkeys[0]->getForeignTableName())); if($fkeys[0]->hasOption('onDelete')) { - $this->assertEquals('CASCADE', $fkeys[0]->getOption('onDelete')); + self::assertEquals('CASCADE', $fkeys[0]->getOption('onDelete')); } } @@ -479,7 +479,7 @@ public function testCreateSchema() $this->createTestTable('test_table'); $schema = $this->_sm->createSchema(); - $this->assertTrue($schema->hasTable('test_table')); + self::assertTrue($schema->hasTable('test_table')); } public function testAlterTableScenario() @@ -492,11 +492,11 @@ public function testAlterTableScenario() $this->createTestTable('alter_table_foreign'); $table = $this->_sm->listTableDetails('alter_table'); - $this->assertTrue($table->hasColumn('id')); - $this->assertTrue($table->hasColumn('test')); - $this->assertTrue($table->hasColumn('foreign_key_test')); - $this->assertEquals(0, count($table->getForeignKeys())); - $this->assertEquals(1, count($table->getIndexes())); + self::assertTrue($table->hasColumn('id')); + self::assertTrue($table->hasColumn('test')); + self::assertTrue($table->hasColumn('foreign_key_test')); + self::assertEquals(0, count($table->getForeignKeys())); + self::assertEquals(1, count($table->getIndexes())); $tableDiff = new \Doctrine\DBAL\Schema\TableDiff("alter_table"); $tableDiff->fromTable = $alterTable; @@ -506,8 +506,8 @@ public function testAlterTableScenario() $this->_sm->alterTable($tableDiff); $table = $this->_sm->listTableDetails('alter_table'); - $this->assertFalse($table->hasColumn('test')); - $this->assertTrue($table->hasColumn('foo')); + self::assertFalse($table->hasColumn('test')); + self::assertTrue($table->hasColumn('foo')); $tableDiff = new \Doctrine\DBAL\Schema\TableDiff("alter_table"); $tableDiff->fromTable = $table; @@ -516,11 +516,11 @@ public function testAlterTableScenario() $this->_sm->alterTable($tableDiff); $table = $this->_sm->listTableDetails('alter_table'); - $this->assertEquals(2, count($table->getIndexes())); - $this->assertTrue($table->hasIndex('foo_idx')); - $this->assertEquals(array('foo'), array_map('strtolower', $table->getIndex('foo_idx')->getColumns())); - $this->assertFalse($table->getIndex('foo_idx')->isPrimary()); - $this->assertFalse($table->getIndex('foo_idx')->isUnique()); + self::assertEquals(2, count($table->getIndexes())); + self::assertTrue($table->hasIndex('foo_idx')); + self::assertEquals(array('foo'), array_map('strtolower', $table->getIndex('foo_idx')->getColumns())); + self::assertFalse($table->getIndex('foo_idx')->isPrimary()); + self::assertFalse($table->getIndex('foo_idx')->isUnique()); $tableDiff = new \Doctrine\DBAL\Schema\TableDiff("alter_table"); $tableDiff->fromTable = $table; @@ -529,9 +529,9 @@ public function testAlterTableScenario() $this->_sm->alterTable($tableDiff); $table = $this->_sm->listTableDetails('alter_table'); - $this->assertEquals(2, count($table->getIndexes())); - $this->assertTrue($table->hasIndex('foo_idx')); - $this->assertEquals(array('foo', 'foreign_key_test'), array_map('strtolower', $table->getIndex('foo_idx')->getColumns())); + self::assertEquals(2, count($table->getIndexes())); + self::assertTrue($table->hasIndex('foo_idx')); + self::assertEquals(array('foo', 'foreign_key_test'), array_map('strtolower', $table->getIndex('foo_idx')->getColumns())); $tableDiff = new \Doctrine\DBAL\Schema\TableDiff("alter_table"); $tableDiff->fromTable = $table; @@ -540,12 +540,12 @@ public function testAlterTableScenario() $this->_sm->alterTable($tableDiff); $table = $this->_sm->listTableDetails('alter_table'); - $this->assertEquals(2, count($table->getIndexes())); - $this->assertTrue($table->hasIndex('bar_idx')); - $this->assertFalse($table->hasIndex('foo_idx')); - $this->assertEquals(array('foo', 'foreign_key_test'), array_map('strtolower', $table->getIndex('bar_idx')->getColumns())); - $this->assertFalse($table->getIndex('bar_idx')->isPrimary()); - $this->assertFalse($table->getIndex('bar_idx')->isUnique()); + self::assertEquals(2, count($table->getIndexes())); + self::assertTrue($table->hasIndex('bar_idx')); + self::assertFalse($table->hasIndex('foo_idx')); + self::assertEquals(array('foo', 'foreign_key_test'), array_map('strtolower', $table->getIndex('bar_idx')->getColumns())); + self::assertFalse($table->getIndex('bar_idx')->isPrimary()); + self::assertFalse($table->getIndex('bar_idx')->isUnique()); $tableDiff = new \Doctrine\DBAL\Schema\TableDiff("alter_table"); $tableDiff->fromTable = $table; @@ -557,15 +557,15 @@ public function testAlterTableScenario() $table = $this->_sm->listTableDetails('alter_table'); // dont check for index size here, some platforms automatically add indexes for foreign keys. - $this->assertFalse($table->hasIndex('bar_idx')); + self::assertFalse($table->hasIndex('bar_idx')); if ($this->_sm->getDatabasePlatform()->supportsForeignKeyConstraints()) { $fks = $table->getForeignKeys(); - $this->assertCount(1, $fks); + self::assertCount(1, $fks); $foreignKey = current($fks); - $this->assertEquals('alter_table_foreign', strtolower($foreignKey->getForeignTableName())); - $this->assertEquals(array('foreign_key_test'), array_map('strtolower', $foreignKey->getColumns())); - $this->assertEquals(array('id'), array_map('strtolower', $foreignKey->getForeignColumns())); + self::assertEquals('alter_table_foreign', strtolower($foreignKey->getForeignTableName())); + self::assertEquals(array('foreign_key_test'), array_map('strtolower', $foreignKey->getColumns())); + self::assertEquals(array('id'), array_map('strtolower', $foreignKey->getForeignColumns())); } } @@ -601,8 +601,8 @@ public function testAutoincrementDetection() $this->_sm->createTable($table); $inferredTable = $this->_sm->listTableDetails('test_autoincrement'); - $this->assertTrue($inferredTable->hasColumn('id')); - $this->assertTrue($inferredTable->getColumn('id')->getAutoincrement()); + self::assertTrue($inferredTable->hasColumn('id')); + self::assertTrue($inferredTable->getColumn('id')->getAutoincrement()); } /** @@ -623,8 +623,8 @@ public function testAutoincrementDetectionMulticolumns() $this->_sm->createTable($table); $inferredTable = $this->_sm->listTableDetails('test_not_autoincrement'); - $this->assertTrue($inferredTable->hasColumn('id')); - $this->assertFalse($inferredTable->getColumn('id')->getAutoincrement()); + self::assertTrue($inferredTable->hasColumn('id')); + self::assertFalse($inferredTable->getColumn('id')->getAutoincrement()); } /** @@ -708,9 +708,9 @@ public function testRenameIndexUsedInForeignKeyConstraint() $foreignTable = $this->_sm->listTableDetails('test_rename_index_foreign'); - $this->assertFalse($foreignTable->hasIndex('rename_index_fk_idx')); - $this->assertTrue($foreignTable->hasIndex('renamed_index_fk_idx')); - $this->assertTrue($foreignTable->hasForeignKey('fk_constraint')); + self::assertFalse($foreignTable->hasIndex('rename_index_fk_idx')); + self::assertTrue($foreignTable->hasIndex('renamed_index_fk_idx')); + self::assertTrue($foreignTable->hasForeignKey('fk_constraint')); } /** @@ -731,8 +731,8 @@ public function testGetColumnComment() $this->_sm->createTable($table); $columns = $this->_sm->listTableColumns("column_comment_test"); - $this->assertEquals(1, count($columns)); - $this->assertEquals('This is a comment', $columns['id']->getComment()); + self::assertEquals(1, count($columns)); + self::assertEquals('This is a comment', $columns['id']->getComment()); $tableDiff = new \Doctrine\DBAL\Schema\TableDiff('column_comment_test'); $tableDiff->fromTable = $table; @@ -749,8 +749,8 @@ public function testGetColumnComment() $this->_sm->alterTable($tableDiff); $columns = $this->_sm->listTableColumns("column_comment_test"); - $this->assertEquals(1, count($columns)); - $this->assertEmpty($columns['id']->getComment()); + self::assertEquals(1, count($columns)); + self::assertEmpty($columns['id']->getComment()); } /** @@ -773,12 +773,12 @@ public function testAutomaticallyAppendCommentOnMarkedColumns() $this->_sm->createTable($table); $columns = $this->_sm->listTableColumns("column_comment_test2"); - $this->assertEquals(3, count($columns)); - $this->assertEquals('This is a comment', $columns['id']->getComment()); - $this->assertEquals('This is a comment', $columns['obj']->getComment(), "The Doctrine2 Typehint should be stripped from comment."); - $this->assertInstanceOf('Doctrine\DBAL\Types\ObjectType', $columns['obj']->getType(), "The Doctrine2 should be detected from comment hint."); - $this->assertEquals('This is a comment', $columns['arr']->getComment(), "The Doctrine2 Typehint should be stripped from comment."); - $this->assertInstanceOf('Doctrine\DBAL\Types\ArrayType', $columns['arr']->getType(), "The Doctrine2 should be detected from comment hint."); + self::assertEquals(3, count($columns)); + self::assertEquals('This is a comment', $columns['id']->getComment()); + self::assertEquals('This is a comment', $columns['obj']->getComment(), "The Doctrine2 Typehint should be stripped from comment."); + self::assertInstanceOf('Doctrine\DBAL\Types\ObjectType', $columns['obj']->getType(), "The Doctrine2 should be detected from comment hint."); + self::assertEquals('This is a comment', $columns['arr']->getComment(), "The Doctrine2 Typehint should be stripped from comment."); + self::assertInstanceOf('Doctrine\DBAL\Types\ArrayType', $columns['arr']->getType(), "The Doctrine2 should be detected from comment hint."); } /** @@ -800,10 +800,10 @@ public function testCommentHintOnDateIntervalTypeColumn() $this->_sm->createTable($table); $columns = $this->_sm->listTableColumns("column_dateinterval_comment"); - $this->assertEquals(2, count($columns)); - $this->assertEquals('This is a comment', $columns['id']->getComment()); - $this->assertEquals('This is a comment', $columns['date_interval']->getComment(), "The Doctrine2 Typehint should be stripped from comment."); - $this->assertInstanceOf('Doctrine\DBAL\Types\DateIntervalType', $columns['date_interval']->getType(), "The Doctrine2 should be detected from comment hint."); + self::assertEquals(2, count($columns)); + self::assertEquals('This is a comment', $columns['id']->getComment()); + self::assertEquals('This is a comment', $columns['date_interval']->getComment(), "The Doctrine2 Typehint should be stripped from comment."); + self::assertInstanceOf('Doctrine\DBAL\Types\DateIntervalType', $columns['date_interval']->getType(), "The Doctrine2 should be detected from comment hint."); } /** @@ -839,11 +839,11 @@ public function testChangeColumnsTypeWithDefaultValue() $columns = $this->_sm->listTableColumns($tableName); - $this->assertInstanceOf('Doctrine\DBAL\Types\IntegerType', $columns['col_int']->getType()); - $this->assertEquals(666, $columns['col_int']->getDefault()); + self::assertInstanceOf('Doctrine\DBAL\Types\IntegerType', $columns['col_int']->getType()); + self::assertEquals(666, $columns['col_int']->getDefault()); - $this->assertInstanceOf('Doctrine\DBAL\Types\StringType', $columns['col_string']->getType()); - $this->assertEquals('foo', $columns['col_string']->getDefault()); + self::assertInstanceOf('Doctrine\DBAL\Types\StringType', $columns['col_string']->getType()); + self::assertEquals('foo', $columns['col_string']->getDefault()); } /** @@ -910,12 +910,12 @@ protected function assertHasTable($tables, $tableName) { $foundTable = false; foreach ($tables as $table) { - $this->assertInstanceOf('Doctrine\DBAL\Schema\Table', $table, 'No Table instance was found in tables array.'); + self::assertInstanceOf('Doctrine\DBAL\Schema\Table', $table, 'No Table instance was found in tables array.'); if (strtolower($table->getName()) == 'list_tables_test_new_name') { $foundTable = true; } } - $this->assertTrue($foundTable, "Could not find new table"); + self::assertTrue($foundTable, "Could not find new table"); } public function testListForeignKeysComposite() @@ -935,11 +935,11 @@ public function testListForeignKeysComposite() $fkeys = $this->_sm->listTableForeignKeys('test_create_fk3'); - $this->assertEquals(1, count($fkeys), "Table 'test_create_fk3' has to have one foreign key."); + self::assertEquals(1, count($fkeys), "Table 'test_create_fk3' has to have one foreign key."); - $this->assertInstanceOf('Doctrine\DBAL\Schema\ForeignKeyConstraint', $fkeys[0]); - $this->assertEquals(array('id', 'foreign_key_test'), array_map('strtolower', $fkeys[0]->getLocalColumns())); - $this->assertEquals(array('id', 'other_id'), array_map('strtolower', $fkeys[0]->getForeignColumns())); + self::assertInstanceOf('Doctrine\DBAL\Schema\ForeignKeyConstraint', $fkeys[0]); + self::assertEquals(array('id', 'foreign_key_test'), array_map('strtolower', $fkeys[0]->getLocalColumns())); + self::assertEquals(array('id', 'other_id'), array_map('strtolower', $fkeys[0]->getForeignColumns())); } /** @@ -962,14 +962,14 @@ public function testColumnDefaultLifecycle() $columns = $this->_sm->listTableColumns('col_def_lifecycle'); - $this->assertNull($columns['id']->getDefault()); - $this->assertNull($columns['column1']->getDefault()); - $this->assertSame('', $columns['column2']->getDefault()); - $this->assertSame('1', $columns['column3']->getDefault()); - $this->assertSame('0', $columns['column4']->getDefault()); - $this->assertSame('', $columns['column5']->getDefault()); - $this->assertSame('def', $columns['column6']->getDefault()); - $this->assertSame('0', $columns['column7']->getDefault()); + self::assertNull($columns['id']->getDefault()); + self::assertNull($columns['column1']->getDefault()); + self::assertSame('', $columns['column2']->getDefault()); + self::assertSame('1', $columns['column3']->getDefault()); + self::assertSame('0', $columns['column4']->getDefault()); + self::assertSame('', $columns['column5']->getDefault()); + self::assertSame('def', $columns['column6']->getDefault()); + self::assertSame('0', $columns['column7']->getDefault()); $diffTable = clone $table; @@ -987,13 +987,13 @@ public function testColumnDefaultLifecycle() $columns = $this->_sm->listTableColumns('col_def_lifecycle'); - $this->assertSame('', $columns['column1']->getDefault()); - $this->assertNull($columns['column2']->getDefault()); - $this->assertSame('', $columns['column3']->getDefault()); - $this->assertNull($columns['column4']->getDefault()); - $this->assertSame('', $columns['column5']->getDefault()); - $this->assertSame('666', $columns['column6']->getDefault()); - $this->assertNull($columns['column7']->getDefault()); + self::assertSame('', $columns['column1']->getDefault()); + self::assertNull($columns['column2']->getDefault()); + self::assertSame('', $columns['column3']->getDefault()); + self::assertNull($columns['column4']->getDefault()); + self::assertSame('', $columns['column5']->getDefault()); + self::assertSame('666', $columns['column6']->getDefault()); + self::assertNull($columns['column7']->getDefault()); } public function testListTableWithBinary() @@ -1010,11 +1010,11 @@ public function testListTableWithBinary() $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->assertTrue($table->getColumn('column_binary')->getFixed()); + self::assertInstanceOf('Doctrine\DBAL\Types\BinaryType', $table->getColumn('column_binary')->getType()); + self::assertTrue($table->getColumn('column_binary')->getFixed()); } public function testListTableDetailsWithFullQualifiedTableName() @@ -1043,15 +1043,15 @@ public function testListTableDetailsWithFullQualifiedTableName() $this->_sm->dropAndCreateTable($table); - $this->assertEquals( + self::assertEquals( $this->_sm->listTableColumns($primaryTableName), $this->_sm->listTableColumns($defaultSchemaName . '.' . $primaryTableName) ); - $this->assertEquals( + self::assertEquals( $this->_sm->listTableIndexes($primaryTableName), $this->_sm->listTableIndexes($defaultSchemaName . '.' . $primaryTableName) ); - $this->assertEquals( + self::assertEquals( $this->_sm->listTableForeignKeys($primaryTableName), $this->_sm->listTableForeignKeys($defaultSchemaName . '.' . $primaryTableName) ); @@ -1072,7 +1072,7 @@ public function testCommentStringsAreQuoted() $this->_sm->createTable($table); $columns = $this->_sm->listTableColumns("my_table"); - $this->assertEquals("It's a comment with a quote", $columns['id']->getComment()); + self::assertEquals("It's a comment with a quote", $columns['id']->getComment()); } public function testCommentNotDuplicated() @@ -1093,8 +1093,8 @@ public function testCommentNotDuplicated() $table->addColumn('id', 'integer', array('columnDefinition' => $columnDefinition, 'comment' => 'unexpected_column_comment')); $sql = $this->_conn->getDatabasePlatform()->getCreateTableSQL($table); - $this->assertContains('expected+column+comment', $sql[0]); - $this->assertNotContains('unexpected_column_comment', $sql[0]); + self::assertContains('expected+column+comment', $sql[0]); + self::assertNotContains('unexpected_column_comment', $sql[0]); } /** @@ -1119,10 +1119,10 @@ public function testAlterColumnComment($comment1, $expectedComment1, $comment2, $onlineTable = $this->_sm->listTableDetails("alter_column_comment_test"); - $this->assertSame($expectedComment1, $onlineTable->getColumn('comment1')->getComment()); - $this->assertSame($expectedComment2, $onlineTable->getColumn('comment2')->getComment()); - $this->assertNull($onlineTable->getColumn('no_comment1')->getComment()); - $this->assertNull($onlineTable->getColumn('no_comment2')->getComment()); + self::assertSame($expectedComment1, $onlineTable->getColumn('comment1')->getComment()); + self::assertSame($expectedComment2, $onlineTable->getColumn('comment2')->getComment()); + self::assertNull($onlineTable->getColumn('no_comment1')->getComment()); + self::assertNull($onlineTable->getColumn('no_comment2')->getComment()); $onlineTable->changeColumn('comment1', array('comment' => $comment2)); $onlineTable->changeColumn('comment2', array('comment' => $comment1)); @@ -1133,16 +1133,16 @@ public function testAlterColumnComment($comment1, $expectedComment1, $comment2, $tableDiff = $comparator->diffTable($offlineTable, $onlineTable); - $this->assertInstanceOf('Doctrine\DBAL\Schema\TableDiff', $tableDiff); + self::assertInstanceOf('Doctrine\DBAL\Schema\TableDiff', $tableDiff); $this->_sm->alterTable($tableDiff); $onlineTable = $this->_sm->listTableDetails("alter_column_comment_test"); - $this->assertSame($expectedComment2, $onlineTable->getColumn('comment1')->getComment()); - $this->assertSame($expectedComment1, $onlineTable->getColumn('comment2')->getComment()); - $this->assertSame($expectedComment1, $onlineTable->getColumn('no_comment1')->getComment()); - $this->assertSame($expectedComment2, $onlineTable->getColumn('no_comment2')->getComment()); + self::assertSame($expectedComment2, $onlineTable->getColumn('comment1')->getComment()); + self::assertSame($expectedComment1, $onlineTable->getColumn('comment2')->getComment()); + self::assertSame($expectedComment1, $onlineTable->getColumn('no_comment1')->getComment()); + self::assertSame($expectedComment2, $onlineTable->getColumn('no_comment2')->getComment()); } public function getAlterColumnComment() @@ -1188,8 +1188,8 @@ public function testDoesNotListIndexesImplicitlyCreatedByForeignKeys() $indexes = $this->_sm->listTableIndexes('test_list_index_impl_foreign'); - $this->assertCount(2, $indexes); - $this->assertArrayHasKey('explicit_fk1_idx', $indexes); - $this->assertArrayHasKey('idx_3d6c147fdc58d6c', $indexes); + self::assertCount(2, $indexes); + self::assertArrayHasKey('explicit_fk1_idx', $indexes); + self::assertArrayHasKey('idx_3d6c147fdc58d6c', $indexes); } } diff --git a/tests/Doctrine/Tests/DBAL/Functional/Schema/SqliteSchemaManagerTest.php b/tests/Doctrine/Tests/DBAL/Functional/Schema/SqliteSchemaManagerTest.php index 02d75ddee30..8c842c709e2 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/Schema/SqliteSchemaManagerTest.php +++ b/tests/Doctrine/Tests/DBAL/Functional/Schema/SqliteSchemaManagerTest.php @@ -22,9 +22,9 @@ public function testCreateAndDropDatabase() $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 @@ public function testDropsDatabaseWithActiveConnections() { $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 @@ public function testDropsDatabaseWithActiveConnections() $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 @@ public function testRenameTable() $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 @@ public function testListForeignKeysFromExistingDatabase() 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 @@ public function testColumnCollation() $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 @@ public function testListTableWithBinary() $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 @@ public function testNonDefaultPKOrder() $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 @@ public function testListTableColumnsWithWhitespacesInTypeDeclarations() $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 @@ public function testDiffListIntegerAutoincrementTableColumns($integerType, $unsi $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); } } diff --git a/tests/Doctrine/Tests/DBAL/Functional/StatementTest.php b/tests/Doctrine/Tests/DBAL/Functional/StatementTest.php index 978fc621e61..9827e89b4dd 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/StatementTest.php +++ b/tests/Doctrine/Tests/DBAL/Functional/StatementTest.php @@ -28,15 +28,15 @@ public function testStatementIsReusableAfterClosingCursor() $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 @@ public function testReuseStatementWithLongerResults() $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 @@ public function testReuseStatementWithLongerResults() $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 @@ public function testFetchLongBlob() $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 @@ public function testIncompletelyFetchedStatementDoesNotBlockConnection() $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 @@ public function testReuseStatementAfterClosingCursor() $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 @@ public function testReuseStatementWithParameterBoundByReference() $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 @@ public function testReuseStatementWithReboundValue() $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 @@ public function testReuseStatementWithReboundParam() $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 @@ public function testFetchFromNonExecutedStatement(callable $fetch, $expected) { $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 @@ public function testCloseCursorAfterCursorEnd() $stmt->execute(); $stmt->fetch(); - $this->assertTrue($stmt->closeCursor()); + self::assertTrue($stmt->closeCursor()); } /** @@ -246,7 +246,7 @@ public function testFetchFromNonExecutedStatementWithClosedCursor(callable $fetc $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 @@ public function testFetchFromExecutedStatementWithClosedCursor(callable $fetch, $stmt->execute(); $stmt->closeCursor(); - $this->assertSame($expected, $fetch($stmt)); + self::assertSame($expected, $fetch($stmt)); } public static function emptyFetchProvider() diff --git a/tests/Doctrine/Tests/DBAL/Functional/TableGeneratorTest.php b/tests/Doctrine/Tests/DBAL/Functional/TableGeneratorTest.php index 08fef7ce429..1b9503486b7 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/TableGeneratorTest.php +++ b/tests/Doctrine/Tests/DBAL/Functional/TableGeneratorTest.php @@ -40,9 +40,9 @@ public function testNextVal() $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 @@ public function testNextValNotAffectedByOuterTransactions() $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."); } } diff --git a/tests/Doctrine/Tests/DBAL/Functional/TemporaryTableTest.php b/tests/Doctrine/Tests/DBAL/Functional/TemporaryTableTest.php index a7ae454296e..3a1277267a9 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/TemporaryTableTest.php +++ b/tests/Doctrine/Tests/DBAL/Functional/TemporaryTableTest.php @@ -62,7 +62,7 @@ public function testDropTemporaryTableNotAutoCommitTransaction() $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 @@ public function testCreateTemporaryTableNotAutoCommitTransaction() } $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."); } } diff --git a/tests/Doctrine/Tests/DBAL/Functional/Ticket/DBAL168Test.php b/tests/Doctrine/Tests/DBAL/Functional/Ticket/DBAL168Test.php index 1393404b8a8..47b1e5eab4a 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/Ticket/DBAL168Test.php +++ b/tests/Doctrine/Tests/DBAL/Functional/Ticket/DBAL168Test.php @@ -22,6 +22,6 @@ public function testDomainsTable() $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 +} diff --git a/tests/Doctrine/Tests/DBAL/Functional/Ticket/DBAL202Test.php b/tests/Doctrine/Tests/DBAL/Functional/Ticket/DBAL202Test.php index 5eac587f503..cbb7674f893 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/Ticket/DBAL202Test.php +++ b/tests/Doctrine/Tests/DBAL/Functional/Ticket/DBAL202Test.php @@ -33,7 +33,7 @@ public function testStatementRollback() $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 @@ public function testStatementCommit() $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()); } } diff --git a/tests/Doctrine/Tests/DBAL/Functional/Ticket/DBAL421Test.php b/tests/Doctrine/Tests/DBAL/Functional/Ticket/DBAL421Test.php index 6eb18d57125..f1b282b996b 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/Ticket/DBAL421Test.php +++ b/tests/Doctrine/Tests/DBAL/Functional/Ticket/DBAL421Test.php @@ -21,7 +21,7 @@ public function testGuidShouldMatchPattern() { $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 @@ public function testGuidShouldBeRandom() 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; } diff --git a/tests/Doctrine/Tests/DBAL/Functional/Ticket/DBAL461Test.php b/tests/Doctrine/Tests/DBAL/Functional/Ticket/DBAL461Test.php index 70bbe2f58c6..b2ae1f1bf5a 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/Ticket/DBAL461Test.php +++ b/tests/Doctrine/Tests/DBAL/Functional/Ticket/DBAL461Test.php @@ -31,6 +31,6 @@ public function testIssue() 'comment' => null, )); - $this->assertEquals('Decimal', (string)$column->getType()); + self::assertEquals('Decimal', (string)$column->getType()); } } diff --git a/tests/Doctrine/Tests/DBAL/Functional/Ticket/DBAL510Test.php b/tests/Doctrine/Tests/DBAL/Functional/Ticket/DBAL510Test.php index 2b30ff04d75..4780e6f5c7d 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/Ticket/DBAL510Test.php +++ b/tests/Doctrine/Tests/DBAL/Functional/Ticket/DBAL510Test.php @@ -32,6 +32,6 @@ public function testSearchPathSchemaChanges() $comparator = new Comparator(); $diff = $comparator->diffTable($onlineTable, $table); - $this->assertFalse($diff); + self::assertFalse($diff); } } diff --git a/tests/Doctrine/Tests/DBAL/Functional/Ticket/DBAL630Test.php b/tests/Doctrine/Tests/DBAL/Functional/Ticket/DBAL630Test.php index bfc089d880d..aa8e3ef282e 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/Ticket/DBAL630Test.php +++ b/tests/Doctrine/Tests/DBAL/Functional/Ticket/DBAL630Test.php @@ -49,22 +49,22 @@ public function testBooleanConversionSqlLiteral() { $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 @@ public function testBooleanConversionBoolParamEmulatedPrepares() $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 @@ public function testBooleanConversionNullParamEmulatedPrepares( $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 @@ public function testBooleanConversionNullParamEmulatedPreparesWithBooleanTypeInB $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']); } /** diff --git a/tests/Doctrine/Tests/DBAL/Functional/Ticket/DBAL752Test.php b/tests/Doctrine/Tests/DBAL/Functional/Ticket/DBAL752Test.php index 5caee776687..40f8fbe8815 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/Ticket/DBAL752Test.php +++ b/tests/Doctrine/Tests/DBAL/Functional/Ticket/DBAL752Test.php @@ -38,23 +38,23 @@ public function testUnsignedIntegerDetection() $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()); } } diff --git a/tests/Doctrine/Tests/DBAL/Functional/TypeConversionTest.php b/tests/Doctrine/Tests/DBAL/Functional/TypeConversionTest.php index bdcd5321d01..9b9ef0b6342 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/TypeConversionTest.php +++ b/tests/Doctrine/Tests/DBAL/Functional/TypeConversionTest.php @@ -83,16 +83,16 @@ public function testIdempotentDataConversion($type, $originalValue, $expectedPhp $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."); } } } diff --git a/tests/Doctrine/Tests/DBAL/Functional/WriteTest.php b/tests/Doctrine/Tests/DBAL/Functional/WriteTest.php index 91bd9832eab..843b585def6 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/WriteTest.php +++ b/tests/Doctrine/Tests/DBAL/Functional/WriteTest.php @@ -34,7 +34,7 @@ public function testExecuteUpdateFirstTypeIsNull() $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 @@ public function testExecuteUpdate() $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 @@ public function testExecuteUpdateWithTypes() $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 @@ public function testPrepareRowCountReturnsAffectedRows() $stmt->bindValue(2, "foo"); $stmt->execute(); - $this->assertEquals(1, $stmt->rowCount()); + self::assertEquals(1, $stmt->rowCount()); } public function testPrepareWithPdoTypes() @@ -74,7 +74,7 @@ public function testPrepareWithPdoTypes() $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 @@ public function testPrepareWithDbalTypes() $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 @@ public function testPrepareWithDbalTypeNames() $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 @@ public function testDelete() { $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 @@ public function testLastInsertId() $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 @@ public function testLastInsertIdSequence() } $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 @@ public function testLastInsertIdSequence() $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 @@ public function testLastInsertIdNoSequenceGiven() $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 @@ public function testInsertWithKeyValueTypes() $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 @@ public function testUpdateWithKeyValueTypes() $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 @@ public function testDeleteWithKeyValueTypes() $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 @@ public function testEmptyIdentityInsert() $secondId = $this->_conn->lastInsertId($seqName); - $this->assertTrue($secondId > $firstId); + self::assertTrue($secondId > $firstId); } @@ -298,13 +298,13 @@ public function testUpdateWhereIsNull() $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 @@ public function testDeleteWhereIsNull() $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); } } diff --git a/tests/Doctrine/Tests/DBAL/Logging/DebugStackTest.php b/tests/Doctrine/Tests/DBAL/Logging/DebugStackTest.php index 3d6991c7f2d..a652d1aac9f 100644 --- a/tests/Doctrine/Tests/DBAL/Logging/DebugStackTest.php +++ b/tests/Doctrine/Tests/DBAL/Logging/DebugStackTest.php @@ -17,7 +17,7 @@ protected function tearDown() 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 @@ public function testLoggedQuery() ); $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); } } diff --git a/tests/Doctrine/Tests/DBAL/Platforms/AbstractMySQLPlatformTestCase.php b/tests/Doctrine/Tests/DBAL/Platforms/AbstractMySQLPlatformTestCase.php index e6b77999efc..54f49354c52 100644 --- a/tests/Doctrine/Tests/DBAL/Platforms/AbstractMySQLPlatformTestCase.php +++ b/tests/Doctrine/Tests/DBAL/Platforms/AbstractMySQLPlatformTestCase.php @@ -14,7 +14,7 @@ abstract class AbstractMySQLPlatformTestCase extends AbstractPlatformTestCase public function testModifyLimitQueryWitoutLimit() { $sql = $this->_platform->modifyLimitQuery('SELECT n FROM Foo', null , 10); - $this->assertEquals('SELECT n FROM Foo LIMIT 18446744073709551615 OFFSET 10',$sql); + self::assertEquals('SELECT n FROM Foo LIMIT 18446744073709551615 OFFSET 10',$sql); } public function testGenerateMixedCaseTableCreate() @@ -23,7 +23,7 @@ public function testGenerateMixedCaseTableCreate() $table->addColumn("Bar", "integer"); $sql = $this->_platform->getCreateTableSQL($table); - $this->assertEquals('CREATE TABLE Foo (Bar INT NOT NULL) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB', array_shift($sql)); + self::assertEquals('CREATE TABLE Foo (Bar INT NOT NULL) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB', array_shift($sql)); } public function getGenerateTableSql() @@ -47,27 +47,27 @@ public function getGenerateAlterTableSql() public function testGeneratesSqlSnippets() { - $this->assertEquals('RLIKE', $this->_platform->getRegexpExpression(), 'Regular expression operator is not correct'); - $this->assertEquals('`', $this->_platform->getIdentifierQuoteCharacter(), 'Quote character is not correct'); - $this->assertEquals('CONCAT(column1, column2, column3)', $this->_platform->getConcatExpression('column1', 'column2', 'column3'), 'Concatenation function is not correct'); + self::assertEquals('RLIKE', $this->_platform->getRegexpExpression(), 'Regular expression operator is not correct'); + self::assertEquals('`', $this->_platform->getIdentifierQuoteCharacter(), 'Quote character is not correct'); + self::assertEquals('CONCAT(column1, column2, column3)', $this->_platform->getConcatExpression('column1', 'column2', 'column3'), 'Concatenation function is not correct'); } public function testGeneratesTransactionsCommands() { - $this->assertEquals( + self::assertEquals( 'SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED', $this->_platform->getSetTransactionIsolationSQL(\Doctrine\DBAL\Connection::TRANSACTION_READ_UNCOMMITTED), '' ); - $this->assertEquals( + self::assertEquals( 'SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED', $this->_platform->getSetTransactionIsolationSQL(\Doctrine\DBAL\Connection::TRANSACTION_READ_COMMITTED) ); - $this->assertEquals( + self::assertEquals( 'SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ', $this->_platform->getSetTransactionIsolationSQL(\Doctrine\DBAL\Connection::TRANSACTION_REPEATABLE_READ) ); - $this->assertEquals( + self::assertEquals( 'SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE', $this->_platform->getSetTransactionIsolationSQL(\Doctrine\DBAL\Connection::TRANSACTION_SERIALIZABLE) ); @@ -76,23 +76,23 @@ public function testGeneratesTransactionsCommands() public function testGeneratesDDLSnippets() { - $this->assertEquals('SHOW DATABASES', $this->_platform->getListDatabasesSQL()); - $this->assertEquals('CREATE DATABASE foobar', $this->_platform->getCreateDatabaseSQL('foobar')); - $this->assertEquals('DROP DATABASE foobar', $this->_platform->getDropDatabaseSQL('foobar')); - $this->assertEquals('DROP TABLE foobar', $this->_platform->getDropTableSQL('foobar')); + self::assertEquals('SHOW DATABASES', $this->_platform->getListDatabasesSQL()); + self::assertEquals('CREATE DATABASE foobar', $this->_platform->getCreateDatabaseSQL('foobar')); + self::assertEquals('DROP DATABASE foobar', $this->_platform->getDropDatabaseSQL('foobar')); + self::assertEquals('DROP TABLE foobar', $this->_platform->getDropTableSQL('foobar')); } public function testGeneratesTypeDeclarationForIntegers() { - $this->assertEquals( + self::assertEquals( 'INT', $this->_platform->getIntegerTypeDeclarationSQL(array()) ); - $this->assertEquals( + self::assertEquals( 'INT AUTO_INCREMENT', $this->_platform->getIntegerTypeDeclarationSQL(array('autoincrement' => true) )); - $this->assertEquals( + self::assertEquals( 'INT AUTO_INCREMENT', $this->_platform->getIntegerTypeDeclarationSQL( array('autoincrement' => true, 'primary' => true) @@ -101,17 +101,17 @@ public function testGeneratesTypeDeclarationForIntegers() public function testGeneratesTypeDeclarationForStrings() { - $this->assertEquals( + self::assertEquals( 'CHAR(10)', $this->_platform->getVarcharTypeDeclarationSQL( array('length' => 10, 'fixed' => true) )); - $this->assertEquals( + self::assertEquals( 'VARCHAR(50)', $this->_platform->getVarcharTypeDeclarationSQL(array('length' => 50)), 'Variable string declaration is not correct' ); - $this->assertEquals( + self::assertEquals( 'VARCHAR(255)', $this->_platform->getVarcharTypeDeclarationSQL(array()), 'Long string declaration is not correct' @@ -120,17 +120,17 @@ public function testGeneratesTypeDeclarationForStrings() public function testPrefersIdentityColumns() { - $this->assertTrue($this->_platform->prefersIdentityColumns()); + self::assertTrue($this->_platform->prefersIdentityColumns()); } public function testSupportsIdentityColumns() { - $this->assertTrue($this->_platform->supportsIdentityColumns()); + self::assertTrue($this->_platform->supportsIdentityColumns()); } public function testDoesSupportSavePoints() { - $this->assertTrue($this->_platform->supportsSavepoints()); + self::assertTrue($this->_platform->supportsSavepoints()); } public function getGenerateIndexSql() @@ -168,7 +168,7 @@ public function testUniquePrimaryKey() $sql = $this->_platform->getAlterTableSQL($diff); - $this->assertEquals(array( + self::assertEquals(array( "ALTER TABLE foo ADD PRIMARY KEY (bar)", "CREATE UNIQUE INDEX UNIQ_8C73652178240498 ON foo (baz)", ), $sql); @@ -177,13 +177,13 @@ public function testUniquePrimaryKey() public function testModifyLimitQuery() { $sql = $this->_platform->modifyLimitQuery('SELECT * FROM user', 10, 0); - $this->assertEquals('SELECT * FROM user LIMIT 10 OFFSET 0', $sql); + self::assertEquals('SELECT * FROM user LIMIT 10 OFFSET 0', $sql); } public function testModifyLimitQueryWithEmptyOffset() { $sql = $this->_platform->modifyLimitQuery('SELECT * FROM user', 10); - $this->assertEquals('SELECT * FROM user LIMIT 10', $sql); + self::assertEquals('SELECT * FROM user LIMIT 10', $sql); } /** @@ -191,9 +191,9 @@ public function testModifyLimitQueryWithEmptyOffset() */ public function testGetDateTimeTypeDeclarationSql() { - $this->assertEquals("DATETIME", $this->_platform->getDateTimeTypeDeclarationSQL(array('version' => false))); - $this->assertEquals("TIMESTAMP", $this->_platform->getDateTimeTypeDeclarationSQL(array('version' => true))); - $this->assertEquals("DATETIME", $this->_platform->getDateTimeTypeDeclarationSQL(array())); + self::assertEquals("DATETIME", $this->_platform->getDateTimeTypeDeclarationSQL(array('version' => false))); + self::assertEquals("TIMESTAMP", $this->_platform->getDateTimeTypeDeclarationSQL(array('version' => true))); + self::assertEquals("DATETIME", $this->_platform->getDateTimeTypeDeclarationSQL(array())); } public function getCreateTableColumnCommentsSQL() @@ -221,11 +221,11 @@ public function testChangeIndexWithForeignKeys() $diff = new TableDiff("test", array(), array(), array(), array($unique), array(), array($index)); $sql = $this->_platform->getAlterTableSQL($diff); - $this->assertEquals(array("ALTER TABLE test DROP INDEX idx, ADD UNIQUE INDEX uniq (col)"), $sql); + self::assertEquals(array("ALTER TABLE test DROP INDEX idx, ADD UNIQUE INDEX uniq (col)"), $sql); $diff = new TableDiff("test", array(), array(), array(), array($index), array(), array($unique)); $sql = $this->_platform->getAlterTableSQL($diff); - $this->assertEquals(array("ALTER TABLE test DROP INDEX uniq, ADD INDEX idx (col)"), $sql); + self::assertEquals(array("ALTER TABLE test DROP INDEX uniq, ADD INDEX idx (col)"), $sql); } protected function getQuotedColumnInPrimaryKeySQL() @@ -270,7 +270,7 @@ public function testCreateTableWithFulltextIndex() $index->addFlag('fulltext'); $sql = $this->_platform->getCreateTableSQL($table); - $this->assertEquals(array('CREATE TABLE fulltext_table (text LONGTEXT NOT NULL, FULLTEXT INDEX fulltext_text (text)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = MyISAM'), $sql); + self::assertEquals(array('CREATE TABLE fulltext_table (text LONGTEXT NOT NULL, FULLTEXT INDEX fulltext_text (text)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = MyISAM'), $sql); } public function testCreateTableWithSpatialIndex() @@ -284,31 +284,31 @@ public function testCreateTableWithSpatialIndex() $index->addFlag('spatial'); $sql = $this->_platform->getCreateTableSQL($table); - $this->assertEquals(array('CREATE TABLE spatial_table (point LONGTEXT NOT NULL, SPATIAL INDEX spatial_text (point)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = MyISAM'), $sql); + self::assertEquals(array('CREATE TABLE spatial_table (point LONGTEXT NOT NULL, SPATIAL INDEX spatial_text (point)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = MyISAM'), $sql); } public function testClobTypeDeclarationSQL() { - $this->assertEquals('TINYTEXT', $this->_platform->getClobTypeDeclarationSQL(array('length' => 1))); - $this->assertEquals('TINYTEXT', $this->_platform->getClobTypeDeclarationSQL(array('length' => 255))); - $this->assertEquals('TEXT', $this->_platform->getClobTypeDeclarationSQL(array('length' => 256))); - $this->assertEquals('TEXT', $this->_platform->getClobTypeDeclarationSQL(array('length' => 65535))); - $this->assertEquals('MEDIUMTEXT', $this->_platform->getClobTypeDeclarationSQL(array('length' => 65536))); - $this->assertEquals('MEDIUMTEXT', $this->_platform->getClobTypeDeclarationSQL(array('length' => 16777215))); - $this->assertEquals('LONGTEXT', $this->_platform->getClobTypeDeclarationSQL(array('length' => 16777216))); - $this->assertEquals('LONGTEXT', $this->_platform->getClobTypeDeclarationSQL(array())); + self::assertEquals('TINYTEXT', $this->_platform->getClobTypeDeclarationSQL(array('length' => 1))); + self::assertEquals('TINYTEXT', $this->_platform->getClobTypeDeclarationSQL(array('length' => 255))); + self::assertEquals('TEXT', $this->_platform->getClobTypeDeclarationSQL(array('length' => 256))); + self::assertEquals('TEXT', $this->_platform->getClobTypeDeclarationSQL(array('length' => 65535))); + self::assertEquals('MEDIUMTEXT', $this->_platform->getClobTypeDeclarationSQL(array('length' => 65536))); + self::assertEquals('MEDIUMTEXT', $this->_platform->getClobTypeDeclarationSQL(array('length' => 16777215))); + self::assertEquals('LONGTEXT', $this->_platform->getClobTypeDeclarationSQL(array('length' => 16777216))); + self::assertEquals('LONGTEXT', $this->_platform->getClobTypeDeclarationSQL(array())); } public function testBlobTypeDeclarationSQL() { - $this->assertEquals('TINYBLOB', $this->_platform->getBlobTypeDeclarationSQL(array('length' => 1))); - $this->assertEquals('TINYBLOB', $this->_platform->getBlobTypeDeclarationSQL(array('length' => 255))); - $this->assertEquals('BLOB', $this->_platform->getBlobTypeDeclarationSQL(array('length' => 256))); - $this->assertEquals('BLOB', $this->_platform->getBlobTypeDeclarationSQL(array('length' => 65535))); - $this->assertEquals('MEDIUMBLOB', $this->_platform->getBlobTypeDeclarationSQL(array('length' => 65536))); - $this->assertEquals('MEDIUMBLOB', $this->_platform->getBlobTypeDeclarationSQL(array('length' => 16777215))); - $this->assertEquals('LONGBLOB', $this->_platform->getBlobTypeDeclarationSQL(array('length' => 16777216))); - $this->assertEquals('LONGBLOB', $this->_platform->getBlobTypeDeclarationSQL(array())); + self::assertEquals('TINYBLOB', $this->_platform->getBlobTypeDeclarationSQL(array('length' => 1))); + self::assertEquals('TINYBLOB', $this->_platform->getBlobTypeDeclarationSQL(array('length' => 255))); + self::assertEquals('BLOB', $this->_platform->getBlobTypeDeclarationSQL(array('length' => 256))); + self::assertEquals('BLOB', $this->_platform->getBlobTypeDeclarationSQL(array('length' => 65535))); + self::assertEquals('MEDIUMBLOB', $this->_platform->getBlobTypeDeclarationSQL(array('length' => 65536))); + self::assertEquals('MEDIUMBLOB', $this->_platform->getBlobTypeDeclarationSQL(array('length' => 16777215))); + self::assertEquals('LONGBLOB', $this->_platform->getBlobTypeDeclarationSQL(array('length' => 16777216))); + self::assertEquals('LONGBLOB', $this->_platform->getBlobTypeDeclarationSQL(array())); } /** @@ -327,7 +327,7 @@ public function testAlterTableAddPrimaryKey() $diffTable->dropIndex('idx_id'); $diffTable->setPrimaryKey(array('id')); - $this->assertEquals( + self::assertEquals( array('DROP INDEX idx_id ON alter_table_add_pk', 'ALTER TABLE alter_table_add_pk ADD PRIMARY KEY (id)'), $this->_platform->getAlterTableSQL($comparator->diffTable($table, $diffTable)) ); @@ -349,7 +349,7 @@ public function testAlterPrimaryKeyWithAutoincrementColumn() $diffTable->dropPrimaryKey(); $diffTable->setPrimaryKey(array('foo')); - $this->assertEquals( + self::assertEquals( array( 'ALTER TABLE alter_primary_key MODIFY id INT NOT NULL', 'ALTER TABLE alter_primary_key DROP PRIMARY KEY', @@ -375,7 +375,7 @@ public function testDropPrimaryKeyWithAutoincrementColumn() $diffTable->dropPrimaryKey(); - $this->assertEquals( + self::assertEquals( array( 'ALTER TABLE drop_primary_key MODIFY id INT NOT NULL', 'ALTER TABLE drop_primary_key DROP PRIMARY KEY' @@ -401,7 +401,7 @@ public function testDropNonAutoincrementColumnFromCompositePrimaryKeyWithAutoinc $diffTable->dropPrimaryKey(); $diffTable->setPrimaryKey(array('id')); - $this->assertSame( + self::assertSame( array( 'ALTER TABLE tbl MODIFY id INT NOT NULL', 'ALTER TABLE tbl DROP PRIMARY KEY', @@ -428,7 +428,7 @@ public function testAddNonAutoincrementColumnToPrimaryKeyWithAutoincrementColumn $diffTable->dropPrimaryKey(); $diffTable->setPrimaryKey(array('id', 'foo')); - $this->assertSame( + self::assertSame( array( 'ALTER TABLE tbl MODIFY id INT NOT NULL', 'ALTER TABLE tbl DROP PRIMARY KEY', @@ -456,7 +456,7 @@ public function testAddAutoIncrementPrimaryKey() $sql = $this->_platform->getAlterTableSQL($diff); - $this->assertEquals(array( + self::assertEquals(array( "ALTER TABLE foo ADD id INT AUTO_INCREMENT NOT NULL, ADD PRIMARY KEY (id)", ), $sql); } @@ -468,7 +468,7 @@ public function testNamedPrimaryKey() $sql = $this->_platform->getAlterTableSQL($diff); - $this->assertEquals(array( + self::assertEquals(array( "ALTER TABLE mytable DROP PRIMARY KEY", "ALTER TABLE mytable ADD PRIMARY KEY (foo)", ), $sql); @@ -488,7 +488,7 @@ public function testAlterPrimaryKeyWithNewColumn() $diffTable->dropPrimaryKey(); $diffTable->setPrimaryKey(array('pkc1', 'pkc2')); - $this->assertSame( + self::assertSame( array( 'ALTER TABLE yolo DROP PRIMARY KEY', 'ALTER TABLE yolo ADD pkc2 INT NOT NULL', @@ -500,11 +500,11 @@ public function testAlterPrimaryKeyWithNewColumn() public function testInitializesDoctrineTypeMappings() { - $this->assertTrue($this->_platform->hasDoctrineTypeMappingFor('binary')); - $this->assertSame('binary', $this->_platform->getDoctrineTypeMapping('binary')); + self::assertTrue($this->_platform->hasDoctrineTypeMappingFor('binary')); + self::assertSame('binary', $this->_platform->getDoctrineTypeMapping('binary')); - $this->assertTrue($this->_platform->hasDoctrineTypeMappingFor('varbinary')); - $this->assertSame('binary', $this->_platform->getDoctrineTypeMapping('varbinary')); + self::assertTrue($this->_platform->hasDoctrineTypeMappingFor('varbinary')); + self::assertSame('binary', $this->_platform->getDoctrineTypeMapping('varbinary')); } protected function getBinaryMaxLength() @@ -514,19 +514,19 @@ protected function getBinaryMaxLength() public function testReturnsBinaryTypeDeclarationSQL() { - $this->assertSame('VARBINARY(255)', $this->_platform->getBinaryTypeDeclarationSQL(array())); - $this->assertSame('VARBINARY(255)', $this->_platform->getBinaryTypeDeclarationSQL(array('length' => 0))); - $this->assertSame('VARBINARY(65535)', $this->_platform->getBinaryTypeDeclarationSQL(array('length' => 65535))); - $this->assertSame('MEDIUMBLOB', $this->_platform->getBinaryTypeDeclarationSQL(array('length' => 65536))); - $this->assertSame('MEDIUMBLOB', $this->_platform->getBinaryTypeDeclarationSQL(array('length' => 16777215))); - $this->assertSame('LONGBLOB', $this->_platform->getBinaryTypeDeclarationSQL(array('length' => 16777216))); + self::assertSame('VARBINARY(255)', $this->_platform->getBinaryTypeDeclarationSQL(array())); + self::assertSame('VARBINARY(255)', $this->_platform->getBinaryTypeDeclarationSQL(array('length' => 0))); + self::assertSame('VARBINARY(65535)', $this->_platform->getBinaryTypeDeclarationSQL(array('length' => 65535))); + self::assertSame('MEDIUMBLOB', $this->_platform->getBinaryTypeDeclarationSQL(array('length' => 65536))); + self::assertSame('MEDIUMBLOB', $this->_platform->getBinaryTypeDeclarationSQL(array('length' => 16777215))); + self::assertSame('LONGBLOB', $this->_platform->getBinaryTypeDeclarationSQL(array('length' => 16777216))); - $this->assertSame('BINARY(255)', $this->_platform->getBinaryTypeDeclarationSQL(array('fixed' => true))); - $this->assertSame('BINARY(255)', $this->_platform->getBinaryTypeDeclarationSQL(array('fixed' => true, 'length' => 0))); - $this->assertSame('BINARY(65535)', $this->_platform->getBinaryTypeDeclarationSQL(array('fixed' => true, 'length' => 65535))); - $this->assertSame('MEDIUMBLOB', $this->_platform->getBinaryTypeDeclarationSQL(array('fixed' => true, 'length' => 65536))); - $this->assertSame('MEDIUMBLOB', $this->_platform->getBinaryTypeDeclarationSQL(array('fixed' => true, 'length' => 16777215))); - $this->assertSame('LONGBLOB', $this->_platform->getBinaryTypeDeclarationSQL(array('fixed' => true, 'length' => 16777216))); + self::assertSame('BINARY(255)', $this->_platform->getBinaryTypeDeclarationSQL(array('fixed' => true))); + self::assertSame('BINARY(255)', $this->_platform->getBinaryTypeDeclarationSQL(array('fixed' => true, 'length' => 0))); + self::assertSame('BINARY(65535)', $this->_platform->getBinaryTypeDeclarationSQL(array('fixed' => true, 'length' => 65535))); + self::assertSame('MEDIUMBLOB', $this->_platform->getBinaryTypeDeclarationSQL(array('fixed' => true, 'length' => 65536))); + self::assertSame('MEDIUMBLOB', $this->_platform->getBinaryTypeDeclarationSQL(array('fixed' => true, 'length' => 16777215))); + self::assertSame('LONGBLOB', $this->_platform->getBinaryTypeDeclarationSQL(array('fixed' => true, 'length' => 16777216))); } public function testDoesNotPropagateForeignKeyCreationForNonSupportingEngines() @@ -538,7 +538,7 @@ public function testDoesNotPropagateForeignKeyCreationForNonSupportingEngines() $table->setPrimaryKey(array('id')); $table->addOption('engine', 'MyISAM'); - $this->assertSame( + self::assertSame( array('CREATE TABLE foreign_table (id INT NOT NULL, fk_id INT NOT NULL, INDEX IDX_5690FFE2A57719D0 (fk_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = MyISAM'), $this->_platform->getCreateTableSQL( $table, @@ -549,7 +549,7 @@ public function testDoesNotPropagateForeignKeyCreationForNonSupportingEngines() $table = clone $table; $table->addOption('engine', 'InnoDB'); - $this->assertSame( + self::assertSame( array( 'CREATE TABLE foreign_table (id INT NOT NULL, fk_id INT NOT NULL, INDEX IDX_5690FFE2A57719D0 (fk_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB', 'ALTER TABLE foreign_table ADD CONSTRAINT FK_5690FFE2A57719D0 FOREIGN KEY (fk_id) REFERENCES foreign_table (id)' @@ -580,7 +580,7 @@ public function testDoesNotPropagateForeignKeyAlterationForNonSupportingEngines( $tableDiff->changedForeignKeys = $changedForeignKeys; $tableDiff->removedForeignKeys = $removedForeignKeys; - $this->assertEmpty($this->_platform->getAlterTableSQL($tableDiff)); + self::assertEmpty($this->_platform->getAlterTableSQL($tableDiff)); $table->addOption('engine', 'InnoDB'); @@ -590,7 +590,7 @@ public function testDoesNotPropagateForeignKeyAlterationForNonSupportingEngines( $tableDiff->changedForeignKeys = $changedForeignKeys; $tableDiff->removedForeignKeys = $removedForeignKeys; - $this->assertSame( + self::assertSame( array( 'ALTER TABLE foreign_table DROP FOREIGN KEY fk_remove', 'ALTER TABLE foreign_table DROP FOREIGN KEY fk_change', @@ -667,7 +667,7 @@ public function testDoesNotPropagateDefaultValuesForUnsupportedColumnTypes() $table->addColumn('def_blob', 'blob', array('default' => 'def')); $table->addColumn('def_blob_null', 'blob', array('notnull' => false, 'default' => 'def')); - $this->assertSame( + self::assertSame( array('CREATE TABLE text_blob_default_value (def_text LONGTEXT NOT NULL, def_text_null LONGTEXT DEFAULT NULL, def_blob LONGBLOB NOT NULL, def_blob_null LONGBLOB DEFAULT NULL) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB'), $this->_platform->getCreateTableSQL($table) ); @@ -680,7 +680,7 @@ public function testDoesNotPropagateDefaultValuesForUnsupportedColumnTypes() $comparator = new Comparator(); - $this->assertEmpty($this->_platform->getAlterTableSQL($comparator->diffTable($table, $diffTable))); + self::assertEmpty($this->_platform->getAlterTableSQL($comparator->diffTable($table, $diffTable))); } /** @@ -723,7 +723,7 @@ protected function getQuotedAlterTableChangeColumnLengthSQL() */ public function testReturnsGuidTypeDeclarationSQL() { - $this->assertSame('CHAR(36)', $this->_platform->getGuidTypeDeclarationSQL(array())); + self::assertSame('CHAR(36)', $this->_platform->getGuidTypeDeclarationSQL(array())); } /** @@ -845,7 +845,7 @@ public function getGeneratesFloatDeclarationSQL() */ public function testQuotesTableNameInListTableIndexesSQL() { - $this->assertContains("'Foo''Bar\\\\'", $this->_platform->getListTableIndexesSQL("Foo'Bar\\", 'foo_db'), '', true); + self::assertContains("'Foo''Bar\\\\'", $this->_platform->getListTableIndexesSQL("Foo'Bar\\", 'foo_db'), '', true); } /** @@ -853,7 +853,7 @@ public function testQuotesTableNameInListTableIndexesSQL() */ public function testQuotesDatabaseNameInListTableIndexesSQL() { - $this->assertContains("'Foo''Bar\\\\'", $this->_platform->getListTableIndexesSQL('foo_table', "Foo'Bar\\"), '', true); + self::assertContains("'Foo''Bar\\\\'", $this->_platform->getListTableIndexesSQL('foo_table', "Foo'Bar\\"), '', true); } /** @@ -861,7 +861,7 @@ public function testQuotesDatabaseNameInListTableIndexesSQL() */ public function testQuotesDatabaseNameInListViewsSQL() { - $this->assertContains("'Foo''Bar\\\\'", $this->_platform->getListViewsSQL("Foo'Bar\\"), '', true); + self::assertContains("'Foo''Bar\\\\'", $this->_platform->getListViewsSQL("Foo'Bar\\"), '', true); } /** @@ -869,7 +869,7 @@ public function testQuotesDatabaseNameInListViewsSQL() */ public function testQuotesTableNameInListTableForeignKeysSQL() { - $this->assertContains("'Foo''Bar\\\\'", $this->_platform->getListTableForeignKeysSQL("Foo'Bar\\"), '', true); + self::assertContains("'Foo''Bar\\\\'", $this->_platform->getListTableForeignKeysSQL("Foo'Bar\\"), '', true); } /** @@ -877,7 +877,7 @@ public function testQuotesTableNameInListTableForeignKeysSQL() */ public function testQuotesDatabaseNameInListTableForeignKeysSQL() { - $this->assertContains("'Foo''Bar\\\\'", $this->_platform->getListTableForeignKeysSQL('foo_table', "Foo'Bar\\"), '', true); + self::assertContains("'Foo''Bar\\\\'", $this->_platform->getListTableForeignKeysSQL('foo_table', "Foo'Bar\\"), '', true); } /** @@ -885,7 +885,7 @@ public function testQuotesDatabaseNameInListTableForeignKeysSQL() */ public function testQuotesTableNameInListTableColumnsSQL() { - $this->assertContains("'Foo''Bar\\\\'", $this->_platform->getListTableColumnsSQL("Foo'Bar\\"), '', true); + self::assertContains("'Foo''Bar\\\\'", $this->_platform->getListTableColumnsSQL("Foo'Bar\\"), '', true); } /** @@ -893,18 +893,18 @@ public function testQuotesTableNameInListTableColumnsSQL() */ public function testQuotesDatabaseNameInListTableColumnsSQL() { - $this->assertContains("'Foo''Bar\\\\'", $this->_platform->getListTableColumnsSQL('foo_table', "Foo'Bar\\"), '', true); + self::assertContains("'Foo''Bar\\\\'", $this->_platform->getListTableColumnsSQL('foo_table', "Foo'Bar\\"), '', true); } public function testListTableForeignKeysSQLEvaluatesDatabase() { $sql = $this->_platform->getListTableForeignKeysSQL('foo'); - $this->assertContains('DATABASE()', $sql); + self::assertContains('DATABASE()', $sql); $sql = $this->_platform->getListTableForeignKeysSQL('foo', 'bar'); - $this->assertContains('bar', $sql); - $this->assertNotContains('DATABASE()', $sql); + self::assertContains('bar', $sql); + self::assertNotContains('DATABASE()', $sql); } } diff --git a/tests/Doctrine/Tests/DBAL/Platforms/AbstractPlatformTestCase.php b/tests/Doctrine/Tests/DBAL/Platforms/AbstractPlatformTestCase.php index a3b0ded7747..ba4646c475f 100644 --- a/tests/Doctrine/Tests/DBAL/Platforms/AbstractPlatformTestCase.php +++ b/tests/Doctrine/Tests/DBAL/Platforms/AbstractPlatformTestCase.php @@ -39,9 +39,9 @@ public function testQuoteIdentifier() } $c = $this->_platform->getIdentifierQuoteCharacter(); - $this->assertEquals($c."test".$c, $this->_platform->quoteIdentifier("test")); - $this->assertEquals($c."test".$c.".".$c."test".$c, $this->_platform->quoteIdentifier("test.test")); - $this->assertEquals(str_repeat($c, 4), $this->_platform->quoteIdentifier($c)); + self::assertEquals($c."test".$c, $this->_platform->quoteIdentifier("test")); + self::assertEquals($c."test".$c.".".$c."test".$c, $this->_platform->quoteIdentifier("test.test")); + self::assertEquals(str_repeat($c, 4), $this->_platform->quoteIdentifier($c)); } /** @@ -54,9 +54,9 @@ public function testQuoteSingleIdentifier() } $c = $this->_platform->getIdentifierQuoteCharacter(); - $this->assertEquals($c."test".$c, $this->_platform->quoteSingleIdentifier("test")); - $this->assertEquals($c."test.test".$c, $this->_platform->quoteSingleIdentifier("test.test")); - $this->assertEquals(str_repeat($c, 4), $this->_platform->quoteSingleIdentifier($c)); + self::assertEquals($c."test".$c, $this->_platform->quoteSingleIdentifier("test")); + self::assertEquals($c."test.test".$c, $this->_platform->quoteSingleIdentifier("test.test")); + self::assertEquals(str_repeat($c, 4), $this->_platform->quoteSingleIdentifier($c)); } /** @@ -66,7 +66,7 @@ public function testQuoteSingleIdentifier() */ public function testReturnsForeignKeyReferentialActionSQL($action, $expectedSQL) { - $this->assertSame($expectedSQL, $this->_platform->getForeignKeyReferentialActionSQL($action)); + self::assertSame($expectedSQL, $this->_platform->getForeignKeyReferentialActionSQL($action)); } /** @@ -99,7 +99,7 @@ public function testGetUnknownDoctrineMappingType() public function testRegisterDoctrineMappingType() { $this->_platform->registerDoctrineTypeMapping('foo', 'integer'); - $this->assertEquals('integer', $this->_platform->getDoctrineTypeMapping('foo')); + self::assertEquals('integer', $this->_platform->getDoctrineTypeMapping('foo')); } public function testRegisterUnknownDoctrineMappingType() @@ -120,7 +120,7 @@ public function testRegistersCommentedDoctrineMappingTypeImplicitly() $type = Type::getType('my_commented'); $this->_platform->registerDoctrineTypeMapping('foo', 'my_commented'); - $this->assertTrue($this->_platform->isCommentedDoctrineType($type)); + self::assertTrue($this->_platform->isCommentedDoctrineType($type)); } /** @@ -130,7 +130,7 @@ public function testRegistersCommentedDoctrineMappingTypeImplicitly() */ public function testIsCommentedDoctrineType(Type $type, $commented) { - $this->assertSame($commented, $this->_platform->isCommentedDoctrineType($type)); + self::assertSame($commented, $this->_platform->isCommentedDoctrineType($type)); } public function getIsCommentedDoctrineType() @@ -167,7 +167,7 @@ public function testGeneratesTableCreationSql() $table->setPrimaryKey(array('id')); $sql = $this->_platform->getCreateTableSQL($table); - $this->assertEquals($this->getGenerateTableSql(), $sql[0]); + self::assertEquals($this->getGenerateTableSql(), $sql[0]); } abstract public function getGenerateTableSql(); @@ -180,7 +180,7 @@ public function testGenerateTableWithMultiColumnUniqueIndex() $table->addUniqueIndex(array("foo", "bar")); $sql = $this->_platform->getCreateTableSQL($table); - $this->assertEquals($this->getGenerateTableWithMultiColumnUniqueIndexSql(), $sql); + self::assertEquals($this->getGenerateTableWithMultiColumnUniqueIndexSql(), $sql); } abstract public function getGenerateTableWithMultiColumnUniqueIndexSql(); @@ -189,7 +189,7 @@ public function testGeneratesIndexCreationSql() { $indexDef = new \Doctrine\DBAL\Schema\Index('my_idx', array('user_name', 'last_login')); - $this->assertEquals( + self::assertEquals( $this->getGenerateIndexSql(), $this->_platform->getCreateIndexSQL($indexDef, 'mytable') ); @@ -202,7 +202,7 @@ public function testGeneratesUniqueIndexCreationSql() $indexDef = new \Doctrine\DBAL\Schema\Index('index_name', array('test', 'test2'), true); $sql = $this->_platform->getCreateIndexSQL($indexDef, 'test'); - $this->assertEquals($this->getGenerateUniqueIndexSql(), $sql); + self::assertEquals($this->getGenerateUniqueIndexSql(), $sql); } abstract public function getGenerateUniqueIndexSql(); @@ -226,9 +226,9 @@ public function testGeneratesPartialIndexesSqlOnlyWhenSupportingPartialIndexes() foreach ($actuals as $actual) { if ($this->_platform->supportsPartialIndexes()) { - $this->assertStringEndsWith($expected, $actual, 'WHERE clause should be present'); + self::assertStringEndsWith($expected, $actual, 'WHERE clause should be present'); } else { - $this->assertStringEndsNotWith($expected, $actual, 'WHERE clause should NOT be present'); + self::assertStringEndsNotWith($expected, $actual, 'WHERE clause should NOT be present'); } } } @@ -238,7 +238,7 @@ public function testGeneratesForeignKeyCreationSql() $fk = new \Doctrine\DBAL\Schema\ForeignKeyConstraint(array('fk_name_id'), 'other_table', array('id'), ''); $sql = $this->_platform->getCreateForeignKeySQL($fk, 'test'); - $this->assertEquals($sql, $this->getGenerateForeignKeySql()); + self::assertEquals($sql, $this->getGenerateForeignKeySql()); } abstract public function getGenerateForeignKeySql(); @@ -247,15 +247,15 @@ public function testGeneratesConstraintCreationSql() { $idx = new \Doctrine\DBAL\Schema\Index('constraint_name', array('test'), true, false); $sql = $this->_platform->getCreateConstraintSQL($idx, 'test'); - $this->assertEquals($this->getGenerateConstraintUniqueIndexSql(), $sql); + self::assertEquals($this->getGenerateConstraintUniqueIndexSql(), $sql); $pk = new \Doctrine\DBAL\Schema\Index('constraint_name', array('test'), true, true); $sql = $this->_platform->getCreateConstraintSQL($pk, 'test'); - $this->assertEquals($this->getGenerateConstraintPrimaryIndexSql(), $sql); + self::assertEquals($this->getGenerateConstraintPrimaryIndexSql(), $sql); $fk = new \Doctrine\DBAL\Schema\ForeignKeyConstraint(array('fk_name'), 'foreign', array('id'), 'constraint_fk'); $sql = $this->_platform->getCreateConstraintSQL($fk, 'test'); - $this->assertEquals($this->getGenerateConstraintForeignKeySql($fk), $sql); + self::assertEquals($this->getGenerateConstraintForeignKeySql($fk), $sql); } public function testGeneratesForeignKeySqlOnlyWhenSupportingForeignKeys() @@ -263,7 +263,7 @@ public function testGeneratesForeignKeySqlOnlyWhenSupportingForeignKeys() $fk = new \Doctrine\DBAL\Schema\ForeignKeyConstraint(array('fk_name'), 'foreign', array('id'), 'constraint_fk'); if ($this->_platform->supportsForeignKeyConstraints()) { - $this->assertInternalType( + self::assertInternalType( 'string', $this->_platform->getCreateForeignKeySQL($fk, 'test') ); @@ -284,7 +284,7 @@ protected function getBitAndComparisonExpressionSql($value1, $value2) public function testGeneratesBitAndComparisonExpressionSql() { $sql = $this->_platform->getBitAndComparisonExpression(2, 4); - $this->assertEquals($this->getBitAndComparisonExpressionSql(2, 4), $sql); + self::assertEquals($this->getBitAndComparisonExpressionSql(2, 4), $sql); } protected function getBitOrComparisonExpressionSql($value1, $value2) @@ -298,7 +298,7 @@ protected function getBitOrComparisonExpressionSql($value1, $value2) public function testGeneratesBitOrComparisonExpressionSql() { $sql = $this->_platform->getBitOrComparisonExpression(2, 4); - $this->assertEquals($this->getBitOrComparisonExpressionSql(2, 4), $sql); + self::assertEquals($this->getBitOrComparisonExpressionSql(2, 4), $sql); } public function getGenerateConstraintUniqueIndexSql() @@ -351,13 +351,13 @@ public function testGeneratesTableAlterationSql() $sql = $this->_platform->getAlterTableSQL($tableDiff); - $this->assertEquals($expectedSql, $sql); + self::assertEquals($expectedSql, $sql); } public function testGetCustomColumnDeclarationSql() { $field = array('columnDefinition' => 'MEDIUMINT(6) UNSIGNED'); - $this->assertEquals('foo MEDIUMINT(6) UNSIGNED', $this->_platform->getColumnDeclarationSQL('foo', $field)); + self::assertEquals('foo MEDIUMINT(6) UNSIGNED', $this->_platform->getColumnDeclarationSQL('foo', $field)); } public function testGetCreateTableSqlDispatchEvent() @@ -471,7 +471,7 @@ public function testCreateTableColumnComments() $table->addColumn('id', 'integer', array('comment' => 'This is a comment')); $table->setPrimaryKey(array('id')); - $this->assertEquals($this->getCreateTableColumnCommentsSQL(), $this->_platform->getCreateTableSQL($table)); + self::assertEquals($this->getCreateTableColumnCommentsSQL(), $this->_platform->getCreateTableSQL($table)); } /** @@ -494,7 +494,7 @@ public function testAlterTableColumnComments() array('comment') ); - $this->assertEquals($this->getAlterTableColumnCommentsSQL(), $this->_platform->getAlterTableSQL($tableDiff)); + self::assertEquals($this->getAlterTableColumnCommentsSQL(), $this->_platform->getAlterTableSQL($tableDiff)); } public function testCreateTableColumnTypeComments() @@ -504,7 +504,7 @@ public function testCreateTableColumnTypeComments() $table->addColumn('data', 'array'); $table->setPrimaryKey(array('id')); - $this->assertEquals($this->getCreateTableColumnTypeCommentsSQL(), $this->_platform->getCreateTableSQL($table)); + self::assertEquals($this->getCreateTableColumnTypeCommentsSQL(), $this->_platform->getCreateTableSQL($table)); } public function getCreateTableColumnCommentsSQL() @@ -530,7 +530,7 @@ public function testGetDefaultValueDeclarationSQL() 'default' => 'non_timestamp' ); - $this->assertEquals(" DEFAULT 'non_timestamp'", $this->_platform->getDefaultValueDeclarationSQL($field)); + self::assertEquals(" DEFAULT 'non_timestamp'", $this->_platform->getDefaultValueDeclarationSQL($field)); } public function testGetDefaultValueDeclarationSQLDateTime() @@ -543,7 +543,7 @@ public function testGetDefaultValueDeclarationSQLDateTime() 'default' => $this->_platform->getCurrentTimestampSQL() ); - $this->assertEquals(' DEFAULT ' . $this->_platform->getCurrentTimestampSQL(), $this->_platform->getDefaultValueDeclarationSQL($field)); + self::assertEquals(' DEFAULT ' . $this->_platform->getCurrentTimestampSQL(), $this->_platform->getDefaultValueDeclarationSQL($field)); } } @@ -556,7 +556,7 @@ public function testGetDefaultValueDeclarationSQLForIntegerTypes() 'default' => 1 ); - $this->assertEquals( + self::assertEquals( ' DEFAULT 1', $this->_platform->getDefaultValueDeclarationSQL($field) ); @@ -569,9 +569,9 @@ public function testGetDefaultValueDeclarationSQLForIntegerTypes() public function testKeywordList() { $keywordList = $this->_platform->getReservedKeywordsList(); - $this->assertInstanceOf('Doctrine\DBAL\Platforms\Keywords\KeywordList', $keywordList); + self::assertInstanceOf('Doctrine\DBAL\Platforms\Keywords\KeywordList', $keywordList); - $this->assertTrue($keywordList->isKeyword('table')); + self::assertTrue($keywordList->isKeyword('table')); } /** @@ -584,7 +584,7 @@ public function testQuotedColumnInPrimaryKeyPropagation() $table->setPrimaryKey(array('create')); $sql = $this->_platform->getCreateTableSQL($table); - $this->assertEquals($this->getQuotedColumnInPrimaryKeySQL(), $sql); + self::assertEquals($this->getQuotedColumnInPrimaryKeySQL(), $sql); } abstract protected function getQuotedColumnInPrimaryKeySQL(); @@ -602,7 +602,7 @@ public function testQuotedColumnInIndexPropagation() $table->addIndex(array('create')); $sql = $this->_platform->getCreateTableSQL($table); - $this->assertEquals($this->getQuotedColumnInIndexSQL(), $sql); + self::assertEquals($this->getQuotedColumnInIndexSQL(), $sql); } public function testQuotedNameInIndexSQL() @@ -612,7 +612,7 @@ public function testQuotedNameInIndexSQL() $table->addIndex(array('column1'), '`key`'); $sql = $this->_platform->getCreateTableSQL($table); - $this->assertEquals($this->getQuotedNameInIndexSQL(), $sql); + self::assertEquals($this->getQuotedNameInIndexSQL(), $sql); } /** @@ -650,7 +650,7 @@ public function testQuotedColumnInForeignKeyPropagation() $table->addForeignKeyConstraint($foreignTable, array('create', 'foo', '`bar`'), array('create', 'bar', '`foo-bar`'), array(), 'FK_WITH_INTENDED_QUOTATION'); $sql = $this->_platform->getCreateTableSQL($table, AbstractPlatform::CREATE_FOREIGNKEYS); - $this->assertEquals($this->getQuotedColumnInForeignKeySQL(), $sql); + self::assertEquals($this->getQuotedColumnInForeignKeySQL(), $sql); } /** @@ -660,7 +660,7 @@ public function testQuotesReservedKeywordInUniqueConstraintDeclarationSQL() { $index = new Index('select', array('foo'), true); - $this->assertSame( + self::assertSame( $this->getQuotesReservedKeywordInUniqueConstraintDeclarationSQL(), $this->_platform->getUniqueConstraintDeclarationSQL('select', $index) ); @@ -676,7 +676,7 @@ abstract protected function getQuotesReservedKeywordInUniqueConstraintDeclaratio */ public function testQuotesReservedKeywordInTruncateTableSQL() { - $this->assertSame( + self::assertSame( $this->getQuotesReservedKeywordInTruncateTableSQL(), $this->_platform->getTruncateTableSQL('select') ); @@ -698,7 +698,7 @@ public function testQuotesReservedKeywordInIndexDeclarationSQL() $this->expectException('Doctrine\DBAL\DBALException'); } - $this->assertSame( + self::assertSame( $this->getQuotesReservedKeywordInIndexDeclarationSQL(), $this->_platform->getIndexDeclarationSQL('select', $index) ); @@ -719,7 +719,7 @@ protected function supportsInlineIndexDeclaration() public function testSupportsCommentOnStatement() { - $this->assertSame($this->supportsCommentOnStatement(), $this->_platform->supportsCommentOnStatement()); + self::assertSame($this->supportsCommentOnStatement(), $this->_platform->supportsCommentOnStatement()); } /** @@ -752,7 +752,7 @@ public function testAlterTableChangeQuotedColumn() array('type') ); - $this->assertContains( + self::assertContains( $this->_platform->quoteIdentifier('select'), implode(';', $this->_platform->getAlterTableSQL($tableDiff)) ); @@ -763,7 +763,7 @@ public function testAlterTableChangeQuotedColumn() */ public function testUsesSequenceEmulatedIdentityColumns() { - $this->assertFalse($this->_platform->usesSequenceEmulatedIdentityColumns()); + self::assertFalse($this->_platform->usesSequenceEmulatedIdentityColumns()); } /** @@ -777,7 +777,7 @@ public function testReturnsIdentitySequenceName() public function testReturnsBinaryDefaultLength() { - $this->assertSame($this->getBinaryDefaultLength(), $this->_platform->getBinaryDefaultLength()); + self::assertSame($this->getBinaryDefaultLength(), $this->_platform->getBinaryDefaultLength()); } protected function getBinaryDefaultLength() @@ -787,7 +787,7 @@ protected function getBinaryDefaultLength() public function testReturnsBinaryMaxLength() { - $this->assertSame($this->getBinaryMaxLength(), $this->_platform->getBinaryMaxLength()); + self::assertSame($this->getBinaryMaxLength(), $this->_platform->getBinaryMaxLength()); } protected function getBinaryMaxLength() @@ -808,7 +808,7 @@ public function testReturnsBinaryTypeDeclarationSQL() */ public function hasNativeJsonType() { - $this->assertFalse($this->_platform->hasNativeJsonType()); + self::assertFalse($this->_platform->hasNativeJsonType()); } /** @@ -822,7 +822,7 @@ public function testReturnsJsonTypeDeclarationSQL() 'type' => Type::getType('json_array'), ); - $this->assertSame( + self::assertSame( $this->_platform->getClobTypeDeclarationSQL($column), $this->_platform->getJsonTypeDeclarationSQL($column) ); @@ -841,7 +841,7 @@ public function testAlterTableRenameIndex() 'idx_foo' => new Index('idx_bar', array('id')) ); - $this->assertSame( + self::assertSame( $this->getAlterTableRenameIndexSQL(), $this->_platform->getAlterTableSQL($tableDiff) ); @@ -872,7 +872,7 @@ public function testQuotesAlterTableRenameIndex() '`foo`' => new Index('`bar`', array('id')), ); - $this->assertSame( + self::assertSame( $this->getQuotedAlterTableRenameIndexSQL(), $this->_platform->getAlterTableSQL($tableDiff) ); @@ -926,7 +926,7 @@ public function testQuotesAlterTableRenameColumn() $comparator = new Comparator(); - $this->assertEquals( + self::assertEquals( $this->getQuotedAlterTableRenameColumnSQL(), $this->_platform->getAlterTableSQL($comparator->diffTable($fromTable, $toTable)) ); @@ -968,7 +968,7 @@ public function testQuotesAlterTableChangeColumnLength() $comparator = new Comparator(); - $this->assertEquals( + self::assertEquals( $this->getQuotedAlterTableChangeColumnLengthSQL(), $this->_platform->getAlterTableSQL($comparator->diffTable($fromTable, $toTable)) ); @@ -996,7 +996,7 @@ public function testAlterTableRenameIndexInSchema() 'idx_foo' => new Index('idx_bar', array('id')) ); - $this->assertSame( + self::assertSame( $this->getAlterTableRenameIndexInSchemaSQL(), $this->_platform->getAlterTableSQL($tableDiff) ); @@ -1027,7 +1027,7 @@ public function testQuotesAlterTableRenameIndexInSchema() '`foo`' => new Index('`bar`', array('id')), ); - $this->assertSame( + self::assertSame( $this->getQuotedAlterTableRenameIndexInSchemaSQL(), $this->_platform->getAlterTableSQL($tableDiff) ); @@ -1063,8 +1063,8 @@ public function testQuotesDropForeignKeySQL() $foreignKey = new ForeignKeyConstraint(array(), 'foo', array(), 'select'); $expectedSql = $this->getQuotesDropForeignKeySQL(); - $this->assertSame($expectedSql, $this->_platform->getDropForeignKeySQL($foreignKeyName, $tableName)); - $this->assertSame($expectedSql, $this->_platform->getDropForeignKeySQL($foreignKey, $table)); + self::assertSame($expectedSql, $this->_platform->getDropForeignKeySQL($foreignKeyName, $tableName)); + self::assertSame($expectedSql, $this->_platform->getDropForeignKeySQL($foreignKey, $table)); } protected function getQuotesDropForeignKeySQL() @@ -1083,8 +1083,8 @@ public function testQuotesDropConstraintSQL() $constraint = new ForeignKeyConstraint(array(), 'foo', array(), 'select'); $expectedSql = $this->getQuotesDropConstraintSQL(); - $this->assertSame($expectedSql, $this->_platform->getDropConstraintSQL($constraintName, $tableName)); - $this->assertSame($expectedSql, $this->_platform->getDropConstraintSQL($constraint, $table)); + self::assertSame($expectedSql, $this->_platform->getDropConstraintSQL($constraintName, $tableName)); + self::assertSame($expectedSql, $this->_platform->getDropConstraintSQL($constraint, $table)); } protected function getQuotesDropConstraintSQL() @@ -1099,7 +1099,7 @@ protected function getStringLiteralQuoteCharacter() public function testGetStringLiteralQuoteCharacter() { - $this->assertSame($this->getStringLiteralQuoteCharacter(), $this->_platform->getStringLiteralQuoteCharacter()); + self::assertSame($this->getStringLiteralQuoteCharacter(), $this->_platform->getStringLiteralQuoteCharacter()); } protected function getQuotedCommentOnColumnSQLWithoutQuoteCharacter() @@ -1109,7 +1109,7 @@ protected function getQuotedCommentOnColumnSQLWithoutQuoteCharacter() public function testGetCommentOnColumnSQLWithoutQuoteCharacter() { - $this->assertEquals( + self::assertEquals( $this->getQuotedCommentOnColumnSQLWithoutQuoteCharacter(), $this->_platform->getCommentOnColumnSQL('mytable', 'id', 'This is a comment') ); @@ -1124,7 +1124,7 @@ public function testGetCommentOnColumnSQLWithQuoteCharacter() { $c = $this->getStringLiteralQuoteCharacter(); - $this->assertEquals( + self::assertEquals( $this->getQuotedCommentOnColumnSQLWithQuoteCharacter(), $this->_platform->getCommentOnColumnSQL('mytable', 'id', "It" . $c . "s a quote !") ); @@ -1142,7 +1142,7 @@ abstract protected function getCommentOnColumnSQL(); */ public function testGetCommentOnColumnSQL() { - $this->assertSame( + self::assertSame( $this->getCommentOnColumnSQL(), array( $this->_platform->getCommentOnColumnSQL('foo', 'bar', 'comment'), // regular identifiers @@ -1163,7 +1163,7 @@ public function testGeneratesInlineColumnCommentSQL($comment, $expectedSql) $this->markTestSkipped(sprintf('%s does not support inline column comments.', get_class($this->_platform))); } - $this->assertSame($expectedSql, $this->_platform->getInlineColumnCommentSQL($comment)); + self::assertSame($expectedSql, $this->_platform->getInlineColumnCommentSQL($comment)); } public function getGeneratesInlineColumnCommentSQL() @@ -1238,15 +1238,15 @@ public function testQuoteStringLiteral() { $c = $this->getStringLiteralQuoteCharacter(); - $this->assertEquals( + self::assertEquals( $this->getQuotedStringLiteralWithoutQuoteCharacter(), $this->_platform->quoteStringLiteral('No quote') ); - $this->assertEquals( + self::assertEquals( $this->getQuotedStringLiteralWithQuoteCharacter(), $this->_platform->quoteStringLiteral('It' . $c . 's a quote') ); - $this->assertEquals( + self::assertEquals( $this->getQuotedStringLiteralQuoteCharacter(), $this->_platform->quoteStringLiteral($c) ); @@ -1282,7 +1282,7 @@ public function testGeneratesAlterTableRenameColumnSQL() array('notnull' => true, 'default' => 666, 'comment' => 'rename test') ); - $this->assertSame($this->getAlterTableRenameColumnSQL(), $this->_platform->getAlterTableSQL($tableDiff)); + self::assertSame($this->getAlterTableRenameColumnSQL(), $this->_platform->getAlterTableSQL($tableDiff)); } /** @@ -1321,7 +1321,7 @@ public function testQuotesTableIdentifiersInAlterTableSQL() $tableDiff->changedForeignKeys[] = new ForeignKeyConstraint(array('fk2'), 'fk_table2', array('id'), 'fk2'); $tableDiff->removedForeignKeys[] = new ForeignKeyConstraint(array('fk'), 'fk_table', array('id'), 'fk1'); - $this->assertSame( + self::assertSame( $this->getQuotesTableIdentifiersInAlterTableSQL(), $this->_platform->getAlterTableSQL($tableDiff) ); @@ -1355,7 +1355,7 @@ public function testAlterStringToFixedString() $expectedSql = $this->getAlterStringToFixedStringSQL(); - $this->assertEquals($expectedSql, $sql); + self::assertEquals($expectedSql, $sql); } /** @@ -1385,7 +1385,7 @@ public function testGeneratesAlterTableRenameIndexUsedByForeignKeySQL() $tableDiff->fromTable = $primaryTable; $tableDiff->renamedIndexes['idx_foo'] = new Index('idx_foo_renamed', array('foo')); - $this->assertSame( + self::assertSame( $this->getGeneratesAlterTableRenameIndexUsedByForeignKeySQL(), $this->_platform->getAlterTableSQL($tableDiff) ); @@ -1403,7 +1403,7 @@ abstract protected function getGeneratesAlterTableRenameIndexUsedByForeignKeySQL */ public function testGeneratesDecimalTypeDeclarationSQL(array $column, $expectedSql) { - $this->assertSame($expectedSql, $this->_platform->getDecimalTypeDeclarationSQL($column)); + self::assertSame($expectedSql, $this->_platform->getDecimalTypeDeclarationSQL($column)); } /** @@ -1428,7 +1428,7 @@ public function getGeneratesDecimalTypeDeclarationSQL() */ public function testGeneratesFloatDeclarationSQL(array $column, $expectedSql) { - $this->assertSame($expectedSql, $this->_platform->getFloatDeclarationSQL($column)); + self::assertSame($expectedSql, $this->_platform->getFloatDeclarationSQL($column)); } /** diff --git a/tests/Doctrine/Tests/DBAL/Platforms/AbstractPostgreSqlPlatformTestCase.php b/tests/Doctrine/Tests/DBAL/Platforms/AbstractPostgreSqlPlatformTestCase.php index 48931ad2d52..22f08a6fd1d 100644 --- a/tests/Doctrine/Tests/DBAL/Platforms/AbstractPostgreSqlPlatformTestCase.php +++ b/tests/Doctrine/Tests/DBAL/Platforms/AbstractPostgreSqlPlatformTestCase.php @@ -53,7 +53,7 @@ public function testGeneratesForeignKeySqlForNonStandardOptions() $foreignKey = new \Doctrine\DBAL\Schema\ForeignKeyConstraint( array('foreign_id'), 'my_table', array('id'), 'my_fk', array('onDelete' => 'CASCADE') ); - $this->assertEquals( + self::assertEquals( "CONSTRAINT my_fk FOREIGN KEY (foreign_id) REFERENCES my_table (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE", $this->_platform->getForeignKeyDeclarationSQL($foreignKey) ); @@ -61,7 +61,7 @@ public function testGeneratesForeignKeySqlForNonStandardOptions() $foreignKey = new \Doctrine\DBAL\Schema\ForeignKeyConstraint( array('foreign_id'), 'my_table', array('id'), 'my_fk', array('match' => 'full') ); - $this->assertEquals( + self::assertEquals( "CONSTRAINT my_fk FOREIGN KEY (foreign_id) REFERENCES my_table (id) MATCH full NOT DEFERRABLE INITIALLY IMMEDIATE", $this->_platform->getForeignKeyDeclarationSQL($foreignKey) ); @@ -69,7 +69,7 @@ public function testGeneratesForeignKeySqlForNonStandardOptions() $foreignKey = new \Doctrine\DBAL\Schema\ForeignKeyConstraint( array('foreign_id'), 'my_table', array('id'), 'my_fk', array('deferrable' => true) ); - $this->assertEquals( + self::assertEquals( "CONSTRAINT my_fk FOREIGN KEY (foreign_id) REFERENCES my_table (id) DEFERRABLE INITIALLY IMMEDIATE", $this->_platform->getForeignKeyDeclarationSQL($foreignKey) ); @@ -77,7 +77,7 @@ public function testGeneratesForeignKeySqlForNonStandardOptions() $foreignKey = new \Doctrine\DBAL\Schema\ForeignKeyConstraint( array('foreign_id'), 'my_table', array('id'), 'my_fk', array('deferred' => true) ); - $this->assertEquals( + self::assertEquals( "CONSTRAINT my_fk FOREIGN KEY (foreign_id) REFERENCES my_table (id) NOT DEFERRABLE INITIALLY DEFERRED", $this->_platform->getForeignKeyDeclarationSQL($foreignKey) ); @@ -85,7 +85,7 @@ public function testGeneratesForeignKeySqlForNonStandardOptions() $foreignKey = new \Doctrine\DBAL\Schema\ForeignKeyConstraint( array('foreign_id'), 'my_table', array('id'), 'my_fk', array('feferred' => true) ); - $this->assertEquals( + self::assertEquals( "CONSTRAINT my_fk FOREIGN KEY (foreign_id) REFERENCES my_table (id) NOT DEFERRABLE INITIALLY DEFERRED", $this->_platform->getForeignKeyDeclarationSQL($foreignKey) ); @@ -93,7 +93,7 @@ public function testGeneratesForeignKeySqlForNonStandardOptions() $foreignKey = new \Doctrine\DBAL\Schema\ForeignKeyConstraint( array('foreign_id'), 'my_table', array('id'), 'my_fk', array('deferrable' => true, 'deferred' => true, 'match' => 'full') ); - $this->assertEquals( + self::assertEquals( "CONSTRAINT my_fk FOREIGN KEY (foreign_id) REFERENCES my_table (id) MATCH full DEFERRABLE INITIALLY DEFERRED", $this->_platform->getForeignKeyDeclarationSQL($foreignKey) ); @@ -101,28 +101,28 @@ public function testGeneratesForeignKeySqlForNonStandardOptions() public function testGeneratesSqlSnippets() { - $this->assertEquals('SIMILAR TO', $this->_platform->getRegexpExpression(), 'Regular expression operator is not correct'); - $this->assertEquals('"', $this->_platform->getIdentifierQuoteCharacter(), 'Identifier quote character is not correct'); - $this->assertEquals('column1 || column2 || column3', $this->_platform->getConcatExpression('column1', 'column2', 'column3'), 'Concatenation expression is not correct'); - $this->assertEquals('SUBSTRING(column FROM 5)', $this->_platform->getSubstringExpression('column', 5), 'Substring expression without length is not correct'); - $this->assertEquals('SUBSTRING(column FROM 1 FOR 5)', $this->_platform->getSubstringExpression('column', 1, 5), 'Substring expression with length is not correct'); + self::assertEquals('SIMILAR TO', $this->_platform->getRegexpExpression(), 'Regular expression operator is not correct'); + self::assertEquals('"', $this->_platform->getIdentifierQuoteCharacter(), 'Identifier quote character is not correct'); + self::assertEquals('column1 || column2 || column3', $this->_platform->getConcatExpression('column1', 'column2', 'column3'), 'Concatenation expression is not correct'); + self::assertEquals('SUBSTRING(column FROM 5)', $this->_platform->getSubstringExpression('column', 5), 'Substring expression without length is not correct'); + self::assertEquals('SUBSTRING(column FROM 1 FOR 5)', $this->_platform->getSubstringExpression('column', 1, 5), 'Substring expression with length is not correct'); } public function testGeneratesTransactionCommands() { - $this->assertEquals( + self::assertEquals( 'SET SESSION CHARACTERISTICS AS TRANSACTION ISOLATION LEVEL READ UNCOMMITTED', $this->_platform->getSetTransactionIsolationSQL(\Doctrine\DBAL\Connection::TRANSACTION_READ_UNCOMMITTED) ); - $this->assertEquals( + self::assertEquals( 'SET SESSION CHARACTERISTICS AS TRANSACTION ISOLATION LEVEL READ COMMITTED', $this->_platform->getSetTransactionIsolationSQL(\Doctrine\DBAL\Connection::TRANSACTION_READ_COMMITTED) ); - $this->assertEquals( + self::assertEquals( 'SET SESSION CHARACTERISTICS AS TRANSACTION ISOLATION LEVEL REPEATABLE READ', $this->_platform->getSetTransactionIsolationSQL(\Doctrine\DBAL\Connection::TRANSACTION_REPEATABLE_READ) ); - $this->assertEquals( + self::assertEquals( 'SET SESSION CHARACTERISTICS AS TRANSACTION ISOLATION LEVEL SERIALIZABLE', $this->_platform->getSetTransactionIsolationSQL(\Doctrine\DBAL\Connection::TRANSACTION_SERIALIZABLE) ); @@ -130,9 +130,9 @@ public function testGeneratesTransactionCommands() public function testGeneratesDDLSnippets() { - $this->assertEquals('CREATE DATABASE foobar', $this->_platform->getCreateDatabaseSQL('foobar')); - $this->assertEquals('DROP DATABASE foobar', $this->_platform->getDropDatabaseSQL('foobar')); - $this->assertEquals('DROP TABLE foobar', $this->_platform->getDropTableSQL('foobar')); + self::assertEquals('CREATE DATABASE foobar', $this->_platform->getCreateDatabaseSQL('foobar')); + self::assertEquals('DROP DATABASE foobar', $this->_platform->getDropDatabaseSQL('foobar')); + self::assertEquals('DROP TABLE foobar', $this->_platform->getDropTableSQL('foobar')); } public function testGenerateTableWithAutoincrement() @@ -141,20 +141,20 @@ public function testGenerateTableWithAutoincrement() $column = $table->addColumn('id', 'integer'); $column->setAutoincrement(true); - $this->assertEquals(array('CREATE TABLE autoinc_table (id SERIAL NOT NULL)'), $this->_platform->getCreateTableSQL($table)); + self::assertEquals(array('CREATE TABLE autoinc_table (id SERIAL NOT NULL)'), $this->_platform->getCreateTableSQL($table)); } public function testGeneratesTypeDeclarationForIntegers() { - $this->assertEquals( + self::assertEquals( 'INT', $this->_platform->getIntegerTypeDeclarationSQL(array()) ); - $this->assertEquals( + self::assertEquals( 'SERIAL', $this->_platform->getIntegerTypeDeclarationSQL(array('autoincrement' => true) )); - $this->assertEquals( + self::assertEquals( 'SERIAL', $this->_platform->getIntegerTypeDeclarationSQL( array('autoincrement' => true, 'primary' => true) @@ -163,17 +163,17 @@ public function testGeneratesTypeDeclarationForIntegers() public function testGeneratesTypeDeclarationForStrings() { - $this->assertEquals( + self::assertEquals( 'CHAR(10)', $this->_platform->getVarcharTypeDeclarationSQL( array('length' => 10, 'fixed' => true)) ); - $this->assertEquals( + self::assertEquals( 'VARCHAR(50)', $this->_platform->getVarcharTypeDeclarationSQL(array('length' => 50)), 'Variable string declaration is not correct' ); - $this->assertEquals( + self::assertEquals( 'VARCHAR(255)', $this->_platform->getVarcharTypeDeclarationSQL(array()), 'Long string declaration is not correct' @@ -188,15 +188,15 @@ public function getGenerateUniqueIndexSql() public function testGeneratesSequenceSqlCommands() { $sequence = new \Doctrine\DBAL\Schema\Sequence('myseq', 20, 1); - $this->assertEquals( + self::assertEquals( 'CREATE SEQUENCE myseq INCREMENT BY 20 MINVALUE 1 START 1', $this->_platform->getCreateSequenceSQL($sequence) ); - $this->assertEquals( + self::assertEquals( 'DROP SEQUENCE myseq CASCADE', $this->_platform->getDropSequenceSQL('myseq') ); - $this->assertEquals( + self::assertEquals( "SELECT NEXTVAL('myseq')", $this->_platform->getSequenceNextValSQL('myseq') ); @@ -204,27 +204,27 @@ public function testGeneratesSequenceSqlCommands() public function testDoesNotPreferIdentityColumns() { - $this->assertFalse($this->_platform->prefersIdentityColumns()); + self::assertFalse($this->_platform->prefersIdentityColumns()); } public function testPrefersSequences() { - $this->assertTrue($this->_platform->prefersSequences()); + self::assertTrue($this->_platform->prefersSequences()); } public function testSupportsIdentityColumns() { - $this->assertTrue($this->_platform->supportsIdentityColumns()); + self::assertTrue($this->_platform->supportsIdentityColumns()); } public function testSupportsSavePoints() { - $this->assertTrue($this->_platform->supportsSavepoints()); + self::assertTrue($this->_platform->supportsSavepoints()); } public function testSupportsSequences() { - $this->assertTrue($this->_platform->supportsSequences()); + self::assertTrue($this->_platform->supportsSequences()); } /** @@ -238,13 +238,13 @@ protected function supportsCommentOnStatement() public function testModifyLimitQuery() { $sql = $this->_platform->modifyLimitQuery('SELECT * FROM user', 10, 0); - $this->assertEquals('SELECT * FROM user LIMIT 10 OFFSET 0', $sql); + self::assertEquals('SELECT * FROM user LIMIT 10 OFFSET 0', $sql); } public function testModifyLimitQueryWithEmptyOffset() { $sql = $this->_platform->modifyLimitQuery('SELECT * FROM user', 10); - $this->assertEquals('SELECT * FROM user LIMIT 10', $sql); + self::assertEquals('SELECT * FROM user LIMIT 10', $sql); } public function getCreateTableColumnCommentsSQL() @@ -323,7 +323,7 @@ public function testConvertBooleanAsLiteralStrings( ) { $platform = $this->createPlatform(); - $this->assertEquals($preparedStatementValue, $platform->convertBooleans($databaseValue)); + self::assertEquals($preparedStatementValue, $platform->convertBooleans($databaseValue)); } /** @@ -334,11 +334,11 @@ public function testConvertBooleanAsLiteralIntegers() $platform = $this->createPlatform(); $platform->setUseBooleanTrueFalseStrings(false); - $this->assertEquals(1, $platform->convertBooleans(true)); - $this->assertEquals(1, $platform->convertBooleans('1')); + self::assertEquals(1, $platform->convertBooleans(true)); + self::assertEquals(1, $platform->convertBooleans('1')); - $this->assertEquals(0, $platform->convertBooleans(false)); - $this->assertEquals(0, $platform->convertBooleans('0')); + self::assertEquals(0, $platform->convertBooleans(false)); + self::assertEquals(0, $platform->convertBooleans('0')); } /** @@ -359,7 +359,7 @@ public function testConvertBooleanAsDatabaseValueStrings( { $platform = $this->createPlatform(); - $this->assertSame($integerValue, $platform->convertBooleansToDatabaseValue($booleanValue)); + self::assertSame($integerValue, $platform->convertBooleansToDatabaseValue($booleanValue)); } /** @@ -370,8 +370,8 @@ public function testConvertBooleanAsDatabaseValueIntegers() $platform = $this->createPlatform(); $platform->setUseBooleanTrueFalseStrings(false); - $this->assertSame(1, $platform->convertBooleansToDatabaseValue(true)); - $this->assertSame(0, $platform->convertBooleansToDatabaseValue(false)); + self::assertSame(1, $platform->convertBooleansToDatabaseValue(true)); + self::assertSame(0, $platform->convertBooleansToDatabaseValue(false)); } /** @@ -386,7 +386,7 @@ public function testConvertFromBoolean($databaseValue, $prepareStatementValue, $ { $platform = $this->createPlatform(); - $this->assertSame($booleanValue, $platform->convertFromBoolean($databaseValue)); + self::assertSame($booleanValue, $platform->convertFromBoolean($databaseValue)); } /** @@ -402,7 +402,7 @@ public function testGetCreateSchemaSQL() { $schemaName = 'schema'; $sql = $this->_platform->getCreateSchemaSQL($schemaName); - $this->assertEquals('CREATE SCHEMA ' . $schemaName, $sql); + self::assertEquals('CREATE SCHEMA ' . $schemaName, $sql); } public function testAlterDecimalPrecisionScale() @@ -450,7 +450,7 @@ public function testAlterDecimalPrecisionScale() 'ALTER TABLE mytable ALTER dloo4 TYPE NUMERIC(16, 8)', ); - $this->assertEquals($expectedSql, $sql); + self::assertEquals($expectedSql, $sql); } /** @@ -477,7 +477,7 @@ public function testDroppingConstraintsBeforeColumns() 'ALTER TABLE mytable DROP parent_id', ); - $this->assertEquals($expectedSql, $sql); + self::assertEquals($expectedSql, $sql); } /** @@ -485,7 +485,7 @@ public function testDroppingConstraintsBeforeColumns() */ public function testUsesSequenceEmulatedIdentityColumns() { - $this->assertTrue($this->_platform->usesSequenceEmulatedIdentityColumns()); + self::assertTrue($this->_platform->usesSequenceEmulatedIdentityColumns()); } /** @@ -493,7 +493,7 @@ public function testUsesSequenceEmulatedIdentityColumns() */ public function testReturnsIdentitySequenceName() { - $this->assertSame('mytable_mycolumn_seq', $this->_platform->getIdentitySequenceName('mytable', 'mycolumn')); + self::assertSame('mytable_mycolumn_seq', $this->_platform->getIdentitySequenceName('mytable', 'mycolumn')); } /** @@ -503,7 +503,7 @@ public function testReturnsIdentitySequenceName() public function testCreateSequenceWithCache($cacheSize, $expectedSql) { $sequence = new \Doctrine\DBAL\Schema\Sequence('foo', 1, 1, $cacheSize); - $this->assertContains($expectedSql, $this->_platform->getCreateSequenceSQL($sequence)); + self::assertContains($expectedSql, $this->_platform->getCreateSequenceSQL($sequence)); } public function dataCreateSequenceWithCache() @@ -525,13 +525,13 @@ protected function getBinaryMaxLength() public function testReturnsBinaryTypeDeclarationSQL() { - $this->assertSame('BYTEA', $this->_platform->getBinaryTypeDeclarationSQL(array())); - $this->assertSame('BYTEA', $this->_platform->getBinaryTypeDeclarationSQL(array('length' => 0))); - $this->assertSame('BYTEA', $this->_platform->getBinaryTypeDeclarationSQL(array('length' => 9999999))); + self::assertSame('BYTEA', $this->_platform->getBinaryTypeDeclarationSQL(array())); + self::assertSame('BYTEA', $this->_platform->getBinaryTypeDeclarationSQL(array('length' => 0))); + self::assertSame('BYTEA', $this->_platform->getBinaryTypeDeclarationSQL(array('length' => 9999999))); - $this->assertSame('BYTEA', $this->_platform->getBinaryTypeDeclarationSQL(array('fixed' => true))); - $this->assertSame('BYTEA', $this->_platform->getBinaryTypeDeclarationSQL(array('fixed' => true, 'length' => 0))); - $this->assertSame('BYTEA', $this->_platform->getBinaryTypeDeclarationSQL(array('fixed' => true, 'length' => 9999999))); + self::assertSame('BYTEA', $this->_platform->getBinaryTypeDeclarationSQL(array('fixed' => true))); + self::assertSame('BYTEA', $this->_platform->getBinaryTypeDeclarationSQL(array('fixed' => true, 'length' => 0))); + self::assertSame('BYTEA', $this->_platform->getBinaryTypeDeclarationSQL(array('fixed' => true, 'length' => 9999999))); } public function testDoesNotPropagateUnnecessaryTableAlterationOnBinaryType() @@ -551,7 +551,7 @@ public function testDoesNotPropagateUnnecessaryTableAlterationOnBinaryType() // VARBINARY -> BINARY // BINARY -> VARBINARY // BLOB -> VARBINARY - $this->assertEmpty($this->_platform->getAlterTableSQL($comparator->diffTable($table1, $table2))); + self::assertEmpty($this->_platform->getAlterTableSQL($comparator->diffTable($table1, $table2))); $table2 = new Table('mytable'); $table2->addColumn('column_varbinary', 'binary', array('length' => 42)); @@ -561,7 +561,7 @@ public function testDoesNotPropagateUnnecessaryTableAlterationOnBinaryType() // VARBINARY -> VARBINARY with changed length // BINARY -> BLOB // BLOB -> BINARY - $this->assertEmpty($this->_platform->getAlterTableSQL($comparator->diffTable($table1, $table2))); + self::assertEmpty($this->_platform->getAlterTableSQL($comparator->diffTable($table1, $table2))); $table2 = new Table('mytable'); $table2->addColumn('column_varbinary', 'blob'); @@ -571,7 +571,7 @@ public function testDoesNotPropagateUnnecessaryTableAlterationOnBinaryType() // VARBINARY -> BLOB // BINARY -> BINARY with changed length // BLOB -> BLOB - $this->assertEmpty($this->_platform->getAlterTableSQL($comparator->diffTable($table1, $table2))); + self::assertEmpty($this->_platform->getAlterTableSQL($comparator->diffTable($table1, $table2))); } /** @@ -684,7 +684,7 @@ protected function getQuotesDropForeignKeySQL() public function testGetNullCommentOnColumnSQL() { - $this->assertEquals( + self::assertEquals( "COMMENT ON COLUMN mytable.id IS NULL", $this->_platform->getCommentOnColumnSQL('mytable', 'id', null) ); @@ -695,7 +695,7 @@ public function testGetNullCommentOnColumnSQL() */ public function testReturnsGuidTypeDeclarationSQL() { - $this->assertSame('UUID', $this->_platform->getGuidTypeDeclarationSQL(array())); + self::assertSame('UUID', $this->_platform->getGuidTypeDeclarationSQL(array())); } /** @@ -752,8 +752,8 @@ public function testAltersTableColumnCommentWithExplicitlyQuotedIdentifiers() $tableDiff = $comparator->diffTable($table1, $table2); - $this->assertInstanceOf('Doctrine\DBAL\Schema\TableDiff', $tableDiff); - $this->assertSame( + self::assertInstanceOf('Doctrine\DBAL\Schema\TableDiff', $tableDiff); + self::assertSame( array( 'COMMENT ON COLUMN "foo"."bar" IS \'baz\'', ), @@ -810,8 +810,8 @@ protected function getGeneratesAlterTableRenameIndexUsedByForeignKeySQL() */ public function testInitializesTsvectorTypeMapping() { - $this->assertTrue($this->_platform->hasDoctrineTypeMappingFor('tsvector')); - $this->assertEquals('text', $this->_platform->getDoctrineTypeMapping('tsvector')); + self::assertTrue($this->_platform->hasDoctrineTypeMappingFor('tsvector')); + self::assertEquals('text', $this->_platform->getDoctrineTypeMapping('tsvector')); } /** @@ -819,7 +819,7 @@ public function testInitializesTsvectorTypeMapping() */ public function testReturnsDisallowDatabaseConnectionsSQL() { - $this->assertSame( + self::assertSame( "UPDATE pg_database SET datallowconn = 'false' WHERE datname = 'foo'", $this->_platform->getDisallowDatabaseConnectionsSQL('foo') ); @@ -830,7 +830,7 @@ public function testReturnsDisallowDatabaseConnectionsSQL() */ public function testReturnsCloseActiveDatabaseConnectionsSQL() { - $this->assertSame( + self::assertSame( "SELECT pg_terminate_backend(procpid) FROM pg_stat_activity WHERE datname = 'foo'", $this->_platform->getCloseActiveDatabaseConnectionsSQL('foo') ); @@ -841,7 +841,7 @@ public function testReturnsCloseActiveDatabaseConnectionsSQL() */ public function testQuotesTableNameInListTableForeignKeysSQL() { - $this->assertContains("'Foo''Bar\\\\'", $this->_platform->getListTableForeignKeysSQL("Foo'Bar\\"), '', true); + self::assertContains("'Foo''Bar\\\\'", $this->_platform->getListTableForeignKeysSQL("Foo'Bar\\"), '', true); } /** @@ -849,7 +849,7 @@ public function testQuotesTableNameInListTableForeignKeysSQL() */ public function testQuotesSchemaNameInListTableForeignKeysSQL() { - $this->assertContains( + self::assertContains( "'Foo''Bar\\\\'", $this->_platform->getListTableForeignKeysSQL("Foo'Bar\\.baz_table"), '', @@ -862,7 +862,7 @@ public function testQuotesSchemaNameInListTableForeignKeysSQL() */ public function testQuotesTableNameInListTableConstraintsSQL() { - $this->assertContains("'Foo''Bar\\\\'", $this->_platform->getListTableConstraintsSQL("Foo'Bar\\"), '', true); + self::assertContains("'Foo''Bar\\\\'", $this->_platform->getListTableConstraintsSQL("Foo'Bar\\"), '', true); } /** @@ -870,7 +870,7 @@ public function testQuotesTableNameInListTableConstraintsSQL() */ public function testQuotesTableNameInListTableIndexesSQL() { - $this->assertContains("'Foo''Bar\\\\'", $this->_platform->getListTableIndexesSQL("Foo'Bar\\"), '', true); + self::assertContains("'Foo''Bar\\\\'", $this->_platform->getListTableIndexesSQL("Foo'Bar\\"), '', true); } /** @@ -878,7 +878,7 @@ public function testQuotesTableNameInListTableIndexesSQL() */ public function testQuotesSchemaNameInListTableIndexesSQL() { - $this->assertContains( + self::assertContains( "'Foo''Bar\\\\'", $this->_platform->getListTableIndexesSQL("Foo'Bar\\.baz_table"), '', @@ -891,7 +891,7 @@ public function testQuotesSchemaNameInListTableIndexesSQL() */ public function testQuotesTableNameInListTableColumnsSQL() { - $this->assertContains("'Foo''Bar\\\\'", $this->_platform->getListTableColumnsSQL("Foo'Bar\\"), '', true); + self::assertContains("'Foo''Bar\\\\'", $this->_platform->getListTableColumnsSQL("Foo'Bar\\"), '', true); } /** @@ -899,7 +899,7 @@ public function testQuotesTableNameInListTableColumnsSQL() */ public function testQuotesSchemaNameInListTableColumnsSQL() { - $this->assertContains( + self::assertContains( "'Foo''Bar\\\\'", $this->_platform->getListTableColumnsSQL("Foo'Bar\\.baz_table"), '', @@ -912,7 +912,7 @@ public function testQuotesSchemaNameInListTableColumnsSQL() */ public function testQuotesDatabaseNameInCloseActiveDatabaseConnectionsSQL() { - $this->assertContains( + self::assertContains( "'Foo''Bar\\\\'", $this->_platform->getCloseActiveDatabaseConnectionsSQL("Foo'Bar\\"), '', diff --git a/tests/Doctrine/Tests/DBAL/Platforms/AbstractSQLServerPlatformTestCase.php b/tests/Doctrine/Tests/DBAL/Platforms/AbstractSQLServerPlatformTestCase.php index 8c00fab4968..58d4a174cf1 100644 --- a/tests/Doctrine/Tests/DBAL/Platforms/AbstractSQLServerPlatformTestCase.php +++ b/tests/Doctrine/Tests/DBAL/Platforms/AbstractSQLServerPlatformTestCase.php @@ -55,28 +55,28 @@ public function testDoesNotSupportRegexp() public function testGeneratesSqlSnippets() { - $this->assertEquals('CONVERT(date, GETDATE())', $this->_platform->getCurrentDateSQL()); - $this->assertEquals('CONVERT(time, GETDATE())', $this->_platform->getCurrentTimeSQL()); - $this->assertEquals('CURRENT_TIMESTAMP', $this->_platform->getCurrentTimestampSQL()); - $this->assertEquals('"', $this->_platform->getIdentifierQuoteCharacter(), 'Identifier quote character is not correct'); - $this->assertEquals('(column1 + column2 + column3)', $this->_platform->getConcatExpression('column1', 'column2', 'column3'), 'Concatenation expression is not correct'); + self::assertEquals('CONVERT(date, GETDATE())', $this->_platform->getCurrentDateSQL()); + self::assertEquals('CONVERT(time, GETDATE())', $this->_platform->getCurrentTimeSQL()); + self::assertEquals('CURRENT_TIMESTAMP', $this->_platform->getCurrentTimestampSQL()); + self::assertEquals('"', $this->_platform->getIdentifierQuoteCharacter(), 'Identifier quote character is not correct'); + self::assertEquals('(column1 + column2 + column3)', $this->_platform->getConcatExpression('column1', 'column2', 'column3'), 'Concatenation expression is not correct'); } public function testGeneratesTransactionsCommands() { - $this->assertEquals( + self::assertEquals( 'SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED', $this->_platform->getSetTransactionIsolationSQL(\Doctrine\DBAL\Connection::TRANSACTION_READ_UNCOMMITTED) ); - $this->assertEquals( + self::assertEquals( 'SET TRANSACTION ISOLATION LEVEL READ COMMITTED', $this->_platform->getSetTransactionIsolationSQL(\Doctrine\DBAL\Connection::TRANSACTION_READ_COMMITTED) ); - $this->assertEquals( + self::assertEquals( 'SET TRANSACTION ISOLATION LEVEL REPEATABLE READ', $this->_platform->getSetTransactionIsolationSQL(\Doctrine\DBAL\Connection::TRANSACTION_REPEATABLE_READ) ); - $this->assertEquals( + self::assertEquals( 'SET TRANSACTION ISOLATION LEVEL SERIALIZABLE', $this->_platform->getSetTransactionIsolationSQL(\Doctrine\DBAL\Connection::TRANSACTION_SERIALIZABLE) ); @@ -86,23 +86,23 @@ public function testGeneratesDDLSnippets() { $dropDatabaseExpectation = 'DROP DATABASE foobar'; - $this->assertEquals('SELECT * FROM sys.databases', $this->_platform->getListDatabasesSQL()); - $this->assertEquals('CREATE DATABASE foobar', $this->_platform->getCreateDatabaseSQL('foobar')); - $this->assertEquals($dropDatabaseExpectation, $this->_platform->getDropDatabaseSQL('foobar')); - $this->assertEquals('DROP TABLE foobar', $this->_platform->getDropTableSQL('foobar')); + self::assertEquals('SELECT * FROM sys.databases', $this->_platform->getListDatabasesSQL()); + self::assertEquals('CREATE DATABASE foobar', $this->_platform->getCreateDatabaseSQL('foobar')); + self::assertEquals($dropDatabaseExpectation, $this->_platform->getDropDatabaseSQL('foobar')); + self::assertEquals('DROP TABLE foobar', $this->_platform->getDropTableSQL('foobar')); } public function testGeneratesTypeDeclarationForIntegers() { - $this->assertEquals( + self::assertEquals( 'INT', $this->_platform->getIntegerTypeDeclarationSQL(array()) ); - $this->assertEquals( + self::assertEquals( 'INT IDENTITY', $this->_platform->getIntegerTypeDeclarationSQL(array('autoincrement' => true) )); - $this->assertEquals( + self::assertEquals( 'INT IDENTITY', $this->_platform->getIntegerTypeDeclarationSQL( array('autoincrement' => true, 'primary' => true) @@ -111,23 +111,23 @@ public function testGeneratesTypeDeclarationForIntegers() public function testGeneratesTypeDeclarationsForStrings() { - $this->assertEquals( + self::assertEquals( 'NCHAR(10)', $this->_platform->getVarcharTypeDeclarationSQL( array('length' => 10, 'fixed' => true) )); - $this->assertEquals( + self::assertEquals( 'NVARCHAR(50)', $this->_platform->getVarcharTypeDeclarationSQL(array('length' => 50)), 'Variable string declaration is not correct' ); - $this->assertEquals( + self::assertEquals( 'NVARCHAR(255)', $this->_platform->getVarcharTypeDeclarationSQL(array()), 'Long string declaration is not correct' ); - $this->assertSame('VARCHAR(MAX)', $this->_platform->getClobTypeDeclarationSQL(array())); - $this->assertSame( + self::assertSame('VARCHAR(MAX)', $this->_platform->getClobTypeDeclarationSQL(array())); + self::assertSame( 'VARCHAR(MAX)', $this->_platform->getClobTypeDeclarationSQL(array('length' => 5, 'fixed' => true)) ); @@ -135,27 +135,27 @@ public function testGeneratesTypeDeclarationsForStrings() public function testPrefersIdentityColumns() { - $this->assertTrue($this->_platform->prefersIdentityColumns()); + self::assertTrue($this->_platform->prefersIdentityColumns()); } public function testSupportsIdentityColumns() { - $this->assertTrue($this->_platform->supportsIdentityColumns()); + self::assertTrue($this->_platform->supportsIdentityColumns()); } public function testSupportsCreateDropDatabase() { - $this->assertTrue($this->_platform->supportsCreateDropDatabase()); + self::assertTrue($this->_platform->supportsCreateDropDatabase()); } public function testSupportsSchemas() { - $this->assertTrue($this->_platform->supportsSchemas()); + self::assertTrue($this->_platform->supportsSchemas()); } public function testDoesNotSupportSavePoints() { - $this->assertTrue($this->_platform->supportsSavepoints()); + self::assertTrue($this->_platform->supportsSavepoints()); } public function getGenerateIndexSql() @@ -178,7 +178,7 @@ public function testModifyLimitQuery() $querySql = 'SELECT * FROM user'; $alteredSql = 'SELECT TOP 10 * FROM user'; $sql = $this->_platform->modifyLimitQuery($querySql, 10, 0); - $this->assertEquals(sprintf(self::$selectFromCtePattern, $alteredSql, 1, 10), $sql); + self::assertEquals(sprintf(self::$selectFromCtePattern, $alteredSql, 1, 10), $sql); } public function testModifyLimitQueryWithEmptyOffset() @@ -186,7 +186,7 @@ public function testModifyLimitQueryWithEmptyOffset() $querySql = 'SELECT * FROM user'; $alteredSql = 'SELECT TOP 10 * FROM user'; $sql = $this->_platform->modifyLimitQuery($querySql, 10); - $this->assertEquals(sprintf(self::$selectFromCtePattern, $alteredSql, 1, 10), $sql); + self::assertEquals(sprintf(self::$selectFromCtePattern, $alteredSql, 1, 10), $sql); } public function testModifyLimitQueryWithOffset() @@ -199,7 +199,7 @@ public function testModifyLimitQueryWithOffset() $alteredSql = 'SELECT TOP 15 * FROM user ORDER BY username DESC'; $sql = $this->_platform->modifyLimitQuery($querySql, 10, 5); - $this->assertEquals(sprintf(self::$selectFromCtePattern, $alteredSql, 6, 15), $sql); + self::assertEquals(sprintf(self::$selectFromCtePattern, $alteredSql, 6, 15), $sql); } public function testModifyLimitQueryWithAscOrderBy() @@ -208,7 +208,7 @@ public function testModifyLimitQueryWithAscOrderBy() $alteredSql = 'SELECT TOP 10 * FROM user ORDER BY username ASC'; $sql = $this->_platform->modifyLimitQuery($querySql, 10); - $this->assertEquals(sprintf(self::$selectFromCtePattern, $alteredSql, 1, 10), $sql); + self::assertEquals(sprintf(self::$selectFromCtePattern, $alteredSql, 1, 10), $sql); } public function testModifyLimitQueryWithLowercaseOrderBy() @@ -216,7 +216,7 @@ public function testModifyLimitQueryWithLowercaseOrderBy() $querySql = 'SELECT * FROM user order by username'; $alteredSql = 'SELECT TOP 10 * FROM user order by username'; $sql = $this->_platform->modifyLimitQuery($querySql, 10); - $this->assertEquals(sprintf(self::$selectFromCtePattern, $alteredSql, 1, 10), $sql); + self::assertEquals(sprintf(self::$selectFromCtePattern, $alteredSql, 1, 10), $sql); } public function testModifyLimitQueryWithDescOrderBy() @@ -224,7 +224,7 @@ public function testModifyLimitQueryWithDescOrderBy() $querySql = 'SELECT * FROM user ORDER BY username DESC'; $alteredSql = 'SELECT TOP 10 * FROM user ORDER BY username DESC'; $sql = $this->_platform->modifyLimitQuery($querySql, 10); - $this->assertEquals(sprintf(self::$selectFromCtePattern, $alteredSql, 1, 10), $sql); + self::assertEquals(sprintf(self::$selectFromCtePattern, $alteredSql, 1, 10), $sql); } public function testModifyLimitQueryWithMultipleOrderBy() @@ -232,7 +232,7 @@ public function testModifyLimitQueryWithMultipleOrderBy() $querySql = 'SELECT * FROM user ORDER BY username DESC, usereamil ASC'; $alteredSql = 'SELECT TOP 10 * FROM user ORDER BY username DESC, usereamil ASC'; $sql = $this->_platform->modifyLimitQuery($querySql, 10); - $this->assertEquals(sprintf(self::$selectFromCtePattern, $alteredSql, 1, 10), $sql); + self::assertEquals(sprintf(self::$selectFromCtePattern, $alteredSql, 1, 10), $sql); } public function testModifyLimitQueryWithSubSelect() @@ -240,7 +240,7 @@ public function testModifyLimitQueryWithSubSelect() $querySql = 'SELECT * FROM (SELECT u.id as uid, u.name as uname) dctrn_result'; $alteredSql = 'SELECT TOP 10 * FROM (SELECT u.id as uid, u.name as uname) dctrn_result'; $sql = $this->_platform->modifyLimitQuery($querySql, 10); - $this->assertEquals(sprintf(self::$selectFromCtePattern, $alteredSql, 1, 10), $sql); + self::assertEquals(sprintf(self::$selectFromCtePattern, $alteredSql, 1, 10), $sql); } public function testModifyLimitQueryWithSubSelectAndOrder() @@ -248,12 +248,12 @@ public function testModifyLimitQueryWithSubSelectAndOrder() $querySql = 'SELECT * FROM (SELECT u.id as uid, u.name as uname ORDER BY u.name DESC) dctrn_result'; $alteredSql = 'SELECT TOP 10 * FROM (SELECT u.id as uid, u.name as uname) dctrn_result'; $sql = $this->_platform->modifyLimitQuery($querySql, 10); - $this->assertEquals(sprintf(self::$selectFromCtePattern, $alteredSql, 1, 10), $sql); + self::assertEquals(sprintf(self::$selectFromCtePattern, $alteredSql, 1, 10), $sql); $querySql = 'SELECT * FROM (SELECT u.id, u.name ORDER BY u.name DESC) dctrn_result'; $alteredSql = 'SELECT TOP 10 * FROM (SELECT u.id, u.name) dctrn_result'; $sql = $this->_platform->modifyLimitQuery($querySql, 10); - $this->assertEquals(sprintf(self::$selectFromCtePattern, $alteredSql, 1, 10), $sql); + self::assertEquals(sprintf(self::$selectFromCtePattern, $alteredSql, 1, 10), $sql); } public function testModifyLimitQueryWithSubSelectAndMultipleOrder() @@ -265,17 +265,17 @@ public function testModifyLimitQueryWithSubSelectAndMultipleOrder() $querySql = 'SELECT * FROM (SELECT u.id as uid, u.name as uname ORDER BY u.name DESC, id ASC) dctrn_result'; $alteredSql = 'SELECT TOP 15 * FROM (SELECT u.id as uid, u.name as uname) dctrn_result'; $sql = $this->_platform->modifyLimitQuery($querySql, 10, 5); - $this->assertEquals(sprintf(self::$selectFromCtePattern, $alteredSql, 6, 15), $sql); + self::assertEquals(sprintf(self::$selectFromCtePattern, $alteredSql, 6, 15), $sql); $querySql = 'SELECT * FROM (SELECT u.id uid, u.name uname ORDER BY u.name DESC, id ASC) dctrn_result'; $alteredSql = 'SELECT TOP 15 * FROM (SELECT u.id uid, u.name uname) dctrn_result'; $sql = $this->_platform->modifyLimitQuery($querySql, 10, 5); - $this->assertEquals(sprintf(self::$selectFromCtePattern, $alteredSql, 6, 15), $sql); + self::assertEquals(sprintf(self::$selectFromCtePattern, $alteredSql, 6, 15), $sql); $querySql = 'SELECT * FROM (SELECT u.id, u.name ORDER BY u.name DESC, id ASC) dctrn_result'; $alteredSql = 'SELECT TOP 15 * FROM (SELECT u.id, u.name) dctrn_result'; $sql = $this->_platform->modifyLimitQuery($querySql, 10, 5); - $this->assertEquals(sprintf(self::$selectFromCtePattern, $alteredSql, 6, 15), $sql); + self::assertEquals(sprintf(self::$selectFromCtePattern, $alteredSql, 6, 15), $sql); } public function testModifyLimitQueryWithFromColumnNames() @@ -283,7 +283,7 @@ public function testModifyLimitQueryWithFromColumnNames() $querySql = 'SELECT a.fromFoo, fromBar FROM foo'; $alteredSql = 'SELECT TOP 10 a.fromFoo, fromBar FROM foo'; $sql = $this->_platform->modifyLimitQuery($querySql, 10); - $this->assertEquals(sprintf(self::$selectFromCtePattern, $alteredSql, 1, 10), $sql); + self::assertEquals(sprintf(self::$selectFromCtePattern, $alteredSql, 1, 10), $sql); } /** @@ -302,7 +302,7 @@ public function testModifyLimitQueryWithExtraLongQuery() $alteredSql.= 'AND (table5.column5 = table6.column6) AND (table5.column5 = table7.column7) AND (table5.column5 = table8.column8) AND (table6.column6 = table7.column7) AND (table6.column6 = table8.column8) AND (table7.column7 = table8.column8)'; $sql = $this->_platform->modifyLimitQuery($query, 10); - $this->assertEquals(sprintf(self::$selectFromCtePattern, $alteredSql, 1, 10), $sql); + self::assertEquals(sprintf(self::$selectFromCtePattern, $alteredSql, 1, 10), $sql); } /** @@ -318,7 +318,7 @@ public function testModifyLimitQueryWithOrderByClause() $alteredSql = 'SELECT TOP 15 m0_.NOMBRE AS NOMBRE0, m0_.FECHAINICIO AS FECHAINICIO1, m0_.FECHAFIN AS FECHAFIN2 FROM MEDICION m0_ WITH (NOLOCK) INNER JOIN ESTUDIO e1_ ON m0_.ESTUDIO_ID = e1_.ID INNER JOIN CLIENTE c2_ ON e1_.CLIENTE_ID = c2_.ID INNER JOIN USUARIO u3_ ON c2_.ID = u3_.CLIENTE_ID WHERE u3_.ID = ? ORDER BY m0_.FECHAINICIO DESC'; $actual = $this->_platform->modifyLimitQuery($sql, 10, 5); - $this->assertEquals(sprintf(self::$selectFromCtePattern, $alteredSql, 6, 15), $actual); + self::assertEquals(sprintf(self::$selectFromCtePattern, $alteredSql, 6, 15), $actual); } /** @@ -342,7 +342,7 @@ public function testModifyLimitQueryWithSubSelectInSelectList() "WHERE u.status = 'disabled'"; $sql = $this->_platform->modifyLimitQuery($querySql, 10); - $this->assertEquals(sprintf(self::$selectFromCtePattern, $alteredSql, 1, 10), $sql); + self::assertEquals(sprintf(self::$selectFromCtePattern, $alteredSql, 1, 10), $sql); } /** @@ -371,7 +371,7 @@ public function testModifyLimitQueryWithSubSelectInSelectListAndOrderByClause() "WHERE u.status = 'disabled' " . "ORDER BY u.username DESC"; $sql = $this->_platform->modifyLimitQuery($querySql, 10, 5); - $this->assertEquals(sprintf(self::$selectFromCtePattern, $alteredSql, 6, 15), $sql); + self::assertEquals(sprintf(self::$selectFromCtePattern, $alteredSql, 6, 15), $sql); } /** @@ -392,7 +392,7 @@ public function testModifyLimitQueryWithAggregateFunctionInOrderByClause() "GROUP BY code " . "ORDER BY MAX(heading_id) DESC"; $sql = $this->_platform->modifyLimitQuery($querySql, 1, 0); - $this->assertEquals(sprintf(self::$selectFromCtePattern, $alteredSql, 1, 1), $sql); + self::assertEquals(sprintf(self::$selectFromCtePattern, $alteredSql, 1, 1), $sql); } /** @@ -416,7 +416,7 @@ public function testModifyLimitSubqueryWithJoinAndSubqueryOrderedByColumnFromBas . ") dctrn_result " . "ORDER BY id_0 ASC"; $sql = $this->_platform->modifyLimitQuery($querySql, 5); - $this->assertEquals(sprintf(self::$selectFromCtePattern, $alteredSql, 1, 5), $sql); + self::assertEquals(sprintf(self::$selectFromCtePattern, $alteredSql, 1, 5), $sql); } @@ -441,7 +441,7 @@ public function testModifyLimitSubqueryWithJoinAndSubqueryOrderedByColumnFromJoi . ") dctrn_result " . "ORDER BY name_1 ASC"; $sql = $this->_platform->modifyLimitQuery($querySql, 5); - $this->assertEquals(sprintf(self::$selectFromCtePattern, $alteredSql, 1, 5), $sql); + self::assertEquals(sprintf(self::$selectFromCtePattern, $alteredSql, 1, 5), $sql); } /** @@ -465,7 +465,7 @@ public function testModifyLimitSubqueryWithJoinAndSubqueryOrderedByColumnsFromBo . ") dctrn_result " . "ORDER BY name_1 ASC, foo_2 DESC"; $sql = $this->_platform->modifyLimitQuery($querySql, 5); - $this->assertEquals(sprintf(self::$selectFromCtePattern, $alteredSql, 1, 5), $sql); + self::assertEquals(sprintf(self::$selectFromCtePattern, $alteredSql, 1, 5), $sql); } public function testModifyLimitSubquerySimple() @@ -476,7 +476,7 @@ public function testModifyLimitSubquerySimple() $alteredSql = "SELECT DISTINCT TOP 20 id_0 FROM (SELECT k0_.id AS id_0, k0_.field AS field_1 " . "FROM key_table k0_ WHERE (k0_.where_field IN (1))) dctrn_result"; $sql = $this->_platform->modifyLimitQuery($querySql, 20); - $this->assertEquals(sprintf(self::$selectFromCtePattern, $alteredSql, 1, 20), $sql); + self::assertEquals(sprintf(self::$selectFromCtePattern, $alteredSql, 1, 20), $sql); } /** @@ -484,9 +484,9 @@ public function testModifyLimitSubquerySimple() */ public function testQuoteIdentifier() { - $this->assertEquals('[fo][o]', $this->_platform->quoteIdentifier('fo]o')); - $this->assertEquals('[test]', $this->_platform->quoteIdentifier('test')); - $this->assertEquals('[test].[test]', $this->_platform->quoteIdentifier('test.test')); + self::assertEquals('[fo][o]', $this->_platform->quoteIdentifier('fo]o')); + self::assertEquals('[test]', $this->_platform->quoteIdentifier('test')); + self::assertEquals('[test].[test]', $this->_platform->quoteIdentifier('test.test')); } /** @@ -494,9 +494,9 @@ public function testQuoteIdentifier() */ public function testQuoteSingleIdentifier() { - $this->assertEquals('[fo][o]', $this->_platform->quoteSingleIdentifier('fo]o')); - $this->assertEquals('[test]', $this->_platform->quoteSingleIdentifier('test')); - $this->assertEquals('[test.test]', $this->_platform->quoteSingleIdentifier('test.test')); + self::assertEquals('[fo][o]', $this->_platform->quoteSingleIdentifier('fo]o')); + self::assertEquals('[test]', $this->_platform->quoteSingleIdentifier('test')); + self::assertEquals('[test.test]', $this->_platform->quoteSingleIdentifier('test.test')); } /** @@ -506,7 +506,7 @@ public function testCreateClusteredIndex() { $idx = new \Doctrine\DBAL\Schema\Index('idx', array('id')); $idx->addFlag('clustered'); - $this->assertEquals('CREATE CLUSTERED INDEX idx ON tbl (id)', $this->_platform->getCreateIndexSQL($idx, 'tbl')); + self::assertEquals('CREATE CLUSTERED INDEX idx ON tbl (id)', $this->_platform->getCreateIndexSQL($idx, 'tbl')); } /** @@ -519,7 +519,7 @@ public function testCreateNonClusteredPrimaryKeyInTable() $table->setPrimaryKey(Array("id")); $table->getIndex('primary')->addFlag('nonclustered'); - $this->assertEquals(array('CREATE TABLE tbl (id INT NOT NULL, PRIMARY KEY NONCLUSTERED (id))'), $this->_platform->getCreateTableSQL($table)); + self::assertEquals(array('CREATE TABLE tbl (id INT NOT NULL, PRIMARY KEY NONCLUSTERED (id))'), $this->_platform->getCreateTableSQL($table)); } /** @@ -529,13 +529,13 @@ public function testCreateNonClusteredPrimaryKey() { $idx = new \Doctrine\DBAL\Schema\Index('idx', array('id'), false, true); $idx->addFlag('nonclustered'); - $this->assertEquals('ALTER TABLE tbl ADD PRIMARY KEY NONCLUSTERED (id)', $this->_platform->getCreatePrimaryKeySQL($idx, 'tbl')); + self::assertEquals('ALTER TABLE tbl ADD PRIMARY KEY NONCLUSTERED (id)', $this->_platform->getCreatePrimaryKeySQL($idx, 'tbl')); } public function testAlterAddPrimaryKey() { $idx = new \Doctrine\DBAL\Schema\Index('idx', array('id'), false, true); - $this->assertEquals('ALTER TABLE tbl ADD PRIMARY KEY (id)', $this->_platform->getCreateIndexSQL($idx, 'tbl')); + self::assertEquals('ALTER TABLE tbl ADD PRIMARY KEY (id)', $this->_platform->getCreateIndexSQL($idx, 'tbl')); } protected function getQuotedColumnInPrimaryKeySQL() @@ -575,7 +575,7 @@ public function testGetCreateSchemaSQL() { $schemaName = 'schema'; $sql = $this->_platform->getCreateSchemaSQL($schemaName); - $this->assertEquals('CREATE SCHEMA ' . $schemaName, $sql); + self::assertEquals('CREATE SCHEMA ' . $schemaName, $sql); } /** @@ -634,7 +634,7 @@ public function testGeneratesCreateTableSQLWithColumnComments() $table->addColumn('comment_with_string_literal_char', 'string', array('comment' => "O'Reilly")); $table->setPrimaryKey(array('id')); - $this->assertEquals( + self::assertEquals( array( "CREATE TABLE mytable (id INT IDENTITY NOT NULL, comment_null INT NOT NULL, comment_false INT NOT NULL, comment_empty_string INT NOT NULL, comment_integer_0 INT NOT NULL, comment_float_0 INT NOT NULL, comment_string_0 INT NOT NULL, comment INT NOT NULL, [comment_quoted] INT NOT NULL, [create] INT NOT NULL, commented_type VARCHAR(MAX) NOT NULL, commented_type_with_comment VARCHAR(MAX) NOT NULL, comment_with_string_literal_char NVARCHAR(255) NOT NULL, PRIMARY KEY (id))", "EXEC sp_addextendedproperty N'MS_Description', N'0', N'SCHEMA', dbo, N'TABLE', mytable, N'COLUMN', comment_integer_0", @@ -781,7 +781,7 @@ public function testGeneratesAlterTableSQLWithColumnComments() $tableDiff->removedColumns['comment_integer_0'] = new Column('comment_integer_0', Type::getType('integer'), array('comment' => 0)); - $this->assertEquals( + self::assertEquals( array( // Renamed columns. "sp_RENAME 'mytable.comment_float_0', 'comment_double_0', 'COLUMN'", @@ -839,80 +839,80 @@ public function testGeneratesAlterTableSQLWithColumnComments() */ public function testInitializesDoctrineTypeMappings() { - $this->assertTrue($this->_platform->hasDoctrineTypeMappingFor('bigint')); - $this->assertSame('bigint', $this->_platform->getDoctrineTypeMapping('bigint')); + self::assertTrue($this->_platform->hasDoctrineTypeMappingFor('bigint')); + self::assertSame('bigint', $this->_platform->getDoctrineTypeMapping('bigint')); - $this->assertTrue($this->_platform->hasDoctrineTypeMappingFor('numeric')); - $this->assertSame('decimal', $this->_platform->getDoctrineTypeMapping('numeric')); + self::assertTrue($this->_platform->hasDoctrineTypeMappingFor('numeric')); + self::assertSame('decimal', $this->_platform->getDoctrineTypeMapping('numeric')); - $this->assertTrue($this->_platform->hasDoctrineTypeMappingFor('bit')); - $this->assertSame('boolean', $this->_platform->getDoctrineTypeMapping('bit')); + self::assertTrue($this->_platform->hasDoctrineTypeMappingFor('bit')); + self::assertSame('boolean', $this->_platform->getDoctrineTypeMapping('bit')); - $this->assertTrue($this->_platform->hasDoctrineTypeMappingFor('smallint')); - $this->assertSame('smallint', $this->_platform->getDoctrineTypeMapping('smallint')); + self::assertTrue($this->_platform->hasDoctrineTypeMappingFor('smallint')); + self::assertSame('smallint', $this->_platform->getDoctrineTypeMapping('smallint')); - $this->assertTrue($this->_platform->hasDoctrineTypeMappingFor('decimal')); - $this->assertSame('decimal', $this->_platform->getDoctrineTypeMapping('decimal')); + self::assertTrue($this->_platform->hasDoctrineTypeMappingFor('decimal')); + self::assertSame('decimal', $this->_platform->getDoctrineTypeMapping('decimal')); - $this->assertTrue($this->_platform->hasDoctrineTypeMappingFor('smallmoney')); - $this->assertSame('integer', $this->_platform->getDoctrineTypeMapping('smallmoney')); + self::assertTrue($this->_platform->hasDoctrineTypeMappingFor('smallmoney')); + self::assertSame('integer', $this->_platform->getDoctrineTypeMapping('smallmoney')); - $this->assertTrue($this->_platform->hasDoctrineTypeMappingFor('int')); - $this->assertSame('integer', $this->_platform->getDoctrineTypeMapping('int')); + self::assertTrue($this->_platform->hasDoctrineTypeMappingFor('int')); + self::assertSame('integer', $this->_platform->getDoctrineTypeMapping('int')); - $this->assertTrue($this->_platform->hasDoctrineTypeMappingFor('tinyint')); - $this->assertSame('smallint', $this->_platform->getDoctrineTypeMapping('tinyint')); + self::assertTrue($this->_platform->hasDoctrineTypeMappingFor('tinyint')); + self::assertSame('smallint', $this->_platform->getDoctrineTypeMapping('tinyint')); - $this->assertTrue($this->_platform->hasDoctrineTypeMappingFor('money')); - $this->assertSame('integer', $this->_platform->getDoctrineTypeMapping('money')); + self::assertTrue($this->_platform->hasDoctrineTypeMappingFor('money')); + self::assertSame('integer', $this->_platform->getDoctrineTypeMapping('money')); - $this->assertTrue($this->_platform->hasDoctrineTypeMappingFor('float')); - $this->assertSame('float', $this->_platform->getDoctrineTypeMapping('float')); + self::assertTrue($this->_platform->hasDoctrineTypeMappingFor('float')); + self::assertSame('float', $this->_platform->getDoctrineTypeMapping('float')); - $this->assertTrue($this->_platform->hasDoctrineTypeMappingFor('real')); - $this->assertSame('float', $this->_platform->getDoctrineTypeMapping('real')); + self::assertTrue($this->_platform->hasDoctrineTypeMappingFor('real')); + self::assertSame('float', $this->_platform->getDoctrineTypeMapping('real')); - $this->assertTrue($this->_platform->hasDoctrineTypeMappingFor('double')); - $this->assertSame('float', $this->_platform->getDoctrineTypeMapping('double')); + self::assertTrue($this->_platform->hasDoctrineTypeMappingFor('double')); + self::assertSame('float', $this->_platform->getDoctrineTypeMapping('double')); - $this->assertTrue($this->_platform->hasDoctrineTypeMappingFor('double precision')); - $this->assertSame('float', $this->_platform->getDoctrineTypeMapping('double precision')); + self::assertTrue($this->_platform->hasDoctrineTypeMappingFor('double precision')); + self::assertSame('float', $this->_platform->getDoctrineTypeMapping('double precision')); - $this->assertTrue($this->_platform->hasDoctrineTypeMappingFor('smalldatetime')); - $this->assertSame('datetime', $this->_platform->getDoctrineTypeMapping('smalldatetime')); + self::assertTrue($this->_platform->hasDoctrineTypeMappingFor('smalldatetime')); + self::assertSame('datetime', $this->_platform->getDoctrineTypeMapping('smalldatetime')); - $this->assertTrue($this->_platform->hasDoctrineTypeMappingFor('datetime')); - $this->assertSame('datetime', $this->_platform->getDoctrineTypeMapping('datetime')); + self::assertTrue($this->_platform->hasDoctrineTypeMappingFor('datetime')); + self::assertSame('datetime', $this->_platform->getDoctrineTypeMapping('datetime')); - $this->assertTrue($this->_platform->hasDoctrineTypeMappingFor('char')); - $this->assertSame('string', $this->_platform->getDoctrineTypeMapping('char')); + self::assertTrue($this->_platform->hasDoctrineTypeMappingFor('char')); + self::assertSame('string', $this->_platform->getDoctrineTypeMapping('char')); - $this->assertTrue($this->_platform->hasDoctrineTypeMappingFor('varchar')); - $this->assertSame('string', $this->_platform->getDoctrineTypeMapping('varchar')); + self::assertTrue($this->_platform->hasDoctrineTypeMappingFor('varchar')); + self::assertSame('string', $this->_platform->getDoctrineTypeMapping('varchar')); - $this->assertTrue($this->_platform->hasDoctrineTypeMappingFor('text')); - $this->assertSame('text', $this->_platform->getDoctrineTypeMapping('text')); + self::assertTrue($this->_platform->hasDoctrineTypeMappingFor('text')); + self::assertSame('text', $this->_platform->getDoctrineTypeMapping('text')); - $this->assertTrue($this->_platform->hasDoctrineTypeMappingFor('nchar')); - $this->assertSame('string', $this->_platform->getDoctrineTypeMapping('nchar')); + self::assertTrue($this->_platform->hasDoctrineTypeMappingFor('nchar')); + self::assertSame('string', $this->_platform->getDoctrineTypeMapping('nchar')); - $this->assertTrue($this->_platform->hasDoctrineTypeMappingFor('nvarchar')); - $this->assertSame('string', $this->_platform->getDoctrineTypeMapping('nvarchar')); + self::assertTrue($this->_platform->hasDoctrineTypeMappingFor('nvarchar')); + self::assertSame('string', $this->_platform->getDoctrineTypeMapping('nvarchar')); - $this->assertTrue($this->_platform->hasDoctrineTypeMappingFor('ntext')); - $this->assertSame('text', $this->_platform->getDoctrineTypeMapping('ntext')); + self::assertTrue($this->_platform->hasDoctrineTypeMappingFor('ntext')); + self::assertSame('text', $this->_platform->getDoctrineTypeMapping('ntext')); - $this->assertTrue($this->_platform->hasDoctrineTypeMappingFor('binary')); - $this->assertSame('binary', $this->_platform->getDoctrineTypeMapping('binary')); + self::assertTrue($this->_platform->hasDoctrineTypeMappingFor('binary')); + self::assertSame('binary', $this->_platform->getDoctrineTypeMapping('binary')); - $this->assertTrue($this->_platform->hasDoctrineTypeMappingFor('varbinary')); - $this->assertSame('binary', $this->_platform->getDoctrineTypeMapping('varbinary')); + self::assertTrue($this->_platform->hasDoctrineTypeMappingFor('varbinary')); + self::assertSame('binary', $this->_platform->getDoctrineTypeMapping('varbinary')); - $this->assertTrue($this->_platform->hasDoctrineTypeMappingFor('image')); - $this->assertSame('blob', $this->_platform->getDoctrineTypeMapping('image')); + self::assertTrue($this->_platform->hasDoctrineTypeMappingFor('image')); + self::assertSame('blob', $this->_platform->getDoctrineTypeMapping('image')); - $this->assertTrue($this->_platform->hasDoctrineTypeMappingFor('uniqueidentifier')); - $this->assertSame('guid', $this->_platform->getDoctrineTypeMapping('uniqueidentifier')); + self::assertTrue($this->_platform->hasDoctrineTypeMappingFor('uniqueidentifier')); + self::assertSame('guid', $this->_platform->getDoctrineTypeMapping('uniqueidentifier')); } protected function getBinaryMaxLength() @@ -922,15 +922,15 @@ protected function getBinaryMaxLength() public function testReturnsBinaryTypeDeclarationSQL() { - $this->assertSame('VARBINARY(255)', $this->_platform->getBinaryTypeDeclarationSQL(array())); - $this->assertSame('VARBINARY(255)', $this->_platform->getBinaryTypeDeclarationSQL(array('length' => 0))); - $this->assertSame('VARBINARY(8000)', $this->_platform->getBinaryTypeDeclarationSQL(array('length' => 8000))); - $this->assertSame('VARBINARY(MAX)', $this->_platform->getBinaryTypeDeclarationSQL(array('length' => 8001))); + self::assertSame('VARBINARY(255)', $this->_platform->getBinaryTypeDeclarationSQL(array())); + self::assertSame('VARBINARY(255)', $this->_platform->getBinaryTypeDeclarationSQL(array('length' => 0))); + self::assertSame('VARBINARY(8000)', $this->_platform->getBinaryTypeDeclarationSQL(array('length' => 8000))); + self::assertSame('VARBINARY(MAX)', $this->_platform->getBinaryTypeDeclarationSQL(array('length' => 8001))); - $this->assertSame('BINARY(255)', $this->_platform->getBinaryTypeDeclarationSQL(array('fixed' => true))); - $this->assertSame('BINARY(255)', $this->_platform->getBinaryTypeDeclarationSQL(array('fixed' => true, 'length' => 0))); - $this->assertSame('BINARY(8000)', $this->_platform->getBinaryTypeDeclarationSQL(array('fixed' => true, 'length' => 8000))); - $this->assertSame('VARBINARY(MAX)', $this->_platform->getBinaryTypeDeclarationSQL(array('fixed' => true, 'length' => 8001))); + self::assertSame('BINARY(255)', $this->_platform->getBinaryTypeDeclarationSQL(array('fixed' => true))); + self::assertSame('BINARY(255)', $this->_platform->getBinaryTypeDeclarationSQL(array('fixed' => true, 'length' => 0))); + self::assertSame('BINARY(8000)', $this->_platform->getBinaryTypeDeclarationSQL(array('fixed' => true, 'length' => 8000))); + self::assertSame('VARBINARY(MAX)', $this->_platform->getBinaryTypeDeclarationSQL(array('fixed' => true, 'length' => 8001))); } /** @@ -983,7 +983,7 @@ public function testChangeColumnsTypeWithDefaultValue() $expected = $this->_platform->getAlterTableSQL($tableDiff); - $this->assertSame( + self::assertSame( $expected, array( 'ALTER TABLE column_def_change_type DROP CONSTRAINT DF_829302E0_FA2CB292', @@ -1059,7 +1059,7 @@ protected function getQuotesDropConstraintSQL() */ public function testGeneratesIdentifierNamesInDefaultConstraintDeclarationSQL($table, $column, $expectedSql) { - $this->assertSame($expectedSql, $this->_platform->getDefaultConstraintDeclarationSQL($table, $column)); + self::assertSame($expectedSql, $this->_platform->getDefaultConstraintDeclarationSQL($table, $column)); } public function getGeneratesIdentifierNamesInDefaultConstraintDeclarationSQL() @@ -1082,7 +1082,7 @@ public function getGeneratesIdentifierNamesInDefaultConstraintDeclarationSQL() */ public function testGeneratesIdentifierNamesInCreateTableSQL($table, $expectedSql) { - $this->assertSame($expectedSql, $this->_platform->getCreateTableSQL($table)); + self::assertSame($expectedSql, $this->_platform->getCreateTableSQL($table)); } public function getGeneratesIdentifierNamesInCreateTableSQL() @@ -1129,7 +1129,7 @@ public function getGeneratesIdentifierNamesInCreateTableSQL() */ public function testGeneratesIdentifierNamesInAlterTableSQL($tableDiff, $expectedSql) { - $this->assertSame($expectedSql, $this->_platform->getAlterTableSQL($tableDiff)); + self::assertSame($expectedSql, $this->_platform->getAlterTableSQL($tableDiff)); } public function getGeneratesIdentifierNamesInAlterTableSQL() @@ -1239,7 +1239,7 @@ public function getGeneratesIdentifierNamesInAlterTableSQL() */ public function testReturnsGuidTypeDeclarationSQL() { - $this->assertSame('UNIQUEIDENTIFIER', $this->_platform->getGuidTypeDeclarationSQL(array())); + self::assertSame('UNIQUEIDENTIFIER', $this->_platform->getGuidTypeDeclarationSQL(array())); } /** @@ -1352,12 +1352,12 @@ public function testModifyLimitQueryWithTopNSubQueryWithOrderBy() $querySql = 'SELECT * FROM test t WHERE t.id = (SELECT TOP 1 t2.id FROM test t2 ORDER BY t2.data DESC)'; $alteredSql = 'SELECT TOP 10 * FROM test t WHERE t.id = (SELECT TOP 1 t2.id FROM test t2 ORDER BY t2.data DESC)'; $sql = $this->_platform->modifyLimitQuery($querySql, 10); - $this->assertEquals(sprintf(static::$selectFromCtePattern, $alteredSql, 1, 10), $sql); + self::assertEquals(sprintf(static::$selectFromCtePattern, $alteredSql, 1, 10), $sql); $querySql = 'SELECT * FROM test t WHERE t.id = (SELECT TOP 1 t2.id FROM test t2 ORDER BY t2.data DESC) ORDER BY t.data2 DESC'; $alteredSql = 'SELECT TOP 10 * FROM test t WHERE t.id = (SELECT TOP 1 t2.id FROM test t2 ORDER BY t2.data DESC) ORDER BY t.data2 DESC'; $sql = $this->_platform->modifyLimitQuery($querySql, 10); - $this->assertEquals(sprintf(static::$selectFromCtePattern, $alteredSql, 1, 10), $sql); + self::assertEquals(sprintf(static::$selectFromCtePattern, $alteredSql, 1, 10), $sql); } /** @@ -1365,7 +1365,7 @@ public function testModifyLimitQueryWithTopNSubQueryWithOrderBy() */ public function testQuotesTableNameInListTableColumnsSQL() { - $this->assertContains("'Foo''Bar\\'", $this->_platform->getListTableColumnsSQL("Foo'Bar\\"), '', true); + self::assertContains("'Foo''Bar\\'", $this->_platform->getListTableColumnsSQL("Foo'Bar\\"), '', true); } /** @@ -1373,7 +1373,7 @@ public function testQuotesTableNameInListTableColumnsSQL() */ public function testQuotesSchemaNameInListTableColumnsSQL() { - $this->assertContains( + self::assertContains( "'Foo''Bar\\'", $this->_platform->getListTableColumnsSQL("Foo'Bar\\.baz_table"), '', @@ -1386,7 +1386,7 @@ public function testQuotesSchemaNameInListTableColumnsSQL() */ public function testQuotesTableNameInListTableForeignKeysSQL() { - $this->assertContains("'Foo''Bar\\'", $this->_platform->getListTableForeignKeysSQL("Foo'Bar\\"), '', true); + self::assertContains("'Foo''Bar\\'", $this->_platform->getListTableForeignKeysSQL("Foo'Bar\\"), '', true); } /** @@ -1394,7 +1394,7 @@ public function testQuotesTableNameInListTableForeignKeysSQL() */ public function testQuotesSchemaNameInListTableForeignKeysSQL() { - $this->assertContains( + self::assertContains( "'Foo''Bar\\'", $this->_platform->getListTableForeignKeysSQL("Foo'Bar\\.baz_table"), '', @@ -1407,7 +1407,7 @@ public function testQuotesSchemaNameInListTableForeignKeysSQL() */ public function testQuotesTableNameInListTableIndexesSQL() { - $this->assertContains("'Foo''Bar\\'", $this->_platform->getListTableIndexesSQL("Foo'Bar\\"), '', true); + self::assertContains("'Foo''Bar\\'", $this->_platform->getListTableIndexesSQL("Foo'Bar\\"), '', true); } /** @@ -1415,7 +1415,7 @@ public function testQuotesTableNameInListTableIndexesSQL() */ public function testQuotesSchemaNameInListTableIndexesSQL() { - $this->assertContains( + self::assertContains( "'Foo''Bar\\'", $this->_platform->getListTableIndexesSQL("Foo'Bar\\.baz_table"), '', diff --git a/tests/Doctrine/Tests/DBAL/Platforms/DB2PlatformTest.php b/tests/Doctrine/Tests/DBAL/Platforms/DB2PlatformTest.php index 9e5cd32232d..fc7795bda7b 100644 --- a/tests/Doctrine/Tests/DBAL/Platforms/DB2PlatformTest.php +++ b/tests/Doctrine/Tests/DBAL/Platforms/DB2PlatformTest.php @@ -141,7 +141,7 @@ public function getCreateTableColumnTypeCommentsSQL() public function testHasCorrectPlatformName() { - $this->assertEquals('db2', $this->_platform->getName()); + self::assertEquals('db2', $this->_platform->getName()); } public function testGeneratesCreateTableSQLWithCommonIndexes() @@ -153,7 +153,7 @@ public function testGeneratesCreateTableSQLWithCommonIndexes() $table->addIndex(array('name')); $table->addIndex(array('id', 'name'), 'composite_idx'); - $this->assertEquals( + self::assertEquals( array( 'CREATE TABLE test (id INTEGER NOT NULL, name VARCHAR(50) NOT NULL, PRIMARY KEY(id))', 'CREATE INDEX IDX_D87F7E0C5E237E06 ON test (name)', @@ -179,7 +179,7 @@ public function testGeneratesCreateTableSQLWithForeignKeyConstraints() 'named_fk' ); - $this->assertEquals( + self::assertEquals( array( 'CREATE TABLE test (id INTEGER NOT NULL, fk_1 INTEGER NOT NULL, fk_2 INTEGER NOT NULL)', 'ALTER TABLE test ADD CONSTRAINT FK_D87F7E0C177612A38E7F4319 FOREIGN KEY (fk_1, fk_2) REFERENCES foreign_table (pk_1, pk_2)', @@ -197,7 +197,7 @@ public function testGeneratesCreateTableSQLWithCheckConstraints() $table->addColumn('check_min', 'integer', array('platformOptions' => array('min' => 10))); $table->setPrimaryKey(array('id')); - $this->assertEquals( + self::assertEquals( array( 'CREATE TABLE test (id INTEGER NOT NULL, check_max INTEGER NOT NULL, check_min INTEGER NOT NULL, PRIMARY KEY(id), CHECK (check_max <= 10), CHECK (check_min >= 10))' ), @@ -214,77 +214,77 @@ public function testGeneratesColumnTypesDeclarationSQL() 'autoincrement' => true ); - $this->assertEquals('VARCHAR(255)', $this->_platform->getVarcharTypeDeclarationSQL(array())); - $this->assertEquals('VARCHAR(10)', $this->_platform->getVarcharTypeDeclarationSQL(array('length' => 10))); - $this->assertEquals('CHAR(255)', $this->_platform->getVarcharTypeDeclarationSQL(array('fixed' => true))); - $this->assertEquals('CHAR(10)', $this->_platform->getVarcharTypeDeclarationSQL($fullColumnDef)); + self::assertEquals('VARCHAR(255)', $this->_platform->getVarcharTypeDeclarationSQL(array())); + self::assertEquals('VARCHAR(10)', $this->_platform->getVarcharTypeDeclarationSQL(array('length' => 10))); + self::assertEquals('CHAR(255)', $this->_platform->getVarcharTypeDeclarationSQL(array('fixed' => true))); + self::assertEquals('CHAR(10)', $this->_platform->getVarcharTypeDeclarationSQL($fullColumnDef)); - $this->assertEquals('SMALLINT', $this->_platform->getSmallIntTypeDeclarationSQL(array())); - $this->assertEquals('SMALLINT', $this->_platform->getSmallIntTypeDeclarationSQL(array( + self::assertEquals('SMALLINT', $this->_platform->getSmallIntTypeDeclarationSQL(array())); + self::assertEquals('SMALLINT', $this->_platform->getSmallIntTypeDeclarationSQL(array( 'unsigned' => true ))); - $this->assertEquals('SMALLINT GENERATED BY DEFAULT AS IDENTITY', $this->_platform->getSmallIntTypeDeclarationSQL($fullColumnDef)); - $this->assertEquals('INTEGER', $this->_platform->getIntegerTypeDeclarationSQL(array())); - $this->assertEquals('INTEGER', $this->_platform->getIntegerTypeDeclarationSQL(array( + self::assertEquals('SMALLINT GENERATED BY DEFAULT AS IDENTITY', $this->_platform->getSmallIntTypeDeclarationSQL($fullColumnDef)); + self::assertEquals('INTEGER', $this->_platform->getIntegerTypeDeclarationSQL(array())); + self::assertEquals('INTEGER', $this->_platform->getIntegerTypeDeclarationSQL(array( 'unsigned' => true ))); - $this->assertEquals('INTEGER GENERATED BY DEFAULT AS IDENTITY', $this->_platform->getIntegerTypeDeclarationSQL($fullColumnDef)); - $this->assertEquals('BIGINT', $this->_platform->getBigIntTypeDeclarationSQL(array())); - $this->assertEquals('BIGINT', $this->_platform->getBigIntTypeDeclarationSQL(array( + self::assertEquals('INTEGER GENERATED BY DEFAULT AS IDENTITY', $this->_platform->getIntegerTypeDeclarationSQL($fullColumnDef)); + self::assertEquals('BIGINT', $this->_platform->getBigIntTypeDeclarationSQL(array())); + self::assertEquals('BIGINT', $this->_platform->getBigIntTypeDeclarationSQL(array( 'unsigned' => true ))); - $this->assertEquals('BIGINT GENERATED BY DEFAULT AS IDENTITY', $this->_platform->getBigIntTypeDeclarationSQL($fullColumnDef)); - $this->assertEquals('BLOB(1M)', $this->_platform->getBlobTypeDeclarationSQL($fullColumnDef)); - $this->assertEquals('SMALLINT', $this->_platform->getBooleanTypeDeclarationSQL($fullColumnDef)); - $this->assertEquals('CLOB(1M)', $this->_platform->getClobTypeDeclarationSQL($fullColumnDef)); - $this->assertEquals('DATE', $this->_platform->getDateTypeDeclarationSQL($fullColumnDef)); - $this->assertEquals('TIMESTAMP(0) WITH DEFAULT', $this->_platform->getDateTimeTypeDeclarationSQL(array('version' => true))); - $this->assertEquals('TIMESTAMP(0)', $this->_platform->getDateTimeTypeDeclarationSQL($fullColumnDef)); - $this->assertEquals('TIME', $this->_platform->getTimeTypeDeclarationSQL($fullColumnDef)); + self::assertEquals('BIGINT GENERATED BY DEFAULT AS IDENTITY', $this->_platform->getBigIntTypeDeclarationSQL($fullColumnDef)); + self::assertEquals('BLOB(1M)', $this->_platform->getBlobTypeDeclarationSQL($fullColumnDef)); + self::assertEquals('SMALLINT', $this->_platform->getBooleanTypeDeclarationSQL($fullColumnDef)); + self::assertEquals('CLOB(1M)', $this->_platform->getClobTypeDeclarationSQL($fullColumnDef)); + self::assertEquals('DATE', $this->_platform->getDateTypeDeclarationSQL($fullColumnDef)); + self::assertEquals('TIMESTAMP(0) WITH DEFAULT', $this->_platform->getDateTimeTypeDeclarationSQL(array('version' => true))); + self::assertEquals('TIMESTAMP(0)', $this->_platform->getDateTimeTypeDeclarationSQL($fullColumnDef)); + self::assertEquals('TIME', $this->_platform->getTimeTypeDeclarationSQL($fullColumnDef)); } public function testInitializesDoctrineTypeMappings() { $this->_platform->initializeDoctrineTypeMappings(); - $this->assertTrue($this->_platform->hasDoctrineTypeMappingFor('smallint')); - $this->assertSame('smallint', $this->_platform->getDoctrineTypeMapping('smallint')); + self::assertTrue($this->_platform->hasDoctrineTypeMappingFor('smallint')); + self::assertSame('smallint', $this->_platform->getDoctrineTypeMapping('smallint')); - $this->assertTrue($this->_platform->hasDoctrineTypeMappingFor('bigint')); - $this->assertSame('bigint', $this->_platform->getDoctrineTypeMapping('bigint')); + self::assertTrue($this->_platform->hasDoctrineTypeMappingFor('bigint')); + self::assertSame('bigint', $this->_platform->getDoctrineTypeMapping('bigint')); - $this->assertTrue($this->_platform->hasDoctrineTypeMappingFor('integer')); - $this->assertSame('integer', $this->_platform->getDoctrineTypeMapping('integer')); + self::assertTrue($this->_platform->hasDoctrineTypeMappingFor('integer')); + self::assertSame('integer', $this->_platform->getDoctrineTypeMapping('integer')); - $this->assertTrue($this->_platform->hasDoctrineTypeMappingFor('time')); - $this->assertSame('time', $this->_platform->getDoctrineTypeMapping('time')); + self::assertTrue($this->_platform->hasDoctrineTypeMappingFor('time')); + self::assertSame('time', $this->_platform->getDoctrineTypeMapping('time')); - $this->assertTrue($this->_platform->hasDoctrineTypeMappingFor('date')); - $this->assertSame('date', $this->_platform->getDoctrineTypeMapping('date')); + self::assertTrue($this->_platform->hasDoctrineTypeMappingFor('date')); + self::assertSame('date', $this->_platform->getDoctrineTypeMapping('date')); - $this->assertTrue($this->_platform->hasDoctrineTypeMappingFor('varchar')); - $this->assertSame('string', $this->_platform->getDoctrineTypeMapping('varchar')); + self::assertTrue($this->_platform->hasDoctrineTypeMappingFor('varchar')); + self::assertSame('string', $this->_platform->getDoctrineTypeMapping('varchar')); - $this->assertTrue($this->_platform->hasDoctrineTypeMappingFor('character')); - $this->assertSame('string', $this->_platform->getDoctrineTypeMapping('character')); + self::assertTrue($this->_platform->hasDoctrineTypeMappingFor('character')); + self::assertSame('string', $this->_platform->getDoctrineTypeMapping('character')); - $this->assertTrue($this->_platform->hasDoctrineTypeMappingFor('clob')); - $this->assertSame('text', $this->_platform->getDoctrineTypeMapping('clob')); + self::assertTrue($this->_platform->hasDoctrineTypeMappingFor('clob')); + self::assertSame('text', $this->_platform->getDoctrineTypeMapping('clob')); - $this->assertTrue($this->_platform->hasDoctrineTypeMappingFor('blob')); - $this->assertSame('blob', $this->_platform->getDoctrineTypeMapping('blob')); + self::assertTrue($this->_platform->hasDoctrineTypeMappingFor('blob')); + self::assertSame('blob', $this->_platform->getDoctrineTypeMapping('blob')); - $this->assertTrue($this->_platform->hasDoctrineTypeMappingFor('decimal')); - $this->assertSame('decimal', $this->_platform->getDoctrineTypeMapping('decimal')); + self::assertTrue($this->_platform->hasDoctrineTypeMappingFor('decimal')); + self::assertSame('decimal', $this->_platform->getDoctrineTypeMapping('decimal')); - $this->assertTrue($this->_platform->hasDoctrineTypeMappingFor('double')); - $this->assertSame('float', $this->_platform->getDoctrineTypeMapping('double')); + self::assertTrue($this->_platform->hasDoctrineTypeMappingFor('double')); + self::assertSame('float', $this->_platform->getDoctrineTypeMapping('double')); - $this->assertTrue($this->_platform->hasDoctrineTypeMappingFor('real')); - $this->assertSame('float', $this->_platform->getDoctrineTypeMapping('real')); + self::assertTrue($this->_platform->hasDoctrineTypeMappingFor('real')); + self::assertSame('float', $this->_platform->getDoctrineTypeMapping('real')); - $this->assertTrue($this->_platform->hasDoctrineTypeMappingFor('timestamp')); - $this->assertSame('datetime', $this->_platform->getDoctrineTypeMapping('timestamp')); + self::assertTrue($this->_platform->hasDoctrineTypeMappingFor('timestamp')); + self::assertSame('datetime', $this->_platform->getDoctrineTypeMapping('timestamp')); } public function getIsCommentedDoctrineType() @@ -298,20 +298,20 @@ public function getIsCommentedDoctrineType() public function testGeneratesDDLSnippets() { - $this->assertEquals("CREATE DATABASE foobar", $this->_platform->getCreateDatabaseSQL('foobar')); - $this->assertEquals("DROP DATABASE foobar", $this->_platform->getDropDatabaseSQL('foobar')); - $this->assertEquals('DECLARE GLOBAL TEMPORARY TABLE', $this->_platform->getCreateTemporaryTableSnippetSQL()); - $this->assertEquals('TRUNCATE foobar IMMEDIATE', $this->_platform->getTruncateTableSQL('foobar')); - $this->assertEquals('TRUNCATE foobar IMMEDIATE', $this->_platform->getTruncateTableSQL('foobar'), true); + self::assertEquals("CREATE DATABASE foobar", $this->_platform->getCreateDatabaseSQL('foobar')); + self::assertEquals("DROP DATABASE foobar", $this->_platform->getDropDatabaseSQL('foobar')); + self::assertEquals('DECLARE GLOBAL TEMPORARY TABLE', $this->_platform->getCreateTemporaryTableSnippetSQL()); + self::assertEquals('TRUNCATE foobar IMMEDIATE', $this->_platform->getTruncateTableSQL('foobar')); + self::assertEquals('TRUNCATE foobar IMMEDIATE', $this->_platform->getTruncateTableSQL('foobar'), true); $viewSql = 'SELECT * FROM footable'; - $this->assertEquals('CREATE VIEW fooview AS ' . $viewSql, $this->_platform->getCreateViewSQL('fooview', $viewSql)); - $this->assertEquals('DROP VIEW fooview', $this->_platform->getDropViewSQL('fooview')); + self::assertEquals('CREATE VIEW fooview AS ' . $viewSql, $this->_platform->getCreateViewSQL('fooview', $viewSql)); + self::assertEquals('DROP VIEW fooview', $this->_platform->getDropViewSQL('fooview')); } public function testGeneratesCreateUnnamedPrimaryKeySQL() { - $this->assertEquals( + self::assertEquals( 'ALTER TABLE foo ADD PRIMARY KEY (a, b)', $this->_platform->getCreatePrimaryKeySQL( new Index('any_pk_name', array('a', 'b'), true, true), @@ -322,56 +322,56 @@ public function testGeneratesCreateUnnamedPrimaryKeySQL() public function testGeneratesSQLSnippets() { - $this->assertEquals('CURRENT DATE', $this->_platform->getCurrentDateSQL()); - $this->assertEquals('CURRENT TIME', $this->_platform->getCurrentTimeSQL()); - $this->assertEquals('CURRENT TIMESTAMP', $this->_platform->getCurrentTimestampSQL()); - $this->assertEquals("'1987/05/02' + 4 DAY", $this->_platform->getDateAddDaysExpression("'1987/05/02'", 4)); - $this->assertEquals("'1987/05/02' + 12 HOUR", $this->_platform->getDateAddHourExpression("'1987/05/02'", 12)); - $this->assertEquals("'1987/05/02' + 2 MINUTE", $this->_platform->getDateAddMinutesExpression("'1987/05/02'", 2)); - $this->assertEquals("'1987/05/02' + 102 MONTH", $this->_platform->getDateAddMonthExpression("'1987/05/02'", 102)); - $this->assertEquals("'1987/05/02' + 15 MONTH", $this->_platform->getDateAddQuartersExpression("'1987/05/02'", 5)); - $this->assertEquals("'1987/05/02' + 1 SECOND", $this->_platform->getDateAddSecondsExpression("'1987/05/02'", 1)); - $this->assertEquals("'1987/05/02' + 21 DAY", $this->_platform->getDateAddWeeksExpression("'1987/05/02'", 3)); - $this->assertEquals("'1987/05/02' + 10 YEAR", $this->_platform->getDateAddYearsExpression("'1987/05/02'", 10)); - $this->assertEquals("DAYS('1987/05/02') - DAYS('1987/04/01')", $this->_platform->getDateDiffExpression("'1987/05/02'", "'1987/04/01'")); - $this->assertEquals("'1987/05/02' - 4 DAY", $this->_platform->getDateSubDaysExpression("'1987/05/02'", 4)); - $this->assertEquals("'1987/05/02' - 12 HOUR", $this->_platform->getDateSubHourExpression("'1987/05/02'", 12)); - $this->assertEquals("'1987/05/02' - 2 MINUTE", $this->_platform->getDateSubMinutesExpression("'1987/05/02'", 2)); - $this->assertEquals("'1987/05/02' - 102 MONTH", $this->_platform->getDateSubMonthExpression("'1987/05/02'", 102)); - $this->assertEquals("'1987/05/02' - 15 MONTH", $this->_platform->getDateSubQuartersExpression("'1987/05/02'", 5)); - $this->assertEquals("'1987/05/02' - 1 SECOND", $this->_platform->getDateSubSecondsExpression("'1987/05/02'", 1)); - $this->assertEquals("'1987/05/02' - 21 DAY", $this->_platform->getDateSubWeeksExpression("'1987/05/02'", 3)); - $this->assertEquals("'1987/05/02' - 10 YEAR", $this->_platform->getDateSubYearsExpression("'1987/05/02'", 10)); - $this->assertEquals(' WITH RR USE AND KEEP UPDATE LOCKS', $this->_platform->getForUpdateSQL()); - $this->assertEquals('LOCATE(substring_column, string_column)', $this->_platform->getLocateExpression('string_column', 'substring_column')); - $this->assertEquals('LOCATE(substring_column, string_column)', $this->_platform->getLocateExpression('string_column', 'substring_column')); - $this->assertEquals('LOCATE(substring_column, string_column, 1)', $this->_platform->getLocateExpression('string_column', 'substring_column', 1)); - $this->assertEquals('SUBSTR(column, 5)', $this->_platform->getSubstringExpression('column', 5)); - $this->assertEquals('SUBSTR(column, 5, 2)', $this->_platform->getSubstringExpression('column', 5, 2)); + self::assertEquals('CURRENT DATE', $this->_platform->getCurrentDateSQL()); + self::assertEquals('CURRENT TIME', $this->_platform->getCurrentTimeSQL()); + self::assertEquals('CURRENT TIMESTAMP', $this->_platform->getCurrentTimestampSQL()); + self::assertEquals("'1987/05/02' + 4 DAY", $this->_platform->getDateAddDaysExpression("'1987/05/02'", 4)); + self::assertEquals("'1987/05/02' + 12 HOUR", $this->_platform->getDateAddHourExpression("'1987/05/02'", 12)); + self::assertEquals("'1987/05/02' + 2 MINUTE", $this->_platform->getDateAddMinutesExpression("'1987/05/02'", 2)); + self::assertEquals("'1987/05/02' + 102 MONTH", $this->_platform->getDateAddMonthExpression("'1987/05/02'", 102)); + self::assertEquals("'1987/05/02' + 15 MONTH", $this->_platform->getDateAddQuartersExpression("'1987/05/02'", 5)); + self::assertEquals("'1987/05/02' + 1 SECOND", $this->_platform->getDateAddSecondsExpression("'1987/05/02'", 1)); + self::assertEquals("'1987/05/02' + 21 DAY", $this->_platform->getDateAddWeeksExpression("'1987/05/02'", 3)); + self::assertEquals("'1987/05/02' + 10 YEAR", $this->_platform->getDateAddYearsExpression("'1987/05/02'", 10)); + self::assertEquals("DAYS('1987/05/02') - DAYS('1987/04/01')", $this->_platform->getDateDiffExpression("'1987/05/02'", "'1987/04/01'")); + self::assertEquals("'1987/05/02' - 4 DAY", $this->_platform->getDateSubDaysExpression("'1987/05/02'", 4)); + self::assertEquals("'1987/05/02' - 12 HOUR", $this->_platform->getDateSubHourExpression("'1987/05/02'", 12)); + self::assertEquals("'1987/05/02' - 2 MINUTE", $this->_platform->getDateSubMinutesExpression("'1987/05/02'", 2)); + self::assertEquals("'1987/05/02' - 102 MONTH", $this->_platform->getDateSubMonthExpression("'1987/05/02'", 102)); + self::assertEquals("'1987/05/02' - 15 MONTH", $this->_platform->getDateSubQuartersExpression("'1987/05/02'", 5)); + self::assertEquals("'1987/05/02' - 1 SECOND", $this->_platform->getDateSubSecondsExpression("'1987/05/02'", 1)); + self::assertEquals("'1987/05/02' - 21 DAY", $this->_platform->getDateSubWeeksExpression("'1987/05/02'", 3)); + self::assertEquals("'1987/05/02' - 10 YEAR", $this->_platform->getDateSubYearsExpression("'1987/05/02'", 10)); + self::assertEquals(' WITH RR USE AND KEEP UPDATE LOCKS', $this->_platform->getForUpdateSQL()); + self::assertEquals('LOCATE(substring_column, string_column)', $this->_platform->getLocateExpression('string_column', 'substring_column')); + self::assertEquals('LOCATE(substring_column, string_column)', $this->_platform->getLocateExpression('string_column', 'substring_column')); + self::assertEquals('LOCATE(substring_column, string_column, 1)', $this->_platform->getLocateExpression('string_column', 'substring_column', 1)); + self::assertEquals('SUBSTR(column, 5)', $this->_platform->getSubstringExpression('column', 5)); + self::assertEquals('SUBSTR(column, 5, 2)', $this->_platform->getSubstringExpression('column', 5, 2)); } public function testModifiesLimitQuery() { - $this->assertEquals( + self::assertEquals( 'SELECT * FROM user', $this->_platform->modifyLimitQuery('SELECT * FROM user', null, null) ); - $this->assertEquals( + self::assertEquals( 'SELECT db22.* FROM (SELECT db21.*, ROW_NUMBER() OVER() AS DC_ROWNUM FROM (SELECT * FROM user) db21) db22 WHERE db22.DC_ROWNUM <= 10', $this->_platform->modifyLimitQuery('SELECT * FROM user', 10, 0) ); - $this->assertEquals( + self::assertEquals( 'SELECT db22.* FROM (SELECT db21.*, ROW_NUMBER() OVER() AS DC_ROWNUM FROM (SELECT * FROM user) db21) db22 WHERE db22.DC_ROWNUM <= 10', $this->_platform->modifyLimitQuery('SELECT * FROM user', 10) ); - $this->assertEquals( + self::assertEquals( 'SELECT db22.* FROM (SELECT db21.*, ROW_NUMBER() OVER() AS DC_ROWNUM FROM (SELECT * FROM user) db21) db22 WHERE db22.DC_ROWNUM >= 6 AND db22.DC_ROWNUM <= 15', $this->_platform->modifyLimitQuery('SELECT * FROM user', 10, 5) ); - $this->assertEquals( + self::assertEquals( 'SELECT db22.* FROM (SELECT db21.*, ROW_NUMBER() OVER() AS DC_ROWNUM FROM (SELECT * FROM user) db21) db22 WHERE db22.DC_ROWNUM >= 6 AND db22.DC_ROWNUM <= 5', $this->_platform->modifyLimitQuery('SELECT * FROM user', 0, 5) ); @@ -379,32 +379,32 @@ public function testModifiesLimitQuery() public function testPrefersIdentityColumns() { - $this->assertTrue($this->_platform->prefersIdentityColumns()); + self::assertTrue($this->_platform->prefersIdentityColumns()); } public function testSupportsIdentityColumns() { - $this->assertTrue($this->_platform->supportsIdentityColumns()); + self::assertTrue($this->_platform->supportsIdentityColumns()); } public function testDoesNotSupportSavePoints() { - $this->assertFalse($this->_platform->supportsSavepoints()); + self::assertFalse($this->_platform->supportsSavepoints()); } public function testDoesNotSupportReleasePoints() { - $this->assertFalse($this->_platform->supportsReleaseSavepoints()); + self::assertFalse($this->_platform->supportsReleaseSavepoints()); } public function testDoesNotSupportCreateDropDatabase() { - $this->assertFalse($this->_platform->supportsCreateDropDatabase()); + self::assertFalse($this->_platform->supportsCreateDropDatabase()); } public function testReturnsSQLResultCasing() { - $this->assertSame('COL', $this->_platform->getSQLResultCasing('cOl')); + self::assertSame('COL', $this->_platform->getSQLResultCasing('cOl')); } protected function getBinaryDefaultLength() @@ -419,15 +419,15 @@ protected function getBinaryMaxLength() public function testReturnsBinaryTypeDeclarationSQL() { - $this->assertSame('VARBINARY(1)', $this->_platform->getBinaryTypeDeclarationSQL(array())); - $this->assertSame('VARBINARY(255)', $this->_platform->getBinaryTypeDeclarationSQL(array('length' => 0))); - $this->assertSame('VARBINARY(32704)', $this->_platform->getBinaryTypeDeclarationSQL(array('length' => 32704))); - $this->assertSame('BLOB(1M)', $this->_platform->getBinaryTypeDeclarationSQL(array('length' => 32705))); + self::assertSame('VARBINARY(1)', $this->_platform->getBinaryTypeDeclarationSQL(array())); + self::assertSame('VARBINARY(255)', $this->_platform->getBinaryTypeDeclarationSQL(array('length' => 0))); + self::assertSame('VARBINARY(32704)', $this->_platform->getBinaryTypeDeclarationSQL(array('length' => 32704))); + self::assertSame('BLOB(1M)', $this->_platform->getBinaryTypeDeclarationSQL(array('length' => 32705))); - $this->assertSame('BINARY(1)', $this->_platform->getBinaryTypeDeclarationSQL(array('fixed' => true))); - $this->assertSame('BINARY(255)', $this->_platform->getBinaryTypeDeclarationSQL(array('fixed' => true, 'length' => 0))); - $this->assertSame('BINARY(32704)', $this->_platform->getBinaryTypeDeclarationSQL(array('fixed' => true, 'length' => 32704))); - $this->assertSame('BLOB(1M)', $this->_platform->getBinaryTypeDeclarationSQL(array('fixed' => true, 'length' => 32705))); + self::assertSame('BINARY(1)', $this->_platform->getBinaryTypeDeclarationSQL(array('fixed' => true))); + self::assertSame('BINARY(255)', $this->_platform->getBinaryTypeDeclarationSQL(array('fixed' => true, 'length' => 0))); + self::assertSame('BINARY(32704)', $this->_platform->getBinaryTypeDeclarationSQL(array('fixed' => true, 'length' => 32704))); + self::assertSame('BLOB(1M)', $this->_platform->getBinaryTypeDeclarationSQL(array('fixed' => true, 'length' => 32705))); } /** @@ -504,7 +504,7 @@ protected function getQuotedAlterTableRenameIndexInSchemaSQL() */ public function testReturnsGuidTypeDeclarationSQL() { - $this->assertSame('CHAR(36)', $this->_platform->getGuidTypeDeclarationSQL(array())); + self::assertSame('CHAR(36)', $this->_platform->getGuidTypeDeclarationSQL(array())); } /** @@ -568,7 +568,7 @@ public function testGeneratesAlterColumnSQL($changedProperty, Column $column, $e $expectedSQL[] = "CALL SYSPROC.ADMIN_CMD ('REORG TABLE foo')"; - $this->assertSame($expectedSQL, $this->_platform->getAlterTableSQL($tableDiff)); + self::assertSame($expectedSQL, $this->_platform->getAlterTableSQL($tableDiff)); } /** @@ -701,7 +701,7 @@ protected function getGeneratesAlterTableRenameIndexUsedByForeignKeySQL() */ public function testQuotesTableNameInListTableColumnsSQL() { - $this->assertContains("'Foo''Bar\\'", $this->_platform->getListTableColumnsSQL("Foo'Bar\\"), '', true); + self::assertContains("'Foo''Bar\\'", $this->_platform->getListTableColumnsSQL("Foo'Bar\\"), '', true); } /** @@ -709,7 +709,7 @@ public function testQuotesTableNameInListTableColumnsSQL() */ public function testQuotesTableNameInListTableIndexesSQL() { - $this->assertContains("'Foo''Bar\\'", $this->_platform->getListTableIndexesSQL("Foo'Bar\\"), '', true); + self::assertContains("'Foo''Bar\\'", $this->_platform->getListTableIndexesSQL("Foo'Bar\\"), '', true); } /** @@ -717,6 +717,6 @@ public function testQuotesTableNameInListTableIndexesSQL() */ public function testQuotesTableNameInListTableForeignKeysSQL() { - $this->assertContains("'Foo''Bar\\'", $this->_platform->getListTableForeignKeysSQL("Foo'Bar\\"), '', true); + self::assertContains("'Foo''Bar\\'", $this->_platform->getListTableForeignKeysSQL("Foo'Bar\\"), '', true); } } diff --git a/tests/Doctrine/Tests/DBAL/Platforms/MySQL57PlatformTest.php b/tests/Doctrine/Tests/DBAL/Platforms/MySQL57PlatformTest.php index 90620b74d74..2ea04fe75a8 100644 --- a/tests/Doctrine/Tests/DBAL/Platforms/MySQL57PlatformTest.php +++ b/tests/Doctrine/Tests/DBAL/Platforms/MySQL57PlatformTest.php @@ -17,18 +17,18 @@ public function createPlatform() public function testHasNativeJsonType() { - $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')); } /** diff --git a/tests/Doctrine/Tests/DBAL/Platforms/MySqlPlatformTest.php b/tests/Doctrine/Tests/DBAL/Platforms/MySqlPlatformTest.php index 62772d369df..fb2331b4daf 100644 --- a/tests/Doctrine/Tests/DBAL/Platforms/MySqlPlatformTest.php +++ b/tests/Doctrine/Tests/DBAL/Platforms/MySqlPlatformTest.php @@ -14,7 +14,7 @@ public function createPlatform() public function testHasCorrectDefaultTransactionIsolationLevel() { - $this->assertEquals( + self::assertEquals( Connection::TRANSACTION_REPEATABLE_READ, $this->_platform->getDefaultTransactionIsolationLevel() ); diff --git a/tests/Doctrine/Tests/DBAL/Platforms/OraclePlatformTest.php b/tests/Doctrine/Tests/DBAL/Platforms/OraclePlatformTest.php index 33cef473961..7ebbea2d11f 100644 --- a/tests/Doctrine/Tests/DBAL/Platforms/OraclePlatformTest.php +++ b/tests/Doctrine/Tests/DBAL/Platforms/OraclePlatformTest.php @@ -93,30 +93,30 @@ public function getGenerateAlterTableSql() */ public function testRLike() { - $this->assertEquals('RLIKE', $this->_platform->getRegexpExpression(), 'Regular expression operator is not correct'); + self::assertEquals('RLIKE', $this->_platform->getRegexpExpression(), 'Regular expression operator is not correct'); } public function testGeneratesSqlSnippets() { - $this->assertEquals('"', $this->_platform->getIdentifierQuoteCharacter(), 'Identifier quote character is not correct'); - $this->assertEquals('column1 || column2 || column3', $this->_platform->getConcatExpression('column1', 'column2', 'column3'), 'Concatenation expression is not correct'); + self::assertEquals('"', $this->_platform->getIdentifierQuoteCharacter(), 'Identifier quote character is not correct'); + self::assertEquals('column1 || column2 || column3', $this->_platform->getConcatExpression('column1', 'column2', 'column3'), 'Concatenation expression is not correct'); } public function testGeneratesTransactionsCommands() { - $this->assertEquals( + self::assertEquals( 'SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED', $this->_platform->getSetTransactionIsolationSQL(\Doctrine\DBAL\Connection::TRANSACTION_READ_UNCOMMITTED) ); - $this->assertEquals( + self::assertEquals( 'SET TRANSACTION ISOLATION LEVEL READ COMMITTED', $this->_platform->getSetTransactionIsolationSQL(\Doctrine\DBAL\Connection::TRANSACTION_READ_COMMITTED) ); - $this->assertEquals( + self::assertEquals( 'SET TRANSACTION ISOLATION LEVEL SERIALIZABLE', $this->_platform->getSetTransactionIsolationSQL(\Doctrine\DBAL\Connection::TRANSACTION_REPEATABLE_READ) ); - $this->assertEquals( + self::assertEquals( 'SET TRANSACTION ISOLATION LEVEL SERIALIZABLE', $this->_platform->getSetTransactionIsolationSQL(\Doctrine\DBAL\Connection::TRANSACTION_SERIALIZABLE) ); @@ -127,30 +127,30 @@ public function testGeneratesTransactionsCommands() */ public function testCreateDatabaseThrowsException() { - $this->assertEquals('CREATE DATABASE foobar', $this->_platform->getCreateDatabaseSQL('foobar')); + self::assertEquals('CREATE DATABASE foobar', $this->_platform->getCreateDatabaseSQL('foobar')); } public function testDropDatabaseThrowsException() { - $this->assertEquals('DROP USER foobar CASCADE', $this->_platform->getDropDatabaseSQL('foobar')); + self::assertEquals('DROP USER foobar CASCADE', $this->_platform->getDropDatabaseSQL('foobar')); } public function testDropTable() { - $this->assertEquals('DROP TABLE foobar', $this->_platform->getDropTableSQL('foobar')); + self::assertEquals('DROP TABLE foobar', $this->_platform->getDropTableSQL('foobar')); } public function testGeneratesTypeDeclarationForIntegers() { - $this->assertEquals( + self::assertEquals( 'NUMBER(10)', $this->_platform->getIntegerTypeDeclarationSQL(array()) ); - $this->assertEquals( + self::assertEquals( 'NUMBER(10)', $this->_platform->getIntegerTypeDeclarationSQL(array('autoincrement' => true) )); - $this->assertEquals( + self::assertEquals( 'NUMBER(10)', $this->_platform->getIntegerTypeDeclarationSQL( array('autoincrement' => true, 'primary' => true) @@ -159,17 +159,17 @@ public function testGeneratesTypeDeclarationForIntegers() public function testGeneratesTypeDeclarationsForStrings() { - $this->assertEquals( + self::assertEquals( 'CHAR(10)', $this->_platform->getVarcharTypeDeclarationSQL( array('length' => 10, 'fixed' => true) )); - $this->assertEquals( + self::assertEquals( 'VARCHAR2(50)', $this->_platform->getVarcharTypeDeclarationSQL(array('length' => 50)), 'Variable string declaration is not correct' ); - $this->assertEquals( + self::assertEquals( 'VARCHAR2(255)', $this->_platform->getVarcharTypeDeclarationSQL(array()), 'Long string declaration is not correct' @@ -178,17 +178,17 @@ public function testGeneratesTypeDeclarationsForStrings() public function testPrefersIdentityColumns() { - $this->assertFalse($this->_platform->prefersIdentityColumns()); + self::assertFalse($this->_platform->prefersIdentityColumns()); } public function testSupportsIdentityColumns() { - $this->assertFalse($this->_platform->supportsIdentityColumns()); + self::assertFalse($this->_platform->supportsIdentityColumns()); } public function testSupportsSavePoints() { - $this->assertTrue($this->_platform->supportsSavepoints()); + self::assertTrue($this->_platform->supportsSavepoints()); } /** @@ -223,7 +223,7 @@ public function testGeneratesAdvancedForeignKeyOptionsSQL(array $options, $expec { $foreignKey = new ForeignKeyConstraint(array('foo'), 'foreign_table', array('bar'), null, $options); - $this->assertSame($expectedSql, $this->_platform->getAdvancedForeignKeyOptionsSQL($foreignKey)); + self::assertSame($expectedSql, $this->_platform->getAdvancedForeignKeyOptionsSQL($foreignKey)); } /** @@ -258,37 +258,37 @@ public function getReturnsForeignKeyReferentialActionSQL() public function testModifyLimitQuery() { $sql = $this->_platform->modifyLimitQuery('SELECT * FROM user', 10, 0); - $this->assertEquals('SELECT a.* FROM (SELECT * FROM user) a WHERE ROWNUM <= 10', $sql); + self::assertEquals('SELECT a.* FROM (SELECT * FROM user) a WHERE ROWNUM <= 10', $sql); } public function testModifyLimitQueryWithEmptyOffset() { $sql = $this->_platform->modifyLimitQuery('SELECT * FROM user', 10); - $this->assertEquals('SELECT a.* FROM (SELECT * FROM user) a WHERE ROWNUM <= 10', $sql); + self::assertEquals('SELECT a.* FROM (SELECT * FROM user) a WHERE ROWNUM <= 10', $sql); } public function testModifyLimitQueryWithNonEmptyOffset() { $sql = $this->_platform->modifyLimitQuery('SELECT * FROM user', 10, 10); - $this->assertEquals('SELECT * FROM (SELECT a.*, ROWNUM AS doctrine_rownum FROM (SELECT * FROM user) a WHERE ROWNUM <= 20) WHERE doctrine_rownum >= 11', $sql); + self::assertEquals('SELECT * FROM (SELECT a.*, ROWNUM AS doctrine_rownum FROM (SELECT * FROM user) a WHERE ROWNUM <= 20) WHERE doctrine_rownum >= 11', $sql); } public function testModifyLimitQueryWithEmptyLimit() { $sql = $this->_platform->modifyLimitQuery('SELECT * FROM user', null, 10); - $this->assertEquals('SELECT * FROM (SELECT a.*, ROWNUM AS doctrine_rownum FROM (SELECT * FROM user) a) WHERE doctrine_rownum >= 11', $sql); + self::assertEquals('SELECT * FROM (SELECT a.*, ROWNUM AS doctrine_rownum FROM (SELECT * FROM user) a) WHERE doctrine_rownum >= 11', $sql); } public function testModifyLimitQueryWithAscOrderBy() { $sql = $this->_platform->modifyLimitQuery('SELECT * FROM user ORDER BY username ASC', 10); - $this->assertEquals('SELECT a.* FROM (SELECT * FROM user ORDER BY username ASC) a WHERE ROWNUM <= 10', $sql); + self::assertEquals('SELECT a.* FROM (SELECT * FROM user ORDER BY username ASC) a WHERE ROWNUM <= 10', $sql); } public function testModifyLimitQueryWithDescOrderBy() { $sql = $this->_platform->modifyLimitQuery('SELECT * FROM user ORDER BY username DESC', 10); - $this->assertEquals('SELECT a.* FROM (SELECT * FROM user ORDER BY username DESC) a WHERE ROWNUM <= 10', $sql); + self::assertEquals('SELECT a.* FROM (SELECT * FROM user ORDER BY username DESC) a WHERE ROWNUM <= 10', $sql); } public function testGenerateTableWithAutoincrement() @@ -310,8 +310,8 @@ public function testGenerateTableWithAutoincrement() $value = preg_replace('/\s+/', ' ',$value); }); foreach($targets as $key => $sql){ - $this->assertArrayHasKey($key,$statements); - $this->assertEquals($sql, $statements[$key]); + self::assertArrayHasKey($key,$statements); + self::assertEquals($sql, $statements[$key]); } } @@ -413,7 +413,7 @@ public function testAlterTableNotNULL() $expectedSql = array( "ALTER TABLE mytable MODIFY (foo VARCHAR2(255) DEFAULT 'bla', baz VARCHAR2(255) DEFAULT 'bla' NOT NULL, metar VARCHAR2(2000) DEFAULT NULL NULL)", ); - $this->assertEquals($expectedSql, $this->_platform->getAlterTableSQL($tableDiff)); + self::assertEquals($expectedSql, $this->_platform->getAlterTableSQL($tableDiff)); } /** @@ -421,14 +421,14 @@ public function testAlterTableNotNULL() */ public function testInitializesDoctrineTypeMappings() { - $this->assertTrue($this->_platform->hasDoctrineTypeMappingFor('long raw')); - $this->assertSame('blob', $this->_platform->getDoctrineTypeMapping('long raw')); + self::assertTrue($this->_platform->hasDoctrineTypeMappingFor('long raw')); + self::assertSame('blob', $this->_platform->getDoctrineTypeMapping('long raw')); - $this->assertTrue($this->_platform->hasDoctrineTypeMappingFor('raw')); - $this->assertSame('binary', $this->_platform->getDoctrineTypeMapping('raw')); + self::assertTrue($this->_platform->hasDoctrineTypeMappingFor('raw')); + self::assertSame('binary', $this->_platform->getDoctrineTypeMapping('raw')); - $this->assertTrue($this->_platform->hasDoctrineTypeMappingFor('date')); - $this->assertSame('date', $this->_platform->getDoctrineTypeMapping('date')); + self::assertTrue($this->_platform->hasDoctrineTypeMappingFor('date')); + self::assertSame('date', $this->_platform->getDoctrineTypeMapping('date')); } protected function getBinaryMaxLength() @@ -438,15 +438,15 @@ protected function getBinaryMaxLength() public function testReturnsBinaryTypeDeclarationSQL() { - $this->assertSame('RAW(255)', $this->_platform->getBinaryTypeDeclarationSQL(array())); - $this->assertSame('RAW(2000)', $this->_platform->getBinaryTypeDeclarationSQL(array('length' => 0))); - $this->assertSame('RAW(2000)', $this->_platform->getBinaryTypeDeclarationSQL(array('length' => 2000))); - $this->assertSame('BLOB', $this->_platform->getBinaryTypeDeclarationSQL(array('length' => 2001))); + self::assertSame('RAW(255)', $this->_platform->getBinaryTypeDeclarationSQL(array())); + self::assertSame('RAW(2000)', $this->_platform->getBinaryTypeDeclarationSQL(array('length' => 0))); + self::assertSame('RAW(2000)', $this->_platform->getBinaryTypeDeclarationSQL(array('length' => 2000))); + self::assertSame('BLOB', $this->_platform->getBinaryTypeDeclarationSQL(array('length' => 2001))); - $this->assertSame('RAW(255)', $this->_platform->getBinaryTypeDeclarationSQL(array('fixed' => true))); - $this->assertSame('RAW(2000)', $this->_platform->getBinaryTypeDeclarationSQL(array('fixed' => true, 'length' => 0))); - $this->assertSame('RAW(2000)', $this->_platform->getBinaryTypeDeclarationSQL(array('fixed' => true, 'length' => 2000))); - $this->assertSame('BLOB', $this->_platform->getBinaryTypeDeclarationSQL(array('fixed' => true, 'length' => 2001))); + self::assertSame('RAW(255)', $this->_platform->getBinaryTypeDeclarationSQL(array('fixed' => true))); + self::assertSame('RAW(2000)', $this->_platform->getBinaryTypeDeclarationSQL(array('fixed' => true, 'length' => 0))); + self::assertSame('RAW(2000)', $this->_platform->getBinaryTypeDeclarationSQL(array('fixed' => true, 'length' => 2000))); + self::assertSame('BLOB', $this->_platform->getBinaryTypeDeclarationSQL(array('fixed' => true, 'length' => 2001))); } public function testDoesNotPropagateUnnecessaryTableAlterationOnBinaryType() @@ -463,7 +463,7 @@ public function testDoesNotPropagateUnnecessaryTableAlterationOnBinaryType() // VARBINARY -> BINARY // BINARY -> VARBINARY - $this->assertEmpty($this->_platform->getAlterTableSQL($comparator->diffTable($table1, $table2))); + self::assertEmpty($this->_platform->getAlterTableSQL($comparator->diffTable($table1, $table2))); } /** @@ -471,7 +471,7 @@ public function testDoesNotPropagateUnnecessaryTableAlterationOnBinaryType() */ public function testUsesSequenceEmulatedIdentityColumns() { - $this->assertTrue($this->_platform->usesSequenceEmulatedIdentityColumns()); + self::assertTrue($this->_platform->usesSequenceEmulatedIdentityColumns()); } /** @@ -480,10 +480,10 @@ public function testUsesSequenceEmulatedIdentityColumns() */ public function testReturnsIdentitySequenceName() { - $this->assertSame('MYTABLE_SEQ', $this->_platform->getIdentitySequenceName('mytable', 'mycolumn')); - $this->assertSame('"mytable_SEQ"', $this->_platform->getIdentitySequenceName('"mytable"', 'mycolumn')); - $this->assertSame('MYTABLE_SEQ', $this->_platform->getIdentitySequenceName('mytable', '"mycolumn"')); - $this->assertSame('"mytable_SEQ"', $this->_platform->getIdentitySequenceName('"mytable"', '"mycolumn"')); + self::assertSame('MYTABLE_SEQ', $this->_platform->getIdentitySequenceName('mytable', 'mycolumn')); + self::assertSame('"mytable_SEQ"', $this->_platform->getIdentitySequenceName('"mytable"', 'mycolumn')); + self::assertSame('MYTABLE_SEQ', $this->_platform->getIdentitySequenceName('mytable', '"mycolumn"')); + self::assertSame('"mytable_SEQ"', $this->_platform->getIdentitySequenceName('"mytable"', '"mycolumn"')); } /** @@ -493,7 +493,7 @@ public function testReturnsIdentitySequenceName() public function testCreateSequenceWithCache($cacheSize, $expectedSql) { $sequence = new \Doctrine\DBAL\Schema\Sequence('foo', 1, 1, $cacheSize); - $this->assertContains($expectedSql, $this->_platform->getCreateSequenceSQL($sequence)); + self::assertContains($expectedSql, $this->_platform->getCreateSequenceSQL($sequence)); } public function dataCreateSequenceWithCache() @@ -583,7 +583,7 @@ protected function getQuotesDropForeignKeySQL() */ public function testReturnsGuidTypeDeclarationSQL() { - $this->assertSame('CHAR(36)', $this->_platform->getGuidTypeDeclarationSQL(array())); + self::assertSame('CHAR(36)', $this->_platform->getGuidTypeDeclarationSQL(array())); } /** @@ -602,7 +602,7 @@ public function getAlterTableRenameColumnSQL() */ public function testReturnsDropAutoincrementSQL($table, $expectedSql) { - $this->assertSame($expectedSql, $this->_platform->getDropAutoincrementSql($table)); + self::assertSame($expectedSql, $this->_platform->getDropAutoincrementSql($table)); } public function getReturnsDropAutoincrementSQL() @@ -677,8 +677,8 @@ public function testAltersTableColumnCommentWithExplicitlyQuotedIdentifiers() $tableDiff = $comparator->diffTable($table1, $table2); - $this->assertInstanceOf('Doctrine\DBAL\Schema\TableDiff', $tableDiff); - $this->assertSame( + self::assertInstanceOf('Doctrine\DBAL\Schema\TableDiff', $tableDiff); + self::assertSame( array( 'COMMENT ON COLUMN "foo"."bar" IS \'baz\'', ), @@ -692,13 +692,13 @@ public function testQuotedTableNames() $table->addColumn('"id"', 'integer', array('autoincrement' => true)); // assert tabel - $this->assertTrue($table->isQuoted()); - $this->assertEquals('test', $table->getName()); - $this->assertEquals('"test"', $table->getQuotedName($this->_platform)); + self::assertTrue($table->isQuoted()); + self::assertEquals('test', $table->getName()); + self::assertEquals('"test"', $table->getQuotedName($this->_platform)); $sql = $this->_platform->getCreateTableSQL($table); - $this->assertEquals('CREATE TABLE "test" ("id" NUMBER(10) NOT NULL)', $sql[0]); - $this->assertEquals('CREATE SEQUENCE "test_SEQ" START WITH 1 MINVALUE 1 INCREMENT BY 1', $sql[2]); + self::assertEquals('CREATE TABLE "test" ("id" NUMBER(10) NOT NULL)', $sql[0]); + self::assertEquals('CREATE SEQUENCE "test_SEQ" START WITH 1 MINVALUE 1 INCREMENT BY 1', $sql[2]); $createTriggerStatement = <<assertEquals($createTriggerStatement, $sql[3]); + self::assertEquals($createTriggerStatement, $sql[3]); } /** @@ -735,7 +735,7 @@ public function testReturnsGetListTableColumnsSQL($database, $expectedSql) // note: this assertion is a bit strict, as it compares a full SQL string. // Should this break in future, then please try to reduce the matching to substring matching while reworking // the tests - $this->assertEquals($expectedSql, $this->_platform->getListTableColumnsSQL('"test"', $database)); + self::assertEquals($expectedSql, $this->_platform->getListTableColumnsSQL('"test"', $database)); } public function getReturnsGetListTableColumnsSQL() @@ -832,7 +832,7 @@ protected function getGeneratesAlterTableRenameIndexUsedByForeignKeySQL() */ public function testQuotesDatabaseNameInListSequencesSQL() { - $this->assertContains("'Foo''Bar\\\\'", $this->_platform->getListSequencesSQL("Foo'Bar\\"), '', true); + self::assertContains("'Foo''Bar\\\\'", $this->_platform->getListSequencesSQL("Foo'Bar\\"), '', true); } /** @@ -840,7 +840,7 @@ public function testQuotesDatabaseNameInListSequencesSQL() */ public function testQuotesTableNameInListTableIndexesSQL() { - $this->assertContains("'Foo''Bar\\\\'", $this->_platform->getListTableIndexesSQL("Foo'Bar\\"), '', true); + self::assertContains("'Foo''Bar\\\\'", $this->_platform->getListTableIndexesSQL("Foo'Bar\\"), '', true); } /** @@ -848,7 +848,7 @@ public function testQuotesTableNameInListTableIndexesSQL() */ public function testQuotesTableNameInListTableForeignKeysSQL() { - $this->assertContains("'Foo''Bar\\\\'", $this->_platform->getListTableForeignKeysSQL("Foo'Bar\\"), '', true); + self::assertContains("'Foo''Bar\\\\'", $this->_platform->getListTableForeignKeysSQL("Foo'Bar\\"), '', true); } /** @@ -856,7 +856,7 @@ public function testQuotesTableNameInListTableForeignKeysSQL() */ public function testQuotesTableNameInListTableConstraintsSQL() { - $this->assertContains("'Foo''Bar\\\\'", $this->_platform->getListTableConstraintsSQL("Foo'Bar\\"), '', true); + self::assertContains("'Foo''Bar\\\\'", $this->_platform->getListTableConstraintsSQL("Foo'Bar\\"), '', true); } /** @@ -864,7 +864,7 @@ public function testQuotesTableNameInListTableConstraintsSQL() */ public function testQuotesTableNameInListTableColumnsSQL() { - $this->assertContains("'Foo''Bar\\\\'", $this->_platform->getListTableColumnsSQL("Foo'Bar\\"), '', true); + self::assertContains("'Foo''Bar\\\\'", $this->_platform->getListTableColumnsSQL("Foo'Bar\\"), '', true); } /** @@ -872,6 +872,6 @@ public function testQuotesTableNameInListTableColumnsSQL() */ public function testQuotesDatabaseNameInListTableColumnsSQL() { - $this->assertContains("'Foo''Bar\\\\'", $this->_platform->getListTableColumnsSQL('foo_table', "Foo'Bar\\"), '', true); + self::assertContains("'Foo''Bar\\\\'", $this->_platform->getListTableColumnsSQL('foo_table', "Foo'Bar\\"), '', true); } } diff --git a/tests/Doctrine/Tests/DBAL/Platforms/PostgreSQL91PlatformTest.php b/tests/Doctrine/Tests/DBAL/Platforms/PostgreSQL91PlatformTest.php index 5075e312828..ed09f26c92e 100644 --- a/tests/Doctrine/Tests/DBAL/Platforms/PostgreSQL91PlatformTest.php +++ b/tests/Doctrine/Tests/DBAL/Platforms/PostgreSQL91PlatformTest.php @@ -13,7 +13,7 @@ public function createPlatform() public function testColumnCollationDeclarationSQL() { - $this->assertEquals( + self::assertEquals( 'COLLATE "en_US.UTF-8"', $this->_platform->getColumnCollationDeclarationSQL('en_US.UTF-8') ); diff --git a/tests/Doctrine/Tests/DBAL/Platforms/PostgreSQL92PlatformTest.php b/tests/Doctrine/Tests/DBAL/Platforms/PostgreSQL92PlatformTest.php index 38f5caa50f9..0189dbdfe36 100644 --- a/tests/Doctrine/Tests/DBAL/Platforms/PostgreSQL92PlatformTest.php +++ b/tests/Doctrine/Tests/DBAL/Platforms/PostgreSQL92PlatformTest.php @@ -20,7 +20,7 @@ public function createPlatform() */ public function testHasNativeJsonType() { - $this->assertTrue($this->_platform->hasNativeJsonType()); + self::assertTrue($this->_platform->hasNativeJsonType()); } /** @@ -28,22 +28,22 @@ public function testHasNativeJsonType() */ public function testReturnsJsonTypeDeclarationSQL() { - $this->assertSame('JSON', $this->_platform->getJsonTypeDeclarationSQL(array())); + self::assertSame('JSON', $this->_platform->getJsonTypeDeclarationSQL(array())); } public function testReturnsSmallIntTypeDeclarationSQL() { - $this->assertSame( + self::assertSame( 'SMALLSERIAL', $this->_platform->getSmallIntTypeDeclarationSQL(array('autoincrement' => true)) ); - $this->assertSame( + self::assertSame( 'SMALLINT', $this->_platform->getSmallIntTypeDeclarationSQL(array('autoincrement' => false)) ); - $this->assertSame( + self::assertSame( 'SMALLINT', $this->_platform->getSmallIntTypeDeclarationSQL(array()) ); @@ -54,8 +54,8 @@ public function testReturnsSmallIntTypeDeclarationSQL() */ public function testInitializesJsonTypeMapping() { - $this->assertTrue($this->_platform->hasDoctrineTypeMappingFor('json')); - $this->assertEquals(Type::JSON, $this->_platform->getDoctrineTypeMapping('json')); + self::assertTrue($this->_platform->hasDoctrineTypeMappingFor('json')); + self::assertEquals(Type::JSON, $this->_platform->getDoctrineTypeMapping('json')); } /** @@ -63,7 +63,7 @@ public function testInitializesJsonTypeMapping() */ public function testReturnsCloseActiveDatabaseConnectionsSQL() { - $this->assertSame( + self::assertSame( "SELECT pg_terminate_backend(pid) FROM pg_stat_activity WHERE datname = 'foo'", $this->_platform->getCloseActiveDatabaseConnectionsSQL('foo') ); diff --git a/tests/Doctrine/Tests/DBAL/Platforms/PostgreSQL94PlatformTest.php b/tests/Doctrine/Tests/DBAL/Platforms/PostgreSQL94PlatformTest.php index ef8f45bd624..d566007afc2 100644 --- a/tests/Doctrine/Tests/DBAL/Platforms/PostgreSQL94PlatformTest.php +++ b/tests/Doctrine/Tests/DBAL/Platforms/PostgreSQL94PlatformTest.php @@ -18,14 +18,14 @@ public function createPlatform() public function testReturnsJsonTypeDeclarationSQL() { parent::testReturnsJsonTypeDeclarationSQL(); - $this->assertSame('JSON', $this->_platform->getJsonTypeDeclarationSQL(array('jsonb' => false))); - $this->assertSame('JSONB', $this->_platform->getJsonTypeDeclarationSQL(array('jsonb' => true))); + self::assertSame('JSON', $this->_platform->getJsonTypeDeclarationSQL(array('jsonb' => false))); + self::assertSame('JSONB', $this->_platform->getJsonTypeDeclarationSQL(array('jsonb' => true))); } public function testInitializesJsonTypeMapping() { parent::testInitializesJsonTypeMapping(); - $this->assertTrue($this->_platform->hasDoctrineTypeMappingFor('jsonb')); - $this->assertEquals(Type::JSON, $this->_platform->getDoctrineTypeMapping('jsonb')); + self::assertTrue($this->_platform->hasDoctrineTypeMappingFor('jsonb')); + self::assertEquals(Type::JSON, $this->_platform->getDoctrineTypeMapping('jsonb')); } } diff --git a/tests/Doctrine/Tests/DBAL/Platforms/PostgreSqlPlatformTest.php b/tests/Doctrine/Tests/DBAL/Platforms/PostgreSqlPlatformTest.php index 19870f240b4..6db159df48e 100644 --- a/tests/Doctrine/Tests/DBAL/Platforms/PostgreSqlPlatformTest.php +++ b/tests/Doctrine/Tests/DBAL/Platforms/PostgreSqlPlatformTest.php @@ -13,6 +13,6 @@ public function createPlatform() public function testSupportsPartialIndexes() { - $this->assertTrue($this->_platform->supportsPartialIndexes()); + self::assertTrue($this->_platform->supportsPartialIndexes()); } } diff --git a/tests/Doctrine/Tests/DBAL/Platforms/ReservedKeywordsValidatorTest.php b/tests/Doctrine/Tests/DBAL/Platforms/ReservedKeywordsValidatorTest.php index e1595922e16..bf1ad773238 100644 --- a/tests/Doctrine/Tests/DBAL/Platforms/ReservedKeywordsValidatorTest.php +++ b/tests/Doctrine/Tests/DBAL/Platforms/ReservedKeywordsValidatorTest.php @@ -24,7 +24,7 @@ public function testReservedTableName() $table = new Table("TABLE"); $this->validator->acceptTable($table); - $this->assertEquals( + self::assertEquals( array('Table TABLE keyword violations: MySQL'), $this->validator->getViolations() ); @@ -37,9 +37,9 @@ public function testReservedColumnName() $this->validator->acceptColumn($table, $column); - $this->assertEquals( + self::assertEquals( array('Table TABLE column table keyword violations: MySQL'), $this->validator->getViolations() ); } -} \ No newline at end of file +} diff --git a/tests/Doctrine/Tests/DBAL/Platforms/SQLAnywhere11PlatformTest.php b/tests/Doctrine/Tests/DBAL/Platforms/SQLAnywhere11PlatformTest.php index e3b6e232f68..c59a9b1ac12 100644 --- a/tests/Doctrine/Tests/DBAL/Platforms/SQLAnywhere11PlatformTest.php +++ b/tests/Doctrine/Tests/DBAL/Platforms/SQLAnywhere11PlatformTest.php @@ -23,6 +23,6 @@ public function testDoesNotSupportRegexp() public function testGeneratesRegularExpressionSQLSnippet() { - $this->assertEquals('REGEXP', $this->_platform->getRegexpExpression()); + self::assertEquals('REGEXP', $this->_platform->getRegexpExpression()); } } diff --git a/tests/Doctrine/Tests/DBAL/Platforms/SQLAnywhere12PlatformTest.php b/tests/Doctrine/Tests/DBAL/Platforms/SQLAnywhere12PlatformTest.php index 82e9dde9fc9..4c6763ae124 100644 --- a/tests/Doctrine/Tests/DBAL/Platforms/SQLAnywhere12PlatformTest.php +++ b/tests/Doctrine/Tests/DBAL/Platforms/SQLAnywhere12PlatformTest.php @@ -25,33 +25,33 @@ public function testDoesNotSupportSequences() public function testSupportsSequences() { - $this->assertTrue($this->_platform->supportsSequences()); + self::assertTrue($this->_platform->supportsSequences()); } public function testGeneratesSequenceSqlCommands() { $sequence = new Sequence('myseq', 20, 1); - $this->assertEquals( + self::assertEquals( 'CREATE SEQUENCE myseq INCREMENT BY 20 START WITH 1 MINVALUE 1', $this->_platform->getCreateSequenceSQL($sequence) ); - $this->assertEquals( + self::assertEquals( 'ALTER SEQUENCE myseq INCREMENT BY 20', $this->_platform->getAlterSequenceSQL($sequence) ); - $this->assertEquals( + self::assertEquals( 'DROP SEQUENCE myseq', $this->_platform->getDropSequenceSQL('myseq') ); - $this->assertEquals( + self::assertEquals( 'DROP SEQUENCE myseq', $this->_platform->getDropSequenceSQL($sequence) ); - $this->assertEquals( + self::assertEquals( "SELECT myseq.NEXTVAL", $this->_platform->getSequenceNextValSQL('myseq') ); - $this->assertEquals( + self::assertEquals( 'SELECT sequence_name, increment_by, start_with, min_value FROM SYS.SYSSEQUENCE', $this->_platform->getListSequencesSQL(null) ); @@ -59,7 +59,7 @@ public function testGeneratesSequenceSqlCommands() public function testGeneratesDateTimeTzColumnTypeDeclarationSQL() { - $this->assertEquals( + self::assertEquals( 'TIMESTAMP WITH TIME ZONE', $this->_platform->getDateTimeTzTypeDeclarationSQL(array( 'length' => 10, @@ -72,18 +72,18 @@ public function testGeneratesDateTimeTzColumnTypeDeclarationSQL() public function testHasCorrectDateTimeTzFormatString() { - $this->assertEquals('Y-m-d H:i:s.uP', $this->_platform->getDateTimeTzFormatString()); + self::assertEquals('Y-m-d H:i:s.uP', $this->_platform->getDateTimeTzFormatString()); } public function testInitializesDateTimeTzTypeMapping() { - $this->assertTrue($this->_platform->hasDoctrineTypeMappingFor('timestamp with time zone')); - $this->assertEquals('datetime', $this->_platform->getDoctrineTypeMapping('timestamp with time zone')); + self::assertTrue($this->_platform->hasDoctrineTypeMappingFor('timestamp with time zone')); + self::assertEquals('datetime', $this->_platform->getDoctrineTypeMapping('timestamp with time zone')); } public function testGeneratesCreateIndexWithAdvancedPlatformOptionsSQL() { - $this->assertEquals( + self::assertEquals( 'CREATE VIRTUAL UNIQUE CLUSTERED INDEX fooindex ON footable (a, b) WITH NULLS NOT DISTINCT FOR OLAP WORKLOAD', $this->_platform->getCreateIndexSQL( new Index( @@ -96,7 +96,7 @@ public function testGeneratesCreateIndexWithAdvancedPlatformOptionsSQL() 'footable' ) ); - $this->assertEquals( + self::assertEquals( 'CREATE VIRTUAL CLUSTERED INDEX fooindex ON footable (a, b) FOR OLAP WORKLOAD', $this->_platform->getCreateIndexSQL( new Index( @@ -111,7 +111,7 @@ public function testGeneratesCreateIndexWithAdvancedPlatformOptionsSQL() ); // WITH NULLS NOT DISTINCT clause not available on primary indexes. - $this->assertEquals( + self::assertEquals( 'ALTER TABLE footable ADD PRIMARY KEY (a, b)', $this->_platform->getCreateIndexSQL( new Index( @@ -126,7 +126,7 @@ public function testGeneratesCreateIndexWithAdvancedPlatformOptionsSQL() ); // WITH NULLS NOT DISTINCT clause not available on non-unique indexes. - $this->assertEquals( + self::assertEquals( 'CREATE INDEX fooindex ON footable (a, b)', $this->_platform->getCreateIndexSQL( new Index( diff --git a/tests/Doctrine/Tests/DBAL/Platforms/SQLAnywhere16PlatformTest.php b/tests/Doctrine/Tests/DBAL/Platforms/SQLAnywhere16PlatformTest.php index 0d4efb17431..c66bb5177ab 100644 --- a/tests/Doctrine/Tests/DBAL/Platforms/SQLAnywhere16PlatformTest.php +++ b/tests/Doctrine/Tests/DBAL/Platforms/SQLAnywhere16PlatformTest.php @@ -14,7 +14,7 @@ public function createPlatform() public function testGeneratesCreateIndexWithAdvancedPlatformOptionsSQL() { - $this->assertEquals( + self::assertEquals( 'CREATE UNIQUE INDEX fooindex ON footable (a, b) WITH NULLS DISTINCT', $this->_platform->getCreateIndexSQL( new Index( @@ -29,7 +29,7 @@ public function testGeneratesCreateIndexWithAdvancedPlatformOptionsSQL() ); // WITH NULLS DISTINCT clause not available on primary indexes. - $this->assertEquals( + self::assertEquals( 'ALTER TABLE footable ADD PRIMARY KEY (a, b)', $this->_platform->getCreateIndexSQL( new Index( @@ -44,7 +44,7 @@ public function testGeneratesCreateIndexWithAdvancedPlatformOptionsSQL() ); // WITH NULLS DISTINCT clause not available on non-unique indexes. - $this->assertEquals( + self::assertEquals( 'CREATE INDEX fooindex ON footable (a, b)', $this->_platform->getCreateIndexSQL( new Index( diff --git a/tests/Doctrine/Tests/DBAL/Platforms/SQLAnywherePlatformTest.php b/tests/Doctrine/Tests/DBAL/Platforms/SQLAnywherePlatformTest.php index 5fe5a2e6acb..be731ef16fd 100644 --- a/tests/Doctrine/Tests/DBAL/Platforms/SQLAnywherePlatformTest.php +++ b/tests/Doctrine/Tests/DBAL/Platforms/SQLAnywherePlatformTest.php @@ -121,7 +121,7 @@ public function getCreateTableColumnTypeCommentsSQL() public function testHasCorrectPlatformName() { - $this->assertEquals('sqlanywhere', $this->_platform->getName()); + self::assertEquals('sqlanywhere', $this->_platform->getName()); } public function testGeneratesCreateTableSQLWithCommonIndexes() @@ -133,7 +133,7 @@ public function testGeneratesCreateTableSQLWithCommonIndexes() $table->addIndex(array('name')); $table->addIndex(array('id', 'name'), 'composite_idx'); - $this->assertEquals( + self::assertEquals( array( 'CREATE TABLE test (id INT NOT NULL, name VARCHAR(50) NOT NULL, PRIMARY KEY (id))', 'CREATE INDEX IDX_D87F7E0C5E237E06 ON test (name)', @@ -159,7 +159,7 @@ public function testGeneratesCreateTableSQLWithForeignKeyConstraints() 'named_fk' ); - $this->assertEquals( + self::assertEquals( array( 'CREATE TABLE test (id INT NOT NULL, fk_1 INT NOT NULL, fk_2 INT NOT NULL, ' . 'CONSTRAINT FK_D87F7E0C177612A38E7F4319 FOREIGN KEY (fk_1, fk_2) REFERENCES foreign_table (pk_1, pk_2), ' . @@ -177,7 +177,7 @@ public function testGeneratesCreateTableSQLWithCheckConstraints() $table->addColumn('check_min', 'integer', array('platformOptions' => array('min' => 10))); $table->setPrimaryKey(array('id')); - $this->assertEquals( + self::assertEquals( array( 'CREATE TABLE test (id INT NOT NULL, check_max INT NOT NULL, check_min INT NOT NULL, PRIMARY KEY (id), CHECK (check_max <= 10), CHECK (check_min >= 10))' ), @@ -198,7 +198,7 @@ public function testGeneratesTableAlterationWithRemovedColumnCommentSql() array('comment') ); - $this->assertEquals( + self::assertEquals( array( "COMMENT ON COLUMN mytable.foo IS NULL" ), @@ -214,7 +214,7 @@ public function testAppendsLockHint($lockMode, $lockHint) $fromClause = 'FROM users'; $expectedResult = $fromClause . $lockHint; - $this->assertSame($expectedResult, $this->_platform->appendLockHint($fromClause, $lockMode)); + self::assertSame($expectedResult, $this->_platform->appendLockHint($fromClause, $lockMode)); } public function getLockHints() @@ -232,7 +232,7 @@ public function getLockHints() public function testHasCorrectMaxIdentifierLength() { - $this->assertEquals(128, $this->_platform->getMaxIdentifierLength()); + self::assertEquals(128, $this->_platform->getMaxIdentifierLength()); } public function testFixesSchemaElementNames() @@ -247,11 +247,11 @@ public function testFixesSchemaElementNames() $fixedSchemaElementName = substr($schemaElementName, 0, $maxIdentifierLength); - $this->assertEquals( + self::assertEquals( $fixedSchemaElementName, $this->_platform->fixSchemaElementName($schemaElementName) ); - $this->assertEquals( + self::assertEquals( $fixedSchemaElementName, $this->_platform->fixSchemaElementName($fixedSchemaElementName) ); @@ -266,71 +266,71 @@ public function testGeneratesColumnTypesDeclarationSQL() 'autoincrement' => true ); - $this->assertEquals('SMALLINT', $this->_platform->getSmallIntTypeDeclarationSQL(array())); - $this->assertEquals('UNSIGNED SMALLINT', $this->_platform->getSmallIntTypeDeclarationSQL(array( + self::assertEquals('SMALLINT', $this->_platform->getSmallIntTypeDeclarationSQL(array())); + self::assertEquals('UNSIGNED SMALLINT', $this->_platform->getSmallIntTypeDeclarationSQL(array( 'unsigned' => true ))); - $this->assertEquals('UNSIGNED SMALLINT IDENTITY', $this->_platform->getSmallIntTypeDeclarationSQL($fullColumnDef)); - $this->assertEquals('INT', $this->_platform->getIntegerTypeDeclarationSQL(array())); - $this->assertEquals('UNSIGNED INT', $this->_platform->getIntegerTypeDeclarationSQL(array( + self::assertEquals('UNSIGNED SMALLINT IDENTITY', $this->_platform->getSmallIntTypeDeclarationSQL($fullColumnDef)); + self::assertEquals('INT', $this->_platform->getIntegerTypeDeclarationSQL(array())); + self::assertEquals('UNSIGNED INT', $this->_platform->getIntegerTypeDeclarationSQL(array( 'unsigned' => true ))); - $this->assertEquals('UNSIGNED INT IDENTITY', $this->_platform->getIntegerTypeDeclarationSQL($fullColumnDef)); - $this->assertEquals('BIGINT', $this->_platform->getBigIntTypeDeclarationSQL(array())); - $this->assertEquals('UNSIGNED BIGINT', $this->_platform->getBigIntTypeDeclarationSQL(array( + self::assertEquals('UNSIGNED INT IDENTITY', $this->_platform->getIntegerTypeDeclarationSQL($fullColumnDef)); + self::assertEquals('BIGINT', $this->_platform->getBigIntTypeDeclarationSQL(array())); + self::assertEquals('UNSIGNED BIGINT', $this->_platform->getBigIntTypeDeclarationSQL(array( 'unsigned' => true ))); - $this->assertEquals('UNSIGNED BIGINT IDENTITY', $this->_platform->getBigIntTypeDeclarationSQL($fullColumnDef)); - $this->assertEquals('LONG BINARY', $this->_platform->getBlobTypeDeclarationSQL($fullColumnDef)); - $this->assertEquals('BIT', $this->_platform->getBooleanTypeDeclarationSQL($fullColumnDef)); - $this->assertEquals('TEXT', $this->_platform->getClobTypeDeclarationSQL($fullColumnDef)); - $this->assertEquals('DATE', $this->_platform->getDateTypeDeclarationSQL($fullColumnDef)); - $this->assertEquals('DATETIME', $this->_platform->getDateTimeTypeDeclarationSQL($fullColumnDef)); - $this->assertEquals('TIME', $this->_platform->getTimeTypeDeclarationSQL($fullColumnDef)); - $this->assertEquals('UNIQUEIDENTIFIER', $this->_platform->getGuidTypeDeclarationSQL($fullColumnDef)); + self::assertEquals('UNSIGNED BIGINT IDENTITY', $this->_platform->getBigIntTypeDeclarationSQL($fullColumnDef)); + self::assertEquals('LONG BINARY', $this->_platform->getBlobTypeDeclarationSQL($fullColumnDef)); + self::assertEquals('BIT', $this->_platform->getBooleanTypeDeclarationSQL($fullColumnDef)); + self::assertEquals('TEXT', $this->_platform->getClobTypeDeclarationSQL($fullColumnDef)); + self::assertEquals('DATE', $this->_platform->getDateTypeDeclarationSQL($fullColumnDef)); + self::assertEquals('DATETIME', $this->_platform->getDateTimeTypeDeclarationSQL($fullColumnDef)); + self::assertEquals('TIME', $this->_platform->getTimeTypeDeclarationSQL($fullColumnDef)); + self::assertEquals('UNIQUEIDENTIFIER', $this->_platform->getGuidTypeDeclarationSQL($fullColumnDef)); - $this->assertEquals(1, $this->_platform->getVarcharDefaultLength()); - $this->assertEquals(32767, $this->_platform->getVarcharMaxLength()); + self::assertEquals(1, $this->_platform->getVarcharDefaultLength()); + self::assertEquals(32767, $this->_platform->getVarcharMaxLength()); } public function testHasNativeGuidType() { - $this->assertTrue($this->_platform->hasNativeGuidType()); + self::assertTrue($this->_platform->hasNativeGuidType()); } public function testGeneratesDDLSnippets() { - $this->assertEquals("CREATE DATABASE 'foobar'", $this->_platform->getCreateDatabaseSQL('foobar')); - $this->assertEquals("CREATE DATABASE 'foobar'", $this->_platform->getCreateDatabaseSQL('"foobar"')); - $this->assertEquals("CREATE DATABASE 'create'", $this->_platform->getCreateDatabaseSQL('create')); - $this->assertEquals("DROP DATABASE 'foobar'", $this->_platform->getDropDatabaseSQL('foobar')); - $this->assertEquals("DROP DATABASE 'foobar'", $this->_platform->getDropDatabaseSQL('"foobar"')); - $this->assertEquals("DROP DATABASE 'create'", $this->_platform->getDropDatabaseSQL('create')); - $this->assertEquals('CREATE GLOBAL TEMPORARY TABLE', $this->_platform->getCreateTemporaryTableSnippetSQL()); - $this->assertEquals("START DATABASE 'foobar' AUTOSTOP OFF", $this->_platform->getStartDatabaseSQL('foobar')); - $this->assertEquals("START DATABASE 'foobar' AUTOSTOP OFF", $this->_platform->getStartDatabaseSQL('"foobar"')); - $this->assertEquals("START DATABASE 'create' AUTOSTOP OFF", $this->_platform->getStartDatabaseSQL('create')); - $this->assertEquals('STOP DATABASE "foobar" UNCONDITIONALLY', $this->_platform->getStopDatabaseSQL('foobar')); - $this->assertEquals('STOP DATABASE "foobar" UNCONDITIONALLY', $this->_platform->getStopDatabaseSQL('"foobar"')); - $this->assertEquals('STOP DATABASE "create" UNCONDITIONALLY', $this->_platform->getStopDatabaseSQL('create')); - $this->assertEquals('TRUNCATE TABLE foobar', $this->_platform->getTruncateTableSQL('foobar')); - $this->assertEquals('TRUNCATE TABLE foobar', $this->_platform->getTruncateTableSQL('foobar'), true); + self::assertEquals("CREATE DATABASE 'foobar'", $this->_platform->getCreateDatabaseSQL('foobar')); + self::assertEquals("CREATE DATABASE 'foobar'", $this->_platform->getCreateDatabaseSQL('"foobar"')); + self::assertEquals("CREATE DATABASE 'create'", $this->_platform->getCreateDatabaseSQL('create')); + self::assertEquals("DROP DATABASE 'foobar'", $this->_platform->getDropDatabaseSQL('foobar')); + self::assertEquals("DROP DATABASE 'foobar'", $this->_platform->getDropDatabaseSQL('"foobar"')); + self::assertEquals("DROP DATABASE 'create'", $this->_platform->getDropDatabaseSQL('create')); + self::assertEquals('CREATE GLOBAL TEMPORARY TABLE', $this->_platform->getCreateTemporaryTableSnippetSQL()); + self::assertEquals("START DATABASE 'foobar' AUTOSTOP OFF", $this->_platform->getStartDatabaseSQL('foobar')); + self::assertEquals("START DATABASE 'foobar' AUTOSTOP OFF", $this->_platform->getStartDatabaseSQL('"foobar"')); + self::assertEquals("START DATABASE 'create' AUTOSTOP OFF", $this->_platform->getStartDatabaseSQL('create')); + self::assertEquals('STOP DATABASE "foobar" UNCONDITIONALLY', $this->_platform->getStopDatabaseSQL('foobar')); + self::assertEquals('STOP DATABASE "foobar" UNCONDITIONALLY', $this->_platform->getStopDatabaseSQL('"foobar"')); + self::assertEquals('STOP DATABASE "create" UNCONDITIONALLY', $this->_platform->getStopDatabaseSQL('create')); + self::assertEquals('TRUNCATE TABLE foobar', $this->_platform->getTruncateTableSQL('foobar')); + self::assertEquals('TRUNCATE TABLE foobar', $this->_platform->getTruncateTableSQL('foobar'), true); $viewSql = 'SELECT * FROM footable'; - $this->assertEquals('CREATE VIEW fooview AS ' . $viewSql, $this->_platform->getCreateViewSQL('fooview', $viewSql)); - $this->assertEquals('DROP VIEW fooview', $this->_platform->getDropViewSQL('fooview')); + self::assertEquals('CREATE VIEW fooview AS ' . $viewSql, $this->_platform->getCreateViewSQL('fooview', $viewSql)); + self::assertEquals('DROP VIEW fooview', $this->_platform->getDropViewSQL('fooview')); } public function testGeneratesPrimaryKeyDeclarationSQL() { - $this->assertEquals( + self::assertEquals( 'CONSTRAINT pk PRIMARY KEY CLUSTERED (a, b)', $this->_platform->getPrimaryKeyDeclarationSQL( new Index(null, array('a', 'b'), true, true, array('clustered')), 'pk' ) ); - $this->assertEquals( + self::assertEquals( 'PRIMARY KEY (a, b)', $this->_platform->getPrimaryKeyDeclarationSQL( new Index(null, array('a', 'b'), true, true) @@ -347,14 +347,14 @@ public function testCannotGeneratePrimaryKeyDeclarationSQLWithEmptyColumns() public function testGeneratesCreateUnnamedPrimaryKeySQL() { - $this->assertEquals( + self::assertEquals( 'ALTER TABLE foo ADD PRIMARY KEY CLUSTERED (a, b)', $this->_platform->getCreatePrimaryKeySQL( new Index('pk', array('a', 'b'), true, true, array('clustered')), 'foo' ) ); - $this->assertEquals( + self::assertEquals( 'ALTER TABLE foo ADD PRIMARY KEY (a, b)', $this->_platform->getCreatePrimaryKeySQL( new Index('any_pk_name', array('a', 'b'), true, true), @@ -365,14 +365,14 @@ public function testGeneratesCreateUnnamedPrimaryKeySQL() public function testGeneratesUniqueConstraintDeclarationSQL() { - $this->assertEquals( + self::assertEquals( 'CONSTRAINT unique_constraint UNIQUE CLUSTERED (a, b)', $this->_platform->getUniqueConstraintDeclarationSQL( 'unique_constraint', new Index(null, array('a', 'b'), true, false, array('clustered')) ) ); - $this->assertEquals( + self::assertEquals( 'UNIQUE (a, b)', $this->_platform->getUniqueConstraintDeclarationSQL(null, new Index(null, array('a', 'b'), true, false)) ); @@ -387,7 +387,7 @@ public function testCannotGenerateUniqueConstraintDeclarationSQLWithEmptyColumns public function testGeneratesForeignKeyConstraintsWithAdvancedPlatformOptionsSQL() { - $this->assertEquals( + self::assertEquals( 'CONSTRAINT fk ' . 'NOT NULL FOREIGN KEY (a, b) ' . 'REFERENCES foreign_table (c, d) ' . @@ -404,7 +404,7 @@ public function testGeneratesForeignKeyConstraintsWithAdvancedPlatformOptionsSQL )) ) ); - $this->assertEquals( + self::assertEquals( 'FOREIGN KEY (a, b) REFERENCES foreign_table (c, d)', $this->_platform->getForeignKeyDeclarationSQL( new ForeignKeyConstraint(array('a', 'b'), 'foreign_table', array('c', 'd')) @@ -414,10 +414,10 @@ public function testGeneratesForeignKeyConstraintsWithAdvancedPlatformOptionsSQL public function testGeneratesForeignKeyMatchClausesSQL() { - $this->assertEquals('SIMPLE', $this->_platform->getForeignKeyMatchClauseSQL(1)); - $this->assertEquals('FULL', $this->_platform->getForeignKeyMatchClauseSQL(2)); - $this->assertEquals('UNIQUE SIMPLE', $this->_platform->getForeignKeyMatchClauseSQL(129)); - $this->assertEquals('UNIQUE FULL', $this->_platform->getForeignKeyMatchClauseSQL(130)); + self::assertEquals('SIMPLE', $this->_platform->getForeignKeyMatchClauseSQL(1)); + self::assertEquals('FULL', $this->_platform->getForeignKeyMatchClauseSQL(2)); + self::assertEquals('UNIQUE SIMPLE', $this->_platform->getForeignKeyMatchClauseSQL(129)); + self::assertEquals('UNIQUE FULL', $this->_platform->getForeignKeyMatchClauseSQL(130)); } public function testCannotGenerateInvalidForeignKeyMatchClauseSQL() @@ -461,7 +461,7 @@ public function testCannotGenerateCustomConstraintWithCreateConstraintSQL() public function testGeneratesCreateIndexWithAdvancedPlatformOptionsSQL() { - $this->assertEquals( + self::assertEquals( 'CREATE VIRTUAL UNIQUE CLUSTERED INDEX fooindex ON footable (a, b) FOR OLAP WORKLOAD', $this->_platform->getCreateIndexSQL( new Index( @@ -487,9 +487,9 @@ public function testGeneratesDropIndexSQL() { $index = new Index('fooindex', array()); - $this->assertEquals('DROP INDEX fooindex', $this->_platform->getDropIndexSQL($index)); - $this->assertEquals('DROP INDEX footable.fooindex', $this->_platform->getDropIndexSQL($index, 'footable')); - $this->assertEquals('DROP INDEX footable.fooindex', $this->_platform->getDropIndexSQL( + self::assertEquals('DROP INDEX fooindex', $this->_platform->getDropIndexSQL($index)); + self::assertEquals('DROP INDEX footable.fooindex', $this->_platform->getDropIndexSQL($index, 'footable')); + self::assertEquals('DROP INDEX footable.fooindex', $this->_platform->getDropIndexSQL( $index, new Table('footable') )); @@ -511,72 +511,72 @@ public function testCannotGenerateDropIndexSQLWithInvalidTableParameter() public function testGeneratesSQLSnippets() { - $this->assertEquals('STRING(column1, "string1", column2, "string2")', $this->_platform->getConcatExpression( + self::assertEquals('STRING(column1, "string1", column2, "string2")', $this->_platform->getConcatExpression( 'column1', '"string1"', 'column2', '"string2"' )); - $this->assertEquals('CURRENT DATE', $this->_platform->getCurrentDateSQL()); - $this->assertEquals('CURRENT TIME', $this->_platform->getCurrentTimeSQL()); - $this->assertEquals('CURRENT TIMESTAMP', $this->_platform->getCurrentTimestampSQL()); - $this->assertEquals("DATEADD(DAY, 4, '1987/05/02')", $this->_platform->getDateAddDaysExpression("'1987/05/02'", 4)); - $this->assertEquals("DATEADD(HOUR, 12, '1987/05/02')", $this->_platform->getDateAddHourExpression("'1987/05/02'", 12)); - $this->assertEquals("DATEADD(MINUTE, 2, '1987/05/02')", $this->_platform->getDateAddMinutesExpression("'1987/05/02'", 2)); - $this->assertEquals("DATEADD(MONTH, 102, '1987/05/02')", $this->_platform->getDateAddMonthExpression("'1987/05/02'", 102)); - $this->assertEquals("DATEADD(QUARTER, 5, '1987/05/02')", $this->_platform->getDateAddQuartersExpression("'1987/05/02'", 5)); - $this->assertEquals("DATEADD(SECOND, 1, '1987/05/02')", $this->_platform->getDateAddSecondsExpression("'1987/05/02'", 1)); - $this->assertEquals("DATEADD(WEEK, 3, '1987/05/02')", $this->_platform->getDateAddWeeksExpression("'1987/05/02'", 3)); - $this->assertEquals("DATEADD(YEAR, 10, '1987/05/02')", $this->_platform->getDateAddYearsExpression("'1987/05/02'", 10)); - $this->assertEquals("DATEDIFF(day, '1987/04/01', '1987/05/02')", $this->_platform->getDateDiffExpression("'1987/05/02'", "'1987/04/01'")); - $this->assertEquals("DATEADD(DAY, -1 * 4, '1987/05/02')", $this->_platform->getDateSubDaysExpression("'1987/05/02'", 4)); - $this->assertEquals("DATEADD(HOUR, -1 * 12, '1987/05/02')", $this->_platform->getDateSubHourExpression("'1987/05/02'", 12)); - $this->assertEquals("DATEADD(MINUTE, -1 * 2, '1987/05/02')", $this->_platform->getDateSubMinutesExpression("'1987/05/02'", 2)); - $this->assertEquals("DATEADD(MONTH, -1 * 102, '1987/05/02')", $this->_platform->getDateSubMonthExpression("'1987/05/02'", 102)); - $this->assertEquals("DATEADD(QUARTER, -1 * 5, '1987/05/02')", $this->_platform->getDateSubQuartersExpression("'1987/05/02'", 5)); - $this->assertEquals("DATEADD(SECOND, -1 * 1, '1987/05/02')", $this->_platform->getDateSubSecondsExpression("'1987/05/02'", 1)); - $this->assertEquals("DATEADD(WEEK, -1 * 3, '1987/05/02')", $this->_platform->getDateSubWeeksExpression("'1987/05/02'", 3)); - $this->assertEquals("DATEADD(YEAR, -1 * 10, '1987/05/02')", $this->_platform->getDateSubYearsExpression("'1987/05/02'", 10)); - $this->assertEquals("Y-m-d H:i:s.u", $this->_platform->getDateTimeFormatString()); - $this->assertEquals("H:i:s.u", $this->_platform->getTimeFormatString()); - $this->assertEquals('', $this->_platform->getForUpdateSQL()); - $this->assertEquals('NEWID()', $this->_platform->getGuidExpression()); - $this->assertEquals('LOCATE(string_column, substring_column)', $this->_platform->getLocateExpression('string_column', 'substring_column')); - $this->assertEquals('LOCATE(string_column, substring_column, 1)', $this->_platform->getLocateExpression('string_column', 'substring_column', 1)); - $this->assertEquals("HASH(column, 'MD5')", $this->_platform->getMd5Expression('column')); - $this->assertEquals('SUBSTRING(column, 5)', $this->_platform->getSubstringExpression('column', 5)); - $this->assertEquals('SUBSTRING(column, 5, 2)', $this->_platform->getSubstringExpression('column', 5, 2)); - $this->assertEquals('GLOBAL TEMPORARY', $this->_platform->getTemporaryTableSQL()); - $this->assertEquals( + self::assertEquals('CURRENT DATE', $this->_platform->getCurrentDateSQL()); + self::assertEquals('CURRENT TIME', $this->_platform->getCurrentTimeSQL()); + self::assertEquals('CURRENT TIMESTAMP', $this->_platform->getCurrentTimestampSQL()); + self::assertEquals("DATEADD(DAY, 4, '1987/05/02')", $this->_platform->getDateAddDaysExpression("'1987/05/02'", 4)); + self::assertEquals("DATEADD(HOUR, 12, '1987/05/02')", $this->_platform->getDateAddHourExpression("'1987/05/02'", 12)); + self::assertEquals("DATEADD(MINUTE, 2, '1987/05/02')", $this->_platform->getDateAddMinutesExpression("'1987/05/02'", 2)); + self::assertEquals("DATEADD(MONTH, 102, '1987/05/02')", $this->_platform->getDateAddMonthExpression("'1987/05/02'", 102)); + self::assertEquals("DATEADD(QUARTER, 5, '1987/05/02')", $this->_platform->getDateAddQuartersExpression("'1987/05/02'", 5)); + self::assertEquals("DATEADD(SECOND, 1, '1987/05/02')", $this->_platform->getDateAddSecondsExpression("'1987/05/02'", 1)); + self::assertEquals("DATEADD(WEEK, 3, '1987/05/02')", $this->_platform->getDateAddWeeksExpression("'1987/05/02'", 3)); + self::assertEquals("DATEADD(YEAR, 10, '1987/05/02')", $this->_platform->getDateAddYearsExpression("'1987/05/02'", 10)); + self::assertEquals("DATEDIFF(day, '1987/04/01', '1987/05/02')", $this->_platform->getDateDiffExpression("'1987/05/02'", "'1987/04/01'")); + self::assertEquals("DATEADD(DAY, -1 * 4, '1987/05/02')", $this->_platform->getDateSubDaysExpression("'1987/05/02'", 4)); + self::assertEquals("DATEADD(HOUR, -1 * 12, '1987/05/02')", $this->_platform->getDateSubHourExpression("'1987/05/02'", 12)); + self::assertEquals("DATEADD(MINUTE, -1 * 2, '1987/05/02')", $this->_platform->getDateSubMinutesExpression("'1987/05/02'", 2)); + self::assertEquals("DATEADD(MONTH, -1 * 102, '1987/05/02')", $this->_platform->getDateSubMonthExpression("'1987/05/02'", 102)); + self::assertEquals("DATEADD(QUARTER, -1 * 5, '1987/05/02')", $this->_platform->getDateSubQuartersExpression("'1987/05/02'", 5)); + self::assertEquals("DATEADD(SECOND, -1 * 1, '1987/05/02')", $this->_platform->getDateSubSecondsExpression("'1987/05/02'", 1)); + self::assertEquals("DATEADD(WEEK, -1 * 3, '1987/05/02')", $this->_platform->getDateSubWeeksExpression("'1987/05/02'", 3)); + self::assertEquals("DATEADD(YEAR, -1 * 10, '1987/05/02')", $this->_platform->getDateSubYearsExpression("'1987/05/02'", 10)); + self::assertEquals("Y-m-d H:i:s.u", $this->_platform->getDateTimeFormatString()); + self::assertEquals("H:i:s.u", $this->_platform->getTimeFormatString()); + self::assertEquals('', $this->_platform->getForUpdateSQL()); + self::assertEquals('NEWID()', $this->_platform->getGuidExpression()); + self::assertEquals('LOCATE(string_column, substring_column)', $this->_platform->getLocateExpression('string_column', 'substring_column')); + self::assertEquals('LOCATE(string_column, substring_column, 1)', $this->_platform->getLocateExpression('string_column', 'substring_column', 1)); + self::assertEquals("HASH(column, 'MD5')", $this->_platform->getMd5Expression('column')); + self::assertEquals('SUBSTRING(column, 5)', $this->_platform->getSubstringExpression('column', 5)); + self::assertEquals('SUBSTRING(column, 5, 2)', $this->_platform->getSubstringExpression('column', 5, 2)); + self::assertEquals('GLOBAL TEMPORARY', $this->_platform->getTemporaryTableSQL()); + self::assertEquals( 'LTRIM(column)', $this->_platform->getTrimExpression('column', AbstractPlatform::TRIM_LEADING) ); - $this->assertEquals( + self::assertEquals( 'RTRIM(column)', $this->_platform->getTrimExpression('column', AbstractPlatform::TRIM_TRAILING) ); - $this->assertEquals( + self::assertEquals( 'TRIM(column)', $this->_platform->getTrimExpression('column') ); - $this->assertEquals( + self::assertEquals( 'TRIM(column)', $this->_platform->getTrimExpression('column', AbstractPlatform::TRIM_UNSPECIFIED) ); - $this->assertEquals( + self::assertEquals( "SUBSTR(column, PATINDEX('%[^' + c + ']%', column))", $this->_platform->getTrimExpression('column', AbstractPlatform::TRIM_LEADING, 'c') ); - $this->assertEquals( + self::assertEquals( "REVERSE(SUBSTR(REVERSE(column), PATINDEX('%[^' + c + ']%', REVERSE(column))))", $this->_platform->getTrimExpression('column', AbstractPlatform::TRIM_TRAILING, 'c') ); - $this->assertEquals( + self::assertEquals( "REVERSE(SUBSTR(REVERSE(SUBSTR(column, PATINDEX('%[^' + c + ']%', column))), PATINDEX('%[^' + c + ']%', " . "REVERSE(SUBSTR(column, PATINDEX('%[^' + c + ']%', column))))))", $this->_platform->getTrimExpression('column', null, 'c') ); - $this->assertEquals( + self::assertEquals( "REVERSE(SUBSTR(REVERSE(SUBSTR(column, PATINDEX('%[^' + c + ']%', column))), PATINDEX('%[^' + c + ']%', " . "REVERSE(SUBSTR(column, PATINDEX('%[^' + c + ']%', column))))))", $this->_platform->getTrimExpression('column', AbstractPlatform::TRIM_UNSPECIFIED, 'c') @@ -595,12 +595,12 @@ public function testHasCorrectDateTimeTzFormatString() // Date time type with timezone is not supported before version 12. // For versions before we have to ensure that the date time with timezone format // equals the normal date time format so that it corresponds to the declaration SQL equality (datetimetz -> datetime). - $this->assertEquals($this->_platform->getDateTimeFormatString(), $this->_platform->getDateTimeTzFormatString()); + self::assertEquals($this->_platform->getDateTimeFormatString(), $this->_platform->getDateTimeTzFormatString()); } public function testHasCorrectDefaultTransactionIsolationLevel() { - $this->assertEquals( + self::assertEquals( Connection::TRANSACTION_READ_UNCOMMITTED, $this->_platform->getDefaultTransactionIsolationLevel() ); @@ -608,19 +608,19 @@ public function testHasCorrectDefaultTransactionIsolationLevel() public function testGeneratesTransactionsCommands() { - $this->assertEquals( + self::assertEquals( 'SET TEMPORARY OPTION isolation_level = 0', $this->_platform->getSetTransactionIsolationSQL(Connection::TRANSACTION_READ_UNCOMMITTED) ); - $this->assertEquals( + self::assertEquals( 'SET TEMPORARY OPTION isolation_level = 1', $this->_platform->getSetTransactionIsolationSQL(Connection::TRANSACTION_READ_COMMITTED) ); - $this->assertEquals( + self::assertEquals( 'SET TEMPORARY OPTION isolation_level = 2', $this->_platform->getSetTransactionIsolationSQL(Connection::TRANSACTION_REPEATABLE_READ) ); - $this->assertEquals( + self::assertEquals( 'SET TEMPORARY OPTION isolation_level = 3', $this->_platform->getSetTransactionIsolationSQL(Connection::TRANSACTION_SERIALIZABLE) ); @@ -635,7 +635,7 @@ public function testCannotGenerateTransactionCommandWithInvalidIsolationLevel() public function testModifiesLimitQuery() { - $this->assertEquals( + self::assertEquals( 'SELECT TOP 10 * FROM user', $this->_platform->modifyLimitQuery('SELECT * FROM user', 10, 0) ); @@ -643,7 +643,7 @@ public function testModifiesLimitQuery() public function testModifiesLimitQueryWithEmptyOffset() { - $this->assertEquals( + self::assertEquals( 'SELECT TOP 10 * FROM user', $this->_platform->modifyLimitQuery('SELECT * FROM user', 10) ); @@ -651,11 +651,11 @@ public function testModifiesLimitQueryWithEmptyOffset() public function testModifiesLimitQueryWithOffset() { - $this->assertEquals( + self::assertEquals( 'SELECT TOP 10 START AT 6 * FROM user', $this->_platform->modifyLimitQuery('SELECT * FROM user', 10, 5) ); - $this->assertEquals( + self::assertEquals( 'SELECT TOP ALL START AT 6 * FROM user', $this->_platform->modifyLimitQuery('SELECT * FROM user', 0, 5) ); @@ -663,7 +663,7 @@ public function testModifiesLimitQueryWithOffset() public function testModifiesLimitQueryWithSubSelect() { - $this->assertEquals( + self::assertEquals( 'SELECT TOP 10 * FROM (SELECT u.id as uid, u.name as uname FROM user) AS doctrine_tbl', $this->_platform->modifyLimitQuery('SELECT * FROM (SELECT u.id as uid, u.name as uname FROM user) AS doctrine_tbl', 10) ); @@ -671,104 +671,104 @@ public function testModifiesLimitQueryWithSubSelect() public function testPrefersIdentityColumns() { - $this->assertTrue($this->_platform->prefersIdentityColumns()); + self::assertTrue($this->_platform->prefersIdentityColumns()); } public function testDoesNotPreferSequences() { - $this->assertFalse($this->_platform->prefersSequences()); + self::assertFalse($this->_platform->prefersSequences()); } public function testSupportsIdentityColumns() { - $this->assertTrue($this->_platform->supportsIdentityColumns()); + self::assertTrue($this->_platform->supportsIdentityColumns()); } public function testSupportsPrimaryConstraints() { - $this->assertTrue($this->_platform->supportsPrimaryConstraints()); + self::assertTrue($this->_platform->supportsPrimaryConstraints()); } public function testSupportsForeignKeyConstraints() { - $this->assertTrue($this->_platform->supportsForeignKeyConstraints()); + self::assertTrue($this->_platform->supportsForeignKeyConstraints()); } public function testSupportsForeignKeyOnUpdate() { - $this->assertTrue($this->_platform->supportsForeignKeyOnUpdate()); + self::assertTrue($this->_platform->supportsForeignKeyOnUpdate()); } public function testSupportsAlterTable() { - $this->assertTrue($this->_platform->supportsAlterTable()); + self::assertTrue($this->_platform->supportsAlterTable()); } public function testSupportsTransactions() { - $this->assertTrue($this->_platform->supportsTransactions()); + self::assertTrue($this->_platform->supportsTransactions()); } public function testSupportsSchemas() { - $this->assertFalse($this->_platform->supportsSchemas()); + self::assertFalse($this->_platform->supportsSchemas()); } public function testSupportsIndexes() { - $this->assertTrue($this->_platform->supportsIndexes()); + self::assertTrue($this->_platform->supportsIndexes()); } public function testSupportsCommentOnStatement() { - $this->assertTrue($this->_platform->supportsCommentOnStatement()); + self::assertTrue($this->_platform->supportsCommentOnStatement()); } public function testSupportsSavePoints() { - $this->assertTrue($this->_platform->supportsSavepoints()); + self::assertTrue($this->_platform->supportsSavepoints()); } public function testSupportsReleasePoints() { - $this->assertTrue($this->_platform->supportsReleaseSavepoints()); + self::assertTrue($this->_platform->supportsReleaseSavepoints()); } public function testSupportsCreateDropDatabase() { - $this->assertTrue($this->_platform->supportsCreateDropDatabase()); + self::assertTrue($this->_platform->supportsCreateDropDatabase()); } public function testSupportsGettingAffectedRows() { - $this->assertTrue($this->_platform->supportsGettingAffectedRows()); + self::assertTrue($this->_platform->supportsGettingAffectedRows()); } public function testDoesNotSupportSequences() { - $this->assertFalse($this->_platform->supportsSequences()); + self::assertFalse($this->_platform->supportsSequences()); } public function testDoesNotSupportInlineColumnComments() { - $this->assertFalse($this->_platform->supportsInlineColumnComments()); + self::assertFalse($this->_platform->supportsInlineColumnComments()); } public function testCannotEmulateSchemas() { - $this->assertFalse($this->_platform->canEmulateSchemas()); + self::assertFalse($this->_platform->canEmulateSchemas()); } public function testInitializesDoctrineTypeMappings() { - $this->assertTrue($this->_platform->hasDoctrineTypeMappingFor('integer')); - $this->assertSame('integer', $this->_platform->getDoctrineTypeMapping('integer')); + self::assertTrue($this->_platform->hasDoctrineTypeMappingFor('integer')); + self::assertSame('integer', $this->_platform->getDoctrineTypeMapping('integer')); - $this->assertTrue($this->_platform->hasDoctrineTypeMappingFor('binary')); - $this->assertSame('binary', $this->_platform->getDoctrineTypeMapping('binary')); + self::assertTrue($this->_platform->hasDoctrineTypeMappingFor('binary')); + self::assertSame('binary', $this->_platform->getDoctrineTypeMapping('binary')); - $this->assertTrue($this->_platform->hasDoctrineTypeMappingFor('varbinary')); - $this->assertSame('binary', $this->_platform->getDoctrineTypeMapping('varbinary')); + self::assertTrue($this->_platform->hasDoctrineTypeMappingFor('varbinary')); + self::assertSame('binary', $this->_platform->getDoctrineTypeMapping('varbinary')); } protected function getBinaryDefaultLength() @@ -783,15 +783,15 @@ protected function getBinaryMaxLength() public function testReturnsBinaryTypeDeclarationSQL() { - $this->assertSame('VARBINARY(1)', $this->_platform->getBinaryTypeDeclarationSQL(array())); - $this->assertSame('VARBINARY(1)', $this->_platform->getBinaryTypeDeclarationSQL(array('length' => 0))); - $this->assertSame('VARBINARY(32767)', $this->_platform->getBinaryTypeDeclarationSQL(array('length' => 32767))); - $this->assertSame('LONG BINARY', $this->_platform->getBinaryTypeDeclarationSQL(array('length' => 32768))); + self::assertSame('VARBINARY(1)', $this->_platform->getBinaryTypeDeclarationSQL(array())); + self::assertSame('VARBINARY(1)', $this->_platform->getBinaryTypeDeclarationSQL(array('length' => 0))); + self::assertSame('VARBINARY(32767)', $this->_platform->getBinaryTypeDeclarationSQL(array('length' => 32767))); + self::assertSame('LONG BINARY', $this->_platform->getBinaryTypeDeclarationSQL(array('length' => 32768))); - $this->assertSame('BINARY(1)', $this->_platform->getBinaryTypeDeclarationSQL(array('fixed' => true))); - $this->assertSame('BINARY(1)', $this->_platform->getBinaryTypeDeclarationSQL(array('fixed' => true, 'length' => 0))); - $this->assertSame('BINARY(32767)', $this->_platform->getBinaryTypeDeclarationSQL(array('fixed' => true, 'length' => 32767))); - $this->assertSame('LONG BINARY', $this->_platform->getBinaryTypeDeclarationSQL(array('fixed' => true, 'length' => 32768))); + self::assertSame('BINARY(1)', $this->_platform->getBinaryTypeDeclarationSQL(array('fixed' => true))); + self::assertSame('BINARY(1)', $this->_platform->getBinaryTypeDeclarationSQL(array('fixed' => true, 'length' => 0))); + self::assertSame('BINARY(32767)', $this->_platform->getBinaryTypeDeclarationSQL(array('fixed' => true, 'length' => 32767))); + self::assertSame('LONG BINARY', $this->_platform->getBinaryTypeDeclarationSQL(array('fixed' => true, 'length' => 32768))); } /** @@ -867,7 +867,7 @@ protected function getQuotedAlterTableRenameIndexInSchemaSQL() */ public function testReturnsGuidTypeDeclarationSQL() { - $this->assertSame('UNIQUEIDENTIFIER', $this->_platform->getGuidTypeDeclarationSQL(array())); + self::assertSame('UNIQUEIDENTIFIER', $this->_platform->getGuidTypeDeclarationSQL(array())); } /** @@ -920,8 +920,8 @@ public function testAltersTableColumnCommentWithExplicitlyQuotedIdentifiers() $tableDiff = $comparator->diffTable($table1, $table2); - $this->assertInstanceOf('Doctrine\DBAL\Schema\TableDiff', $tableDiff); - $this->assertSame( + self::assertInstanceOf('Doctrine\DBAL\Schema\TableDiff', $tableDiff); + self::assertSame( array( 'COMMENT ON COLUMN "foo"."bar" IS \'baz\'', ), @@ -1001,7 +1001,7 @@ protected function getGeneratesAlterTableRenameIndexUsedByForeignKeySQL() */ public function testQuotesSchemaNameInListTableColumnsSQL() { - $this->assertContains( + self::assertContains( "'Foo''Bar\\'", $this->_platform->getListTableColumnsSQL("Foo'Bar\\.baz_table"), '', @@ -1014,7 +1014,7 @@ public function testQuotesSchemaNameInListTableColumnsSQL() */ public function testQuotesTableNameInListTableConstraintsSQL() { - $this->assertContains("'Foo''Bar\\'", $this->_platform->getListTableConstraintsSQL("Foo'Bar\\"), '', true); + self::assertContains("'Foo''Bar\\'", $this->_platform->getListTableConstraintsSQL("Foo'Bar\\"), '', true); } /** @@ -1022,7 +1022,7 @@ public function testQuotesTableNameInListTableConstraintsSQL() */ public function testQuotesSchemaNameInListTableConstraintsSQL() { - $this->assertContains( + self::assertContains( "'Foo''Bar\\'", $this->_platform->getListTableConstraintsSQL("Foo'Bar\\.baz_table"), '', @@ -1035,7 +1035,7 @@ public function testQuotesSchemaNameInListTableConstraintsSQL() */ public function testQuotesTableNameInListTableForeignKeysSQL() { - $this->assertContains("'Foo''Bar\\'", $this->_platform->getListTableForeignKeysSQL("Foo'Bar\\"), '', true); + self::assertContains("'Foo''Bar\\'", $this->_platform->getListTableForeignKeysSQL("Foo'Bar\\"), '', true); } /** @@ -1043,7 +1043,7 @@ public function testQuotesTableNameInListTableForeignKeysSQL() */ public function testQuotesSchemaNameInListTableForeignKeysSQL() { - $this->assertContains( + self::assertContains( "'Foo''Bar\\'", $this->_platform->getListTableForeignKeysSQL("Foo'Bar\\.baz_table"), '', @@ -1056,7 +1056,7 @@ public function testQuotesSchemaNameInListTableForeignKeysSQL() */ public function testQuotesTableNameInListTableIndexesSQL() { - $this->assertContains("'Foo''Bar\\'", $this->_platform->getListTableIndexesSQL("Foo'Bar\\"), '', true); + self::assertContains("'Foo''Bar\\'", $this->_platform->getListTableIndexesSQL("Foo'Bar\\"), '', true); } /** @@ -1064,7 +1064,7 @@ public function testQuotesTableNameInListTableIndexesSQL() */ public function testQuotesSchemaNameInListTableIndexesSQL() { - $this->assertContains( + self::assertContains( "'Foo''Bar\\'", $this->_platform->getListTableIndexesSQL("Foo'Bar\\.baz_table"), '', diff --git a/tests/Doctrine/Tests/DBAL/Platforms/SQLAzurePlatformTest.php b/tests/Doctrine/Tests/DBAL/Platforms/SQLAzurePlatformTest.php index 194290c0fb2..c5b07b1bc1a 100644 --- a/tests/Doctrine/Tests/DBAL/Platforms/SQLAzurePlatformTest.php +++ b/tests/Doctrine/Tests/DBAL/Platforms/SQLAzurePlatformTest.php @@ -23,7 +23,7 @@ public function testCreateFederatedOnTable() $table->addOption('azure.federatedOnDistributionName', 'TblId'); $table->addOption('azure.federatedOnColumnName', 'id'); - $this->assertEquals(array('CREATE TABLE tbl (id INT NOT NULL) FEDERATED ON (TblId = id)'), $this->platform->getCreateTableSQL($table)); + self::assertEquals(array('CREATE TABLE tbl (id INT NOT NULL) FEDERATED ON (TblId = id)'), $this->platform->getCreateTableSQL($table)); } } diff --git a/tests/Doctrine/Tests/DBAL/Platforms/SQLServer2008PlatformTest.php b/tests/Doctrine/Tests/DBAL/Platforms/SQLServer2008PlatformTest.php index e8ed994d653..5bebbd3196f 100644 --- a/tests/Doctrine/Tests/DBAL/Platforms/SQLServer2008PlatformTest.php +++ b/tests/Doctrine/Tests/DBAL/Platforms/SQLServer2008PlatformTest.php @@ -13,7 +13,7 @@ public function createPlatform() public function testGeneratesTypeDeclarationForDateTimeTz() { - $this->assertEquals( + self::assertEquals( 'DATETIMEOFFSET(6)', $this->_platform->getDateTimeTzTypeDeclarationSQL( array()) diff --git a/tests/Doctrine/Tests/DBAL/Platforms/SQLServer2012PlatformTest.php b/tests/Doctrine/Tests/DBAL/Platforms/SQLServer2012PlatformTest.php index 04e9dae5001..69e0840b629 100644 --- a/tests/Doctrine/Tests/DBAL/Platforms/SQLServer2012PlatformTest.php +++ b/tests/Doctrine/Tests/DBAL/Platforms/SQLServer2012PlatformTest.php @@ -14,30 +14,30 @@ public function createPlatform() public function testSupportsSequences() { - $this->assertTrue($this->_platform->supportsSequences()); + self::assertTrue($this->_platform->supportsSequences()); } public function testDoesNotPreferSequences() { - $this->assertFalse($this->_platform->prefersSequences()); + self::assertFalse($this->_platform->prefersSequences()); } public function testGeneratesSequenceSqlCommands() { $sequence = new Sequence('myseq', 20, 1); - $this->assertEquals( + self::assertEquals( 'CREATE SEQUENCE myseq START WITH 1 INCREMENT BY 20 MINVALUE 1', $this->_platform->getCreateSequenceSQL($sequence) ); - $this->assertEquals( + self::assertEquals( 'ALTER SEQUENCE myseq INCREMENT BY 20', $this->_platform->getAlterSequenceSQL($sequence) ); - $this->assertEquals( + self::assertEquals( 'DROP SEQUENCE myseq', $this->_platform->getDropSequenceSQL('myseq') ); - $this->assertEquals( + self::assertEquals( "SELECT NEXT VALUE FOR myseq", $this->_platform->getSequenceNextValSQL('myseq') ); @@ -47,76 +47,76 @@ public function testGeneratesSequenceSqlCommands() public function testModifyLimitQuery() { $sql = $this->_platform->modifyLimitQuery('SELECT * FROM user', 10, 0); - $this->assertEquals('SELECT * FROM user ORDER BY (SELECT 0) OFFSET 0 ROWS FETCH NEXT 10 ROWS ONLY', $sql); + self::assertEquals('SELECT * FROM user ORDER BY (SELECT 0) OFFSET 0 ROWS FETCH NEXT 10 ROWS ONLY', $sql); } public function testModifyLimitQueryWithEmptyOffset() { $sql = $this->_platform->modifyLimitQuery('SELECT * FROM user', 10); - $this->assertEquals('SELECT * FROM user ORDER BY (SELECT 0) OFFSET 0 ROWS FETCH NEXT 10 ROWS ONLY', $sql); + self::assertEquals('SELECT * FROM user ORDER BY (SELECT 0) OFFSET 0 ROWS FETCH NEXT 10 ROWS ONLY', $sql); } public function testModifyLimitQueryWithOffset() { $sql = $this->_platform->modifyLimitQuery('SELECT * FROM user ORDER BY username DESC', 10, 5); - $this->assertEquals('SELECT * FROM user ORDER BY username DESC OFFSET 5 ROWS FETCH NEXT 10 ROWS ONLY', $sql); + self::assertEquals('SELECT * FROM user ORDER BY username DESC OFFSET 5 ROWS FETCH NEXT 10 ROWS ONLY', $sql); } public function testModifyLimitQueryWithAscOrderBy() { $sql = $this->_platform->modifyLimitQuery('SELECT * FROM user ORDER BY username ASC', 10); - $this->assertEquals('SELECT * FROM user ORDER BY username ASC OFFSET 0 ROWS FETCH NEXT 10 ROWS ONLY', $sql); + self::assertEquals('SELECT * FROM user ORDER BY username ASC OFFSET 0 ROWS FETCH NEXT 10 ROWS ONLY', $sql); } public function testModifyLimitQueryWithLowercaseOrderBy() { $sql = $this->_platform->modifyLimitQuery('SELECT * FROM user order by username', 10); - $this->assertEquals('SELECT * FROM user order by username OFFSET 0 ROWS FETCH NEXT 10 ROWS ONLY', $sql); + self::assertEquals('SELECT * FROM user order by username OFFSET 0 ROWS FETCH NEXT 10 ROWS ONLY', $sql); } public function testModifyLimitQueryWithDescOrderBy() { $sql = $this->_platform->modifyLimitQuery('SELECT * FROM user ORDER BY username DESC', 10); - $this->assertEquals('SELECT * FROM user ORDER BY username DESC OFFSET 0 ROWS FETCH NEXT 10 ROWS ONLY', $sql); + self::assertEquals('SELECT * FROM user ORDER BY username DESC OFFSET 0 ROWS FETCH NEXT 10 ROWS ONLY', $sql); } public function testModifyLimitQueryWithMultipleOrderBy() { $sql = $this->_platform->modifyLimitQuery('SELECT * FROM user ORDER BY username DESC, usereamil ASC', 10); - $this->assertEquals('SELECT * FROM user ORDER BY username DESC, usereamil ASC OFFSET 0 ROWS FETCH NEXT 10 ROWS ONLY', $sql); + self::assertEquals('SELECT * FROM user ORDER BY username DESC, usereamil ASC OFFSET 0 ROWS FETCH NEXT 10 ROWS ONLY', $sql); } public function testModifyLimitQueryWithSubSelect() { $sql = $this->_platform->modifyLimitQuery('SELECT * FROM (SELECT u.id as uid, u.name as uname) dctrn_result', 10); - $this->assertEquals('SELECT * FROM (SELECT u.id as uid, u.name as uname) dctrn_result ORDER BY (SELECT 0) OFFSET 0 ROWS FETCH NEXT 10 ROWS ONLY', $sql); + self::assertEquals('SELECT * FROM (SELECT u.id as uid, u.name as uname) dctrn_result ORDER BY (SELECT 0) OFFSET 0 ROWS FETCH NEXT 10 ROWS ONLY', $sql); } public function testModifyLimitQueryWithSubSelectAndOrder() { $sql = $this->_platform->modifyLimitQuery('SELECT * FROM (SELECT u.id as uid, u.name as uname) dctrn_result ORDER BY uname DESC', 10); - $this->assertEquals('SELECT * FROM (SELECT u.id as uid, u.name as uname) dctrn_result ORDER BY uname DESC OFFSET 0 ROWS FETCH NEXT 10 ROWS ONLY', $sql); + self::assertEquals('SELECT * FROM (SELECT u.id as uid, u.name as uname) dctrn_result ORDER BY uname DESC OFFSET 0 ROWS FETCH NEXT 10 ROWS ONLY', $sql); $sql = $this->_platform->modifyLimitQuery('SELECT * FROM (SELECT u.id, u.name) dctrn_result ORDER BY name DESC', 10); - $this->assertEquals('SELECT * FROM (SELECT u.id, u.name) dctrn_result ORDER BY name DESC OFFSET 0 ROWS FETCH NEXT 10 ROWS ONLY', $sql); + self::assertEquals('SELECT * FROM (SELECT u.id, u.name) dctrn_result ORDER BY name DESC OFFSET 0 ROWS FETCH NEXT 10 ROWS ONLY', $sql); } public function testModifyLimitQueryWithSubSelectAndMultipleOrder() { $sql = $this->_platform->modifyLimitQuery('SELECT * FROM (SELECT u.id as uid, u.name as uname) dctrn_result ORDER BY uname DESC, uid ASC', 10, 5); - $this->assertEquals('SELECT * FROM (SELECT u.id as uid, u.name as uname) dctrn_result ORDER BY uname DESC, uid ASC OFFSET 5 ROWS FETCH NEXT 10 ROWS ONLY', $sql); + self::assertEquals('SELECT * FROM (SELECT u.id as uid, u.name as uname) dctrn_result ORDER BY uname DESC, uid ASC OFFSET 5 ROWS FETCH NEXT 10 ROWS ONLY', $sql); $sql = $this->_platform->modifyLimitQuery('SELECT * FROM (SELECT u.id uid, u.name uname) dctrn_result ORDER BY uname DESC, uid ASC', 10, 5); - $this->assertEquals('SELECT * FROM (SELECT u.id uid, u.name uname) dctrn_result ORDER BY uname DESC, uid ASC OFFSET 5 ROWS FETCH NEXT 10 ROWS ONLY', $sql); + self::assertEquals('SELECT * FROM (SELECT u.id uid, u.name uname) dctrn_result ORDER BY uname DESC, uid ASC OFFSET 5 ROWS FETCH NEXT 10 ROWS ONLY', $sql); $sql = $this->_platform->modifyLimitQuery('SELECT * FROM (SELECT u.id, u.name) dctrn_result ORDER BY name DESC, id ASC', 10, 5); - $this->assertEquals('SELECT * FROM (SELECT u.id, u.name) dctrn_result ORDER BY name DESC, id ASC OFFSET 5 ROWS FETCH NEXT 10 ROWS ONLY', $sql); + self::assertEquals('SELECT * FROM (SELECT u.id, u.name) dctrn_result ORDER BY name DESC, id ASC OFFSET 5 ROWS FETCH NEXT 10 ROWS ONLY', $sql); } public function testModifyLimitQueryWithFromColumnNames() { $sql = $this->_platform->modifyLimitQuery('SELECT a.fromFoo, fromBar FROM foo', 10); - $this->assertEquals('SELECT a.fromFoo, fromBar FROM foo ORDER BY (SELECT 0) OFFSET 0 ROWS FETCH NEXT 10 ROWS ONLY', $sql); + self::assertEquals('SELECT a.fromFoo, fromBar FROM foo ORDER BY (SELECT 0) OFFSET 0 ROWS FETCH NEXT 10 ROWS ONLY', $sql); } /** @@ -138,7 +138,7 @@ public function testModifyLimitQueryWithExtraLongQuery() $expected.= 'ORDER BY (SELECT 0) OFFSET 0 ROWS FETCH NEXT 10 ROWS ONLY'; - $this->assertEquals($expected, $sql); + self::assertEquals($expected, $sql); } /** @@ -150,7 +150,7 @@ public function testModifyLimitQueryWithOrderByClause() $expected = 'SELECT m0_.NOMBRE AS NOMBRE0, m0_.FECHAINICIO AS FECHAINICIO1, m0_.FECHAFIN AS FECHAFIN2 FROM MEDICION m0_ WITH (NOLOCK) INNER JOIN ESTUDIO e1_ ON m0_.ESTUDIO_ID = e1_.ID INNER JOIN CLIENTE c2_ ON e1_.CLIENTE_ID = c2_.ID INNER JOIN USUARIO u3_ ON c2_.ID = u3_.CLIENTE_ID WHERE u3_.ID = ? ORDER BY m0_.FECHAINICIO DESC OFFSET 5 ROWS FETCH NEXT 10 ROWS ONLY'; $actual = $this->_platform->modifyLimitQuery($sql, 10, 5); - $this->assertEquals($expected, $actual); + self::assertEquals($expected, $actual); } /** @@ -169,7 +169,7 @@ public function testModifyLimitQueryWithSubSelectInSelectList() 10 ); - $this->assertEquals( + self::assertEquals( "SELECT " . "u.id, " . @@ -201,7 +201,7 @@ public function testModifyLimitQueryWithSubSelectInSelectListAndOrderByClause() 5 ); - $this->assertEquals( + self::assertEquals( "SELECT " . "u.id, " . "(u.foo/2) foodiv, " . @@ -231,7 +231,7 @@ public function testModifyLimitQueryWithAggregateFunctionInOrderByClause() 0 ); - $this->assertEquals( + self::assertEquals( "SELECT " . "MAX(heading_id) aliased, " . "code " . @@ -249,7 +249,7 @@ public function testModifyLimitQueryWithFromSubquery() $expected = "SELECT DISTINCT id_0 FROM (SELECT k0_.id AS id_0 FROM key_measure k0_ WHERE (k0_.id_zone in(2))) dctrn_result ORDER BY 1 OFFSET 0 ROWS FETCH NEXT 10 ROWS ONLY"; - $this->assertEquals($sql, $expected); + self::assertEquals($sql, $expected); } public function testModifyLimitQueryWithFromSubqueryAndOrder() @@ -258,7 +258,7 @@ public function testModifyLimitQueryWithFromSubqueryAndOrder() $expected = "SELECT DISTINCT id_0, value_1 FROM (SELECT k0_.id AS id_0, k0_.value AS value_1 FROM key_measure k0_ WHERE (k0_.id_zone in(2))) dctrn_result ORDER BY value_1 DESC OFFSET 0 ROWS FETCH NEXT 10 ROWS ONLY"; - $this->assertEquals($sql, $expected); + self::assertEquals($sql, $expected); } public function testModifyLimitQueryWithComplexOrderByExpression() @@ -267,7 +267,7 @@ public function testModifyLimitQueryWithComplexOrderByExpression() $expected = "SELECT * FROM table ORDER BY (table.x * table.y) DESC OFFSET 0 ROWS FETCH NEXT 10 ROWS ONLY"; - $this->assertEquals($sql, $expected); + self::assertEquals($sql, $expected); } @@ -291,7 +291,7 @@ public function testModifyLimitSubqueryWithJoinAndSubqueryOrderedByColumnFromBas . ") dctrn_result " . "ORDER BY id_0 ASC OFFSET 0 ROWS FETCH NEXT 5 ROWS ONLY"; $sql = $this->_platform->modifyLimitQuery($querySql, 5); - $this->assertEquals($alteredSql, $sql); + self::assertEquals($alteredSql, $sql); } /** @@ -314,7 +314,7 @@ public function testModifyLimitSubqueryWithJoinAndSubqueryOrderedByColumnFromJoi . ") dctrn_result " . "ORDER BY name_1 ASC OFFSET 0 ROWS FETCH NEXT 5 ROWS ONLY"; $sql = $this->_platform->modifyLimitQuery($querySql, 5); - $this->assertEquals($alteredSql, $sql); + self::assertEquals($alteredSql, $sql); } /** @@ -337,7 +337,7 @@ public function testModifyLimitSubqueryWithJoinAndSubqueryOrderedByColumnsFromBo . ") dctrn_result " . "ORDER BY name_1 ASC, foo_2 DESC OFFSET 0 ROWS FETCH NEXT 5 ROWS ONLY"; $sql = $this->_platform->modifyLimitQuery($querySql, 5); - $this->assertEquals($alteredSql, $sql); + self::assertEquals($alteredSql, $sql); } public function testModifyLimitSubquerySimple() @@ -348,7 +348,7 @@ public function testModifyLimitSubquerySimple() $alteredSql = "SELECT DISTINCT id_0 FROM (SELECT k0_.id AS id_0, k0_.field AS field_1 " . "FROM key_table k0_ WHERE (k0_.where_field IN (1))) dctrn_result ORDER BY 1 OFFSET 0 ROWS FETCH NEXT 20 ROWS ONLY"; $sql = $this->_platform->modifyLimitQuery($querySql, 20); - $this->assertEquals($alteredSql, $sql); + self::assertEquals($alteredSql, $sql); } public function testModifyLimitQueryWithTopNSubQueryWithOrderBy() @@ -356,12 +356,12 @@ public function testModifyLimitQueryWithTopNSubQueryWithOrderBy() $querySql = 'SELECT * FROM test t WHERE t.id = (SELECT TOP 1 t2.id FROM test t2 ORDER BY t2.data DESC)'; $expectedSql = 'SELECT * FROM test t WHERE t.id = (SELECT TOP 1 t2.id FROM test t2 ORDER BY t2.data DESC) ORDER BY (SELECT 0) OFFSET 0 ROWS FETCH NEXT 10 ROWS ONLY'; $sql = $this->_platform->modifyLimitQuery($querySql, 10); - $this->assertEquals($expectedSql, $sql); + self::assertEquals($expectedSql, $sql); $querySql = 'SELECT * FROM test t WHERE t.id = (SELECT TOP 1 t2.id FROM test t2 ORDER BY t2.data DESC) ORDER BY t.data2 DESC'; $expectedSql = 'SELECT * FROM test t WHERE t.id = (SELECT TOP 1 t2.id FROM test t2 ORDER BY t2.data DESC) ORDER BY t.data2 DESC OFFSET 0 ROWS FETCH NEXT 10 ROWS ONLY'; $sql = $this->_platform->modifyLimitQuery($querySql, 10); - $this->assertEquals($expectedSql, $sql); + self::assertEquals($expectedSql, $sql); } public function testModifyLimitQueryWithNewlineBeforeOrderBy() @@ -369,6 +369,6 @@ public function testModifyLimitQueryWithNewlineBeforeOrderBy() $querySql = "SELECT * FROM test\nORDER BY col DESC"; $expectedSql = "SELECT * FROM test\nORDER BY col DESC OFFSET 0 ROWS FETCH NEXT 10 ROWS ONLY"; $sql = $this->_platform->modifyLimitQuery($querySql, 10); - $this->assertEquals($expectedSql, $sql); + self::assertEquals($expectedSql, $sql); } } diff --git a/tests/Doctrine/Tests/DBAL/Platforms/SQLServerPlatformTest.php b/tests/Doctrine/Tests/DBAL/Platforms/SQLServerPlatformTest.php index d12af29ee72..5a0a0f7712f 100644 --- a/tests/Doctrine/Tests/DBAL/Platforms/SQLServerPlatformTest.php +++ b/tests/Doctrine/Tests/DBAL/Platforms/SQLServerPlatformTest.php @@ -22,7 +22,7 @@ public function testAppendsLockHint($lockMode, $lockHint) $fromClause = 'FROM users'; $expectedResult = $fromClause . $lockHint; - $this->assertSame($expectedResult, $this->_platform->appendLockHint($fromClause, $lockMode)); + self::assertSame($expectedResult, $this->_platform->appendLockHint($fromClause, $lockMode)); } /** @@ -31,7 +31,7 @@ public function testAppendsLockHint($lockMode, $lockHint) */ public function testScrubInnerOrderBy($query, $limit, $offset, $expectedResult) { - $this->assertSame($expectedResult, $this->_platform->modifyLimitQuery($query, $limit, $offset)); + self::assertSame($expectedResult, $this->_platform->modifyLimitQuery($query, $limit, $offset)); } public function getLockHints() diff --git a/tests/Doctrine/Tests/DBAL/Platforms/SqlitePlatformTest.php b/tests/Doctrine/Tests/DBAL/Platforms/SqlitePlatformTest.php index 190a9717903..cb39baefb1a 100644 --- a/tests/Doctrine/Tests/DBAL/Platforms/SqlitePlatformTest.php +++ b/tests/Doctrine/Tests/DBAL/Platforms/SqlitePlatformTest.php @@ -31,26 +31,26 @@ public function getGenerateTableWithMultiColumnUniqueIndexSql() public function testGeneratesSqlSnippets() { - $this->assertEquals('REGEXP', $this->_platform->getRegexpExpression(), 'Regular expression operator is not correct'); - $this->assertEquals('SUBSTR(column, 5, LENGTH(column))', $this->_platform->getSubstringExpression('column', 5), 'Substring expression without length is not correct'); - $this->assertEquals('SUBSTR(column, 0, 5)', $this->_platform->getSubstringExpression('column', 0, 5), 'Substring expression with length is not correct'); + self::assertEquals('REGEXP', $this->_platform->getRegexpExpression(), 'Regular expression operator is not correct'); + self::assertEquals('SUBSTR(column, 5, LENGTH(column))', $this->_platform->getSubstringExpression('column', 5), 'Substring expression without length is not correct'); + self::assertEquals('SUBSTR(column, 0, 5)', $this->_platform->getSubstringExpression('column', 0, 5), 'Substring expression with length is not correct'); } public function testGeneratesTransactionCommands() { - $this->assertEquals( + self::assertEquals( 'PRAGMA read_uncommitted = 0', $this->_platform->getSetTransactionIsolationSQL(\Doctrine\DBAL\Connection::TRANSACTION_READ_UNCOMMITTED) ); - $this->assertEquals( + self::assertEquals( 'PRAGMA read_uncommitted = 1', $this->_platform->getSetTransactionIsolationSQL(\Doctrine\DBAL\Connection::TRANSACTION_READ_COMMITTED) ); - $this->assertEquals( + self::assertEquals( 'PRAGMA read_uncommitted = 1', $this->_platform->getSetTransactionIsolationSQL(\Doctrine\DBAL\Connection::TRANSACTION_REPEATABLE_READ) ); - $this->assertEquals( + self::assertEquals( 'PRAGMA read_uncommitted = 1', $this->_platform->getSetTransactionIsolationSQL(\Doctrine\DBAL\Connection::TRANSACTION_SERIALIZABLE) ); @@ -58,12 +58,12 @@ public function testGeneratesTransactionCommands() public function testPrefersIdentityColumns() { - $this->assertTrue($this->_platform->prefersIdentityColumns()); + self::assertTrue($this->_platform->prefersIdentityColumns()); } public function testIgnoresUnsignedIntegerDeclarationForAutoIncrementalIntegers() { - $this->assertSame( + self::assertSame( 'INTEGER', $this->_platform->getIntegerTypeDeclarationSQL(array('autoincrement' => true, 'unsigned' => true)) ); @@ -75,24 +75,24 @@ public function testIgnoresUnsignedIntegerDeclarationForAutoIncrementalIntegers( */ public function testGeneratesTypeDeclarationForTinyIntegers() { - $this->assertEquals( + self::assertEquals( 'TINYINT', $this->_platform->getTinyIntTypeDeclarationSQL(array()) ); - $this->assertEquals( + self::assertEquals( 'INTEGER', $this->_platform->getTinyIntTypeDeclarationSQL(array('autoincrement' => true)) ); - $this->assertEquals( + self::assertEquals( 'INTEGER', $this->_platform->getTinyIntTypeDeclarationSQL( array('autoincrement' => true, 'primary' => true)) ); - $this->assertEquals( + self::assertEquals( 'TINYINT', $this->_platform->getTinyIntTypeDeclarationSQL(array('unsigned' => false)) ); - $this->assertEquals( + self::assertEquals( 'TINYINT UNSIGNED', $this->_platform->getTinyIntTypeDeclarationSQL(array('unsigned' => true)) ); @@ -104,28 +104,28 @@ public function testGeneratesTypeDeclarationForTinyIntegers() */ public function testGeneratesTypeDeclarationForSmallIntegers() { - $this->assertEquals( + self::assertEquals( 'SMALLINT', $this->_platform->getSmallIntTypeDeclarationSQL(array()) ); - $this->assertEquals( + self::assertEquals( 'INTEGER', $this->_platform->getSmallIntTypeDeclarationSQL(array('autoincrement' => true)) ); - $this->assertEquals( + self::assertEquals( 'INTEGER', $this->_platform->getTinyIntTypeDeclarationSQL(array('autoincrement' => true, 'unsigned' => true)) ); - $this->assertEquals( + self::assertEquals( 'INTEGER', $this->_platform->getSmallIntTypeDeclarationSQL( array('autoincrement' => true, 'primary' => true)) ); - $this->assertEquals( + self::assertEquals( 'SMALLINT', $this->_platform->getSmallIntTypeDeclarationSQL(array('unsigned' => false)) ); - $this->assertEquals( + self::assertEquals( 'SMALLINT UNSIGNED', $this->_platform->getSmallIntTypeDeclarationSQL(array('unsigned' => true)) ); @@ -137,28 +137,28 @@ public function testGeneratesTypeDeclarationForSmallIntegers() */ public function testGeneratesTypeDeclarationForMediumIntegers() { - $this->assertEquals( + self::assertEquals( 'MEDIUMINT', $this->_platform->getMediumIntTypeDeclarationSQL(array()) ); - $this->assertEquals( + self::assertEquals( 'INTEGER', $this->_platform->getMediumIntTypeDeclarationSQL(array('autoincrement' => true)) ); - $this->assertEquals( + self::assertEquals( 'INTEGER', $this->_platform->getMediumIntTypeDeclarationSQL(array('autoincrement' => true, 'unsigned' => true)) ); - $this->assertEquals( + self::assertEquals( 'INTEGER', $this->_platform->getMediumIntTypeDeclarationSQL( array('autoincrement' => true, 'primary' => true)) ); - $this->assertEquals( + self::assertEquals( 'MEDIUMINT', $this->_platform->getMediumIntTypeDeclarationSQL(array('unsigned' => false)) ); - $this->assertEquals( + self::assertEquals( 'MEDIUMINT UNSIGNED', $this->_platform->getMediumIntTypeDeclarationSQL(array('unsigned' => true)) ); @@ -166,28 +166,28 @@ public function testGeneratesTypeDeclarationForMediumIntegers() public function testGeneratesTypeDeclarationForIntegers() { - $this->assertEquals( + self::assertEquals( 'INTEGER', $this->_platform->getIntegerTypeDeclarationSQL(array()) ); - $this->assertEquals( + self::assertEquals( 'INTEGER', $this->_platform->getIntegerTypeDeclarationSQL(array('autoincrement' => true)) ); - $this->assertEquals( + self::assertEquals( 'INTEGER', $this->_platform->getIntegerTypeDeclarationSQL(array('autoincrement' => true, 'unsigned' => true)) ); - $this->assertEquals( + self::assertEquals( 'INTEGER', $this->_platform->getIntegerTypeDeclarationSQL( array('autoincrement' => true, 'primary' => true)) ); - $this->assertEquals( + self::assertEquals( 'INTEGER', $this->_platform->getIntegerTypeDeclarationSQL(array('unsigned' => false)) ); - $this->assertEquals( + self::assertEquals( 'INTEGER UNSIGNED', $this->_platform->getIntegerTypeDeclarationSQL(array('unsigned' => true)) ); @@ -199,28 +199,28 @@ public function testGeneratesTypeDeclarationForIntegers() */ public function testGeneratesTypeDeclarationForBigIntegers() { - $this->assertEquals( + self::assertEquals( 'BIGINT', $this->_platform->getBigIntTypeDeclarationSQL(array()) ); - $this->assertEquals( + self::assertEquals( 'INTEGER', $this->_platform->getBigIntTypeDeclarationSQL(array('autoincrement' => true)) ); - $this->assertEquals( + self::assertEquals( 'INTEGER', $this->_platform->getBigIntTypeDeclarationSQL(array('autoincrement' => true, 'unsigned' => true)) ); - $this->assertEquals( + self::assertEquals( 'INTEGER', $this->_platform->getBigIntTypeDeclarationSQL( array('autoincrement' => true, 'primary' => true)) ); - $this->assertEquals( + self::assertEquals( 'BIGINT', $this->_platform->getBigIntTypeDeclarationSQL(array('unsigned' => false)) ); - $this->assertEquals( + self::assertEquals( 'BIGINT UNSIGNED', $this->_platform->getBigIntTypeDeclarationSQL(array('unsigned' => true)) ); @@ -228,17 +228,17 @@ public function testGeneratesTypeDeclarationForBigIntegers() public function testGeneratesTypeDeclarationForStrings() { - $this->assertEquals( + self::assertEquals( 'CHAR(10)', $this->_platform->getVarcharTypeDeclarationSQL( array('length' => 10, 'fixed' => true)) ); - $this->assertEquals( + self::assertEquals( 'VARCHAR(50)', $this->_platform->getVarcharTypeDeclarationSQL(array('length' => 50)), 'Variable string declaration is not correct' ); - $this->assertEquals( + self::assertEquals( 'VARCHAR(255)', $this->_platform->getVarcharTypeDeclarationSQL(array()), 'Long string declaration is not correct' @@ -279,19 +279,19 @@ public function getGenerateForeignKeySql() public function testModifyLimitQuery() { $sql = $this->_platform->modifyLimitQuery('SELECT * FROM user', 10, 0); - $this->assertEquals('SELECT * FROM user LIMIT 10 OFFSET 0', $sql); + self::assertEquals('SELECT * FROM user LIMIT 10 OFFSET 0', $sql); } public function testModifyLimitQueryWithEmptyOffset() { $sql = $this->_platform->modifyLimitQuery('SELECT * FROM user', 10); - $this->assertEquals('SELECT * FROM user LIMIT 10', $sql); + self::assertEquals('SELECT * FROM user LIMIT 10', $sql); } public function testModifyLimitQueryWithOffsetAndEmptyLimit() { $sql = $this->_platform->modifyLimitQuery('SELECT * FROM user', null, 10); - $this->assertEquals('SELECT * FROM user LIMIT -1 OFFSET 10', $sql); + self::assertEquals('SELECT * FROM user LIMIT -1 OFFSET 10', $sql); } public function getGenerateAlterTableSql() @@ -316,7 +316,7 @@ public function testGenerateTableSqlShouldNotAutoQuotePrimaryKey() $table->setPrimaryKey(array('"like"')); $createTableSQL = $this->_platform->getCreateTableSQL($table); - $this->assertEquals( + self::assertEquals( 'CREATE TABLE test ("like" INTEGER NOT NULL, PRIMARY KEY("like"))', $createTableSQL[0] ); @@ -333,7 +333,7 @@ public function testAlterTableAddColumns() 'ALTER TABLE user ADD COLUMN count INTEGER DEFAULT 1', ); - $this->assertEquals($expected, $this->_platform->getAlterTableSQL($diff)); + self::assertEquals($expected, $this->_platform->getAlterTableSQL($diff)); } /** @@ -386,7 +386,7 @@ public function testCreateTableWithDeferredForeignKeys() 'CREATE INDEX IDX_8D93D6493D8E604F ON user (parent)', ); - $this->assertEquals($sql, $this->_platform->getCreateTableSQL($table)); + self::assertEquals($sql, $this->_platform->getCreateTableSQL($table)); } public function testAlterTable() @@ -430,7 +430,7 @@ public function testAlterTable() 'CREATE INDEX IDX_8D93D6495A8A6C8D ON client (comment)', ); - $this->assertEquals($sql, $this->_platform->getAlterTableSQL($diff)); + self::assertEquals($sql, $this->_platform->getAlterTableSQL($diff)); } protected function getQuotedColumnInPrimaryKeySQL() @@ -479,13 +479,13 @@ protected function getBinaryMaxLength() public function testReturnsBinaryTypeDeclarationSQL() { - $this->assertSame('BLOB', $this->_platform->getBinaryTypeDeclarationSQL(array())); - $this->assertSame('BLOB', $this->_platform->getBinaryTypeDeclarationSQL(array('length' => 0))); - $this->assertSame('BLOB', $this->_platform->getBinaryTypeDeclarationSQL(array('length' => 9999999))); + self::assertSame('BLOB', $this->_platform->getBinaryTypeDeclarationSQL(array())); + self::assertSame('BLOB', $this->_platform->getBinaryTypeDeclarationSQL(array('length' => 0))); + self::assertSame('BLOB', $this->_platform->getBinaryTypeDeclarationSQL(array('length' => 9999999))); - $this->assertSame('BLOB', $this->_platform->getBinaryTypeDeclarationSQL(array('fixed' => true))); - $this->assertSame('BLOB', $this->_platform->getBinaryTypeDeclarationSQL(array('fixed' => true, 'length' => 0))); - $this->assertSame('BLOB', $this->_platform->getBinaryTypeDeclarationSQL(array('fixed' => true, 'length' => 9999999))); + self::assertSame('BLOB', $this->_platform->getBinaryTypeDeclarationSQL(array('fixed' => true))); + self::assertSame('BLOB', $this->_platform->getBinaryTypeDeclarationSQL(array('fixed' => true, 'length' => 0))); + self::assertSame('BLOB', $this->_platform->getBinaryTypeDeclarationSQL(array('fixed' => true, 'length' => 9999999))); } /** @@ -589,7 +589,7 @@ public function testQuotesAlterTableRenameIndexInSchema() */ public function testReturnsGuidTypeDeclarationSQL() { - $this->assertSame('CHAR(36)', $this->_platform->getGuidTypeDeclarationSQL(array())); + self::assertSame('CHAR(36)', $this->_platform->getGuidTypeDeclarationSQL(array())); } /** @@ -722,7 +722,7 @@ protected function getGeneratesAlterTableRenameIndexUsedByForeignKeySQL() */ public function testQuotesTableNameInListTableConstraintsSQL() { - $this->assertContains("'Foo''Bar\\'", $this->_platform->getListTableConstraintsSQL("Foo'Bar\\"), '', true); + self::assertContains("'Foo''Bar\\'", $this->_platform->getListTableConstraintsSQL("Foo'Bar\\"), '', true); } /** @@ -730,7 +730,7 @@ public function testQuotesTableNameInListTableConstraintsSQL() */ public function testQuotesTableNameInListTableColumnsSQL() { - $this->assertContains("'Foo''Bar\\'", $this->_platform->getListTableColumnsSQL("Foo'Bar\\"), '', true); + self::assertContains("'Foo''Bar\\'", $this->_platform->getListTableColumnsSQL("Foo'Bar\\"), '', true); } /** @@ -738,7 +738,7 @@ public function testQuotesTableNameInListTableColumnsSQL() */ public function testQuotesTableNameInListTableIndexesSQL() { - $this->assertContains("'Foo''Bar\\'", $this->_platform->getListTableIndexesSQL("Foo'Bar\\"), '', true); + self::assertContains("'Foo''Bar\\'", $this->_platform->getListTableIndexesSQL("Foo'Bar\\"), '', true); } /** @@ -746,6 +746,6 @@ public function testQuotesTableNameInListTableIndexesSQL() */ public function testQuotesTableNameInListTableForeignKeysSQL() { - $this->assertContains("'Foo''Bar\\'", $this->_platform->getListTableForeignKeysSQL("Foo'Bar\\"), '', true); + self::assertContains("'Foo''Bar\\'", $this->_platform->getListTableForeignKeysSQL("Foo'Bar\\"), '', true); } } diff --git a/tests/Doctrine/Tests/DBAL/Portability/StatementTest.php b/tests/Doctrine/Tests/DBAL/Portability/StatementTest.php index 27451fbdce9..e369aab9286 100644 --- a/tests/Doctrine/Tests/DBAL/Portability/StatementTest.php +++ b/tests/Doctrine/Tests/DBAL/Portability/StatementTest.php @@ -47,7 +47,7 @@ public function testBindParam() ->with($column, $variable, $type, $length) ->will($this->returnValue(true)); - $this->assertTrue($this->stmt->bindParam($column, $variable, $type, $length)); + self::assertTrue($this->stmt->bindParam($column, $variable, $type, $length)); } public function testBindValue() @@ -61,7 +61,7 @@ public function testBindValue() ->with($param, $value, $type) ->will($this->returnValue(true)); - $this->assertTrue($this->stmt->bindValue($param, $value, $type)); + self::assertTrue($this->stmt->bindValue($param, $value, $type)); } public function testCloseCursor() @@ -70,7 +70,7 @@ public function testCloseCursor() ->method('closeCursor') ->will($this->returnValue(true)); - $this->assertTrue($this->stmt->closeCursor()); + self::assertTrue($this->stmt->closeCursor()); } public function testColumnCount() @@ -81,7 +81,7 @@ public function testColumnCount() ->method('columnCount') ->will($this->returnValue($columnCount)); - $this->assertSame($columnCount, $this->stmt->columnCount()); + self::assertSame($columnCount, $this->stmt->columnCount()); } public function testErrorCode() @@ -92,7 +92,7 @@ public function testErrorCode() ->method('errorCode') ->will($this->returnValue($errorCode)); - $this->assertSame($errorCode, $this->stmt->errorCode()); + self::assertSame($errorCode, $this->stmt->errorCode()); } public function testErrorInfo() @@ -103,7 +103,7 @@ public function testErrorInfo() ->method('errorInfo') ->will($this->returnValue($errorInfo)); - $this->assertSame($errorInfo, $this->stmt->errorInfo()); + self::assertSame($errorInfo, $this->stmt->errorInfo()); } public function testExecute() @@ -118,7 +118,7 @@ public function testExecute() ->with($params) ->will($this->returnValue(true)); - $this->assertTrue($this->stmt->execute($params)); + self::assertTrue($this->stmt->execute($params)); } public function testSetFetchMode() @@ -132,9 +132,9 @@ public function testSetFetchMode() ->with($fetchMode, $arg1, $arg2) ->will($this->returnValue(true)); - $this->assertAttributeSame(\PDO::FETCH_BOTH, 'defaultFetchMode', $this->stmt); - $this->assertTrue($this->stmt->setFetchMode($fetchMode, $arg1, $arg2)); - $this->assertAttributeSame($fetchMode, 'defaultFetchMode', $this->stmt); + self::assertAttributeSame(\PDO::FETCH_BOTH, 'defaultFetchMode', $this->stmt); + self::assertTrue($this->stmt->setFetchMode($fetchMode, $arg1, $arg2)); + self::assertAttributeSame($fetchMode, 'defaultFetchMode', $this->stmt); } public function testGetIterator() @@ -148,7 +148,7 @@ public function testGetIterator() ->method('fetchAll') ->will($this->returnValue($data)); - $this->assertEquals(new \ArrayIterator($data), $this->stmt->getIterator()); + self::assertEquals(new \ArrayIterator($data), $this->stmt->getIterator()); } public function testRowCount() @@ -159,7 +159,7 @@ public function testRowCount() ->method('rowCount') ->will($this->returnValue($rowCount)); - $this->assertSame($rowCount, $this->stmt->rowCount()); + self::assertSame($rowCount, $this->stmt->rowCount()); } /** diff --git a/tests/Doctrine/Tests/DBAL/Query/Expression/CompositeExpressionTest.php b/tests/Doctrine/Tests/DBAL/Query/Expression/CompositeExpressionTest.php index 571ed5642de..1a76730bfef 100644 --- a/tests/Doctrine/Tests/DBAL/Query/Expression/CompositeExpressionTest.php +++ b/tests/Doctrine/Tests/DBAL/Query/Expression/CompositeExpressionTest.php @@ -13,34 +13,34 @@ public function testCount() { $expr = new CompositeExpression(CompositeExpression::TYPE_OR, array('u.group_id = 1')); - $this->assertEquals(1, count($expr)); + self::assertEquals(1, count($expr)); $expr->add('u.group_id = 2'); - $this->assertEquals(2, count($expr)); + self::assertEquals(2, count($expr)); } public function testAdd() { $expr = new CompositeExpression(CompositeExpression::TYPE_OR, array('u.group_id = 1')); - $this->assertCount(1, $expr); + self::assertCount(1, $expr); $expr->add(new CompositeExpression(CompositeExpression::TYPE_AND, array())); - $this->assertCount(1, $expr); + self::assertCount(1, $expr); $expr->add(new CompositeExpression(CompositeExpression::TYPE_OR, array('u.user_id = 1'))); - $this->assertCount(2, $expr); + self::assertCount(2, $expr); $expr->add(null); - $this->assertCount(2, $expr); + self::assertCount(2, $expr); $expr->add('u.user_id = 1'); - $this->assertCount(3, $expr); + self::assertCount(3, $expr); } /** @@ -50,7 +50,7 @@ public function testCompositeUsageAndGeneration($type, $parts, $expects) { $expr = new CompositeExpression($type, $parts); - $this->assertEquals($expects, (string) $expr); + self::assertEquals($expects, (string) $expr); } public function provideDataForConvertToString() @@ -100,4 +100,4 @@ public function provideDataForConvertToString() ), ); } -} \ No newline at end of file +} diff --git a/tests/Doctrine/Tests/DBAL/Query/Expression/ExpressionBuilderTest.php b/tests/Doctrine/Tests/DBAL/Query/Expression/ExpressionBuilderTest.php index 23f898efbeb..61cf87df1c8 100644 --- a/tests/Doctrine/Tests/DBAL/Query/Expression/ExpressionBuilderTest.php +++ b/tests/Doctrine/Tests/DBAL/Query/Expression/ExpressionBuilderTest.php @@ -34,7 +34,7 @@ public function testAndX($parts, $expected) $composite->add($part); } - $this->assertEquals($expected, (string) $composite); + self::assertEquals($expected, (string) $composite); } public function provideDataForAndX() @@ -90,7 +90,7 @@ public function testOrX($parts, $expected) $composite->add($part); } - $this->assertEquals($expected, (string) $composite); + self::assertEquals($expected, (string) $composite); } public function provideDataForOrX() @@ -142,7 +142,7 @@ public function testComparison($leftExpr, $operator, $rightExpr, $expected) { $part = $this->expr->comparison($leftExpr, $operator, $rightExpr); - $this->assertEquals($expected, (string) $part); + self::assertEquals($expected, (string) $part); } public function provideDataForComparison() @@ -159,61 +159,61 @@ public function provideDataForComparison() public function testEq() { - $this->assertEquals('u.user_id = 1', $this->expr->eq('u.user_id', '1')); + self::assertEquals('u.user_id = 1', $this->expr->eq('u.user_id', '1')); } public function testNeq() { - $this->assertEquals('u.user_id <> 1', $this->expr->neq('u.user_id', '1')); + self::assertEquals('u.user_id <> 1', $this->expr->neq('u.user_id', '1')); } public function testLt() { - $this->assertEquals('u.salary < 10000', $this->expr->lt('u.salary', '10000')); + self::assertEquals('u.salary < 10000', $this->expr->lt('u.salary', '10000')); } public function testLte() { - $this->assertEquals('u.salary <= 10000', $this->expr->lte('u.salary', '10000')); + self::assertEquals('u.salary <= 10000', $this->expr->lte('u.salary', '10000')); } public function testGt() { - $this->assertEquals('u.salary > 10000', $this->expr->gt('u.salary', '10000')); + self::assertEquals('u.salary > 10000', $this->expr->gt('u.salary', '10000')); } public function testGte() { - $this->assertEquals('u.salary >= 10000', $this->expr->gte('u.salary', '10000')); + self::assertEquals('u.salary >= 10000', $this->expr->gte('u.salary', '10000')); } public function testIsNull() { - $this->assertEquals('u.deleted IS NULL', $this->expr->isNull('u.deleted')); + self::assertEquals('u.deleted IS NULL', $this->expr->isNull('u.deleted')); } public function testIsNotNull() { - $this->assertEquals('u.updated IS NOT NULL', $this->expr->isNotNull('u.updated')); + self::assertEquals('u.updated IS NOT NULL', $this->expr->isNotNull('u.updated')); } public function testIn() { - $this->assertEquals('u.groups IN (1, 3, 4, 7)', $this->expr->in('u.groups', array(1,3,4,7))); + self::assertEquals('u.groups IN (1, 3, 4, 7)', $this->expr->in('u.groups', array(1,3,4,7))); } public function testInWithPlaceholder() { - $this->assertEquals('u.groups IN (?)', $this->expr->in('u.groups', '?')); + self::assertEquals('u.groups IN (?)', $this->expr->in('u.groups', '?')); } public function testNotIn() { - $this->assertEquals('u.groups NOT IN (1, 3, 4, 7)', $this->expr->notIn('u.groups', array(1,3,4,7))); + self::assertEquals('u.groups NOT IN (1, 3, 4, 7)', $this->expr->notIn('u.groups', array(1,3,4,7))); } public function testNotInWithPlaceholder() { - $this->assertEquals('u.groups NOT IN (:values)', $this->expr->notIn('u.groups', ':values')); + self::assertEquals('u.groups NOT IN (:values)', $this->expr->notIn('u.groups', ':values')); } } diff --git a/tests/Doctrine/Tests/DBAL/Query/QueryBuilderTest.php b/tests/Doctrine/Tests/DBAL/Query/QueryBuilderTest.php index 0569d4fd696..2634dc5660b 100644 --- a/tests/Doctrine/Tests/DBAL/Query/QueryBuilderTest.php +++ b/tests/Doctrine/Tests/DBAL/Query/QueryBuilderTest.php @@ -32,7 +32,7 @@ public function testSimpleSelectWithoutFrom() $qb->select('some_function()'); - $this->assertEquals('SELECT some_function()', (string) $qb); + self::assertEquals('SELECT some_function()', (string) $qb); } public function testSimpleSelect() @@ -42,7 +42,7 @@ public function testSimpleSelect() $qb->select('u.id') ->from('users', 'u'); - $this->assertEquals('SELECT u.id FROM users u', (string) $qb); + self::assertEquals('SELECT u.id FROM users u', (string) $qb); } public function testSelectWithSimpleWhere() @@ -54,7 +54,7 @@ public function testSelectWithSimpleWhere() ->from('users', 'u') ->where($expr->andX($expr->eq('u.nickname', '?'))); - $this->assertEquals("SELECT u.id FROM users u WHERE u.nickname = ?", (string) $qb); + self::assertEquals("SELECT u.id FROM users u WHERE u.nickname = ?", (string) $qb); } public function testSelectWithLeftJoin() @@ -66,7 +66,7 @@ public function testSelectWithLeftJoin() ->from('users', 'u') ->leftJoin('u', 'phones', 'p', $expr->eq('p.user_id', 'u.id')); - $this->assertEquals('SELECT u.*, p.* FROM users u LEFT JOIN phones p ON p.user_id = u.id', (string) $qb); + self::assertEquals('SELECT u.*, p.* FROM users u LEFT JOIN phones p ON p.user_id = u.id', (string) $qb); } public function testSelectWithJoin() @@ -78,7 +78,7 @@ public function testSelectWithJoin() ->from('users', 'u') ->Join('u', 'phones', 'p', $expr->eq('p.user_id', 'u.id')); - $this->assertEquals('SELECT u.*, p.* FROM users u INNER JOIN phones p ON p.user_id = u.id', (string) $qb); + self::assertEquals('SELECT u.*, p.* FROM users u INNER JOIN phones p ON p.user_id = u.id', (string) $qb); } public function testSelectWithInnerJoin() @@ -90,7 +90,7 @@ public function testSelectWithInnerJoin() ->from('users', 'u') ->innerJoin('u', 'phones', 'p', $expr->eq('p.user_id', 'u.id')); - $this->assertEquals('SELECT u.*, p.* FROM users u INNER JOIN phones p ON p.user_id = u.id', (string) $qb); + self::assertEquals('SELECT u.*, p.* FROM users u INNER JOIN phones p ON p.user_id = u.id', (string) $qb); } public function testSelectWithRightJoin() @@ -102,7 +102,7 @@ public function testSelectWithRightJoin() ->from('users', 'u') ->rightJoin('u', 'phones', 'p', $expr->eq('p.user_id', 'u.id')); - $this->assertEquals('SELECT u.*, p.* FROM users u RIGHT JOIN phones p ON p.user_id = u.id', (string) $qb); + self::assertEquals('SELECT u.*, p.* FROM users u RIGHT JOIN phones p ON p.user_id = u.id', (string) $qb); } public function testSelectWithAndWhereConditions() @@ -115,7 +115,7 @@ public function testSelectWithAndWhereConditions() ->where('u.username = ?') ->andWhere('u.name = ?'); - $this->assertEquals('SELECT u.*, p.* FROM users u WHERE (u.username = ?) AND (u.name = ?)', (string) $qb); + self::assertEquals('SELECT u.*, p.* FROM users u WHERE (u.username = ?) AND (u.name = ?)', (string) $qb); } public function testSelectWithOrWhereConditions() @@ -128,7 +128,7 @@ public function testSelectWithOrWhereConditions() ->where('u.username = ?') ->orWhere('u.name = ?'); - $this->assertEquals('SELECT u.*, p.* FROM users u WHERE (u.username = ?) OR (u.name = ?)', (string) $qb); + self::assertEquals('SELECT u.*, p.* FROM users u WHERE (u.username = ?) OR (u.name = ?)', (string) $qb); } public function testSelectWithOrOrWhereConditions() @@ -141,7 +141,7 @@ public function testSelectWithOrOrWhereConditions() ->orWhere('u.username = ?') ->orWhere('u.name = ?'); - $this->assertEquals('SELECT u.*, p.* FROM users u WHERE (u.username = ?) OR (u.name = ?)', (string) $qb); + self::assertEquals('SELECT u.*, p.* FROM users u WHERE (u.username = ?) OR (u.name = ?)', (string) $qb); } public function testSelectWithAndOrWhereConditions() @@ -156,7 +156,7 @@ public function testSelectWithAndOrWhereConditions() ->orWhere('u.name = ?') ->andWhere('u.name = ?'); - $this->assertEquals('SELECT u.*, p.* FROM users u WHERE (((u.username = ?) AND (u.username = ?)) OR (u.name = ?)) AND (u.name = ?)', (string) $qb); + self::assertEquals('SELECT u.*, p.* FROM users u WHERE (((u.username = ?) AND (u.username = ?)) OR (u.name = ?)) AND (u.name = ?)', (string) $qb); } public function testSelectGroupBy() @@ -168,7 +168,7 @@ public function testSelectGroupBy() ->from('users', 'u') ->groupBy('u.id'); - $this->assertEquals('SELECT u.*, p.* FROM users u GROUP BY u.id', (string) $qb); + self::assertEquals('SELECT u.*, p.* FROM users u GROUP BY u.id', (string) $qb); } public function testSelectEmptyGroupBy() @@ -180,7 +180,7 @@ public function testSelectEmptyGroupBy() ->groupBy(array()) ->from('users', 'u'); - $this->assertEquals('SELECT u.*, p.* FROM users u', (string) $qb); + self::assertEquals('SELECT u.*, p.* FROM users u', (string) $qb); } public function testSelectEmptyAddGroupBy() @@ -192,7 +192,7 @@ public function testSelectEmptyAddGroupBy() ->addGroupBy(array()) ->from('users', 'u'); - $this->assertEquals('SELECT u.*, p.* FROM users u', (string) $qb); + self::assertEquals('SELECT u.*, p.* FROM users u', (string) $qb); } public function testSelectAddGroupBy() @@ -205,7 +205,7 @@ public function testSelectAddGroupBy() ->groupBy('u.id') ->addGroupBy('u.foo'); - $this->assertEquals('SELECT u.*, p.* FROM users u GROUP BY u.id, u.foo', (string) $qb); + self::assertEquals('SELECT u.*, p.* FROM users u GROUP BY u.id, u.foo', (string) $qb); } public function testSelectAddGroupBys() @@ -218,7 +218,7 @@ public function testSelectAddGroupBys() ->groupBy('u.id') ->addGroupBy('u.foo', 'u.bar'); - $this->assertEquals('SELECT u.*, p.* FROM users u GROUP BY u.id, u.foo, u.bar', (string) $qb); + self::assertEquals('SELECT u.*, p.* FROM users u GROUP BY u.id, u.foo, u.bar', (string) $qb); } public function testSelectHaving() @@ -231,7 +231,7 @@ public function testSelectHaving() ->groupBy('u.id') ->having('u.name = ?'); - $this->assertEquals('SELECT u.*, p.* FROM users u GROUP BY u.id HAVING u.name = ?', (string) $qb); + self::assertEquals('SELECT u.*, p.* FROM users u GROUP BY u.id HAVING u.name = ?', (string) $qb); } public function testSelectAndHaving() @@ -244,7 +244,7 @@ public function testSelectAndHaving() ->groupBy('u.id') ->andHaving('u.name = ?'); - $this->assertEquals('SELECT u.*, p.* FROM users u GROUP BY u.id HAVING u.name = ?', (string) $qb); + self::assertEquals('SELECT u.*, p.* FROM users u GROUP BY u.id HAVING u.name = ?', (string) $qb); } public function testSelectHavingAndHaving() @@ -258,7 +258,7 @@ public function testSelectHavingAndHaving() ->having('u.name = ?') ->andHaving('u.username = ?'); - $this->assertEquals('SELECT u.*, p.* FROM users u GROUP BY u.id HAVING (u.name = ?) AND (u.username = ?)', (string) $qb); + self::assertEquals('SELECT u.*, p.* FROM users u GROUP BY u.id HAVING (u.name = ?) AND (u.username = ?)', (string) $qb); } public function testSelectHavingOrHaving() @@ -272,7 +272,7 @@ public function testSelectHavingOrHaving() ->having('u.name = ?') ->orHaving('u.username = ?'); - $this->assertEquals('SELECT u.*, p.* FROM users u GROUP BY u.id HAVING (u.name = ?) OR (u.username = ?)', (string) $qb); + self::assertEquals('SELECT u.*, p.* FROM users u GROUP BY u.id HAVING (u.name = ?) OR (u.username = ?)', (string) $qb); } public function testSelectOrHavingOrHaving() @@ -286,7 +286,7 @@ public function testSelectOrHavingOrHaving() ->orHaving('u.name = ?') ->orHaving('u.username = ?'); - $this->assertEquals('SELECT u.*, p.* FROM users u GROUP BY u.id HAVING (u.name = ?) OR (u.username = ?)', (string) $qb); + self::assertEquals('SELECT u.*, p.* FROM users u GROUP BY u.id HAVING (u.name = ?) OR (u.username = ?)', (string) $qb); } public function testSelectHavingAndOrHaving() @@ -301,7 +301,7 @@ public function testSelectHavingAndOrHaving() ->orHaving('u.username = ?') ->andHaving('u.username = ?'); - $this->assertEquals('SELECT u.*, p.* FROM users u GROUP BY u.id HAVING ((u.name = ?) OR (u.username = ?)) AND (u.username = ?)', (string) $qb); + self::assertEquals('SELECT u.*, p.* FROM users u GROUP BY u.id HAVING ((u.name = ?) OR (u.username = ?)) AND (u.username = ?)', (string) $qb); } public function testSelectOrderBy() @@ -313,7 +313,7 @@ public function testSelectOrderBy() ->from('users', 'u') ->orderBy('u.name'); - $this->assertEquals('SELECT u.*, p.* FROM users u ORDER BY u.name ASC', (string) $qb); + self::assertEquals('SELECT u.*, p.* FROM users u ORDER BY u.name ASC', (string) $qb); } public function testSelectAddOrderBy() @@ -326,7 +326,7 @@ public function testSelectAddOrderBy() ->orderBy('u.name') ->addOrderBy('u.username', 'DESC'); - $this->assertEquals('SELECT u.*, p.* FROM users u ORDER BY u.name ASC, u.username DESC', (string) $qb); + self::assertEquals('SELECT u.*, p.* FROM users u ORDER BY u.name ASC, u.username DESC', (string) $qb); } public function testSelectAddAddOrderBy() @@ -339,7 +339,7 @@ public function testSelectAddAddOrderBy() ->addOrderBy('u.name') ->addOrderBy('u.username', 'DESC'); - $this->assertEquals('SELECT u.*, p.* FROM users u ORDER BY u.name ASC, u.username DESC', (string) $qb); + self::assertEquals('SELECT u.*, p.* FROM users u ORDER BY u.name ASC, u.username DESC', (string) $qb); } public function testEmptySelect() @@ -347,8 +347,8 @@ public function testEmptySelect() $qb = new QueryBuilder($this->conn); $qb2 = $qb->select(); - $this->assertSame($qb, $qb2); - $this->assertEquals(QueryBuilder::SELECT, $qb->getType()); + self::assertSame($qb, $qb2); + self::assertEquals(QueryBuilder::SELECT, $qb->getType()); } public function testSelectAddSelect() @@ -360,7 +360,7 @@ public function testSelectAddSelect() ->addSelect('p.*') ->from('users', 'u'); - $this->assertEquals('SELECT u.*, p.* FROM users u', (string) $qb); + self::assertEquals('SELECT u.*, p.* FROM users u', (string) $qb); } public function testEmptyAddSelect() @@ -368,8 +368,8 @@ public function testEmptyAddSelect() $qb = new QueryBuilder($this->conn); $qb2 = $qb->addSelect(); - $this->assertSame($qb, $qb2); - $this->assertEquals(QueryBuilder::SELECT, $qb->getType()); + self::assertSame($qb, $qb2); + self::assertEquals(QueryBuilder::SELECT, $qb->getType()); } public function testSelectMultipleFrom() @@ -382,7 +382,7 @@ public function testSelectMultipleFrom() ->from('users', 'u') ->from('phonenumbers', 'p'); - $this->assertEquals('SELECT u.*, p.* FROM users u, phonenumbers p', (string) $qb); + self::assertEquals('SELECT u.*, p.* FROM users u, phonenumbers p', (string) $qb); } public function testUpdate() @@ -392,8 +392,8 @@ public function testUpdate() ->set('u.foo', '?') ->set('u.bar', '?'); - $this->assertEquals(QueryBuilder::UPDATE, $qb->getType()); - $this->assertEquals('UPDATE users u SET u.foo = ?, u.bar = ?', (string) $qb); + self::assertEquals(QueryBuilder::UPDATE, $qb->getType()); + self::assertEquals('UPDATE users u SET u.foo = ?, u.bar = ?', (string) $qb); } public function testUpdateWithoutAlias() @@ -403,7 +403,7 @@ public function testUpdateWithoutAlias() ->set('foo', '?') ->set('bar', '?'); - $this->assertEquals('UPDATE users SET foo = ?, bar = ?', (string) $qb); + self::assertEquals('UPDATE users SET foo = ?, bar = ?', (string) $qb); } public function testUpdateWhere() @@ -413,7 +413,7 @@ public function testUpdateWhere() ->set('u.foo', '?') ->where('u.foo = ?'); - $this->assertEquals('UPDATE users u SET u.foo = ? WHERE u.foo = ?', (string) $qb); + self::assertEquals('UPDATE users u SET u.foo = ? WHERE u.foo = ?', (string) $qb); } public function testEmptyUpdate() @@ -421,8 +421,8 @@ public function testEmptyUpdate() $qb = new QueryBuilder($this->conn); $qb2 = $qb->update(); - $this->assertEquals(QueryBuilder::UPDATE, $qb->getType()); - $this->assertSame($qb2, $qb); + self::assertEquals(QueryBuilder::UPDATE, $qb->getType()); + self::assertSame($qb2, $qb); } public function testDelete() @@ -430,8 +430,8 @@ public function testDelete() $qb = new QueryBuilder($this->conn); $qb->delete('users', 'u'); - $this->assertEquals(QueryBuilder::DELETE, $qb->getType()); - $this->assertEquals('DELETE FROM users u', (string) $qb); + self::assertEquals(QueryBuilder::DELETE, $qb->getType()); + self::assertEquals('DELETE FROM users u', (string) $qb); } public function testDeleteWithoutAlias() @@ -439,8 +439,8 @@ public function testDeleteWithoutAlias() $qb = new QueryBuilder($this->conn); $qb->delete('users'); - $this->assertEquals(QueryBuilder::DELETE, $qb->getType()); - $this->assertEquals('DELETE FROM users', (string) $qb); + self::assertEquals(QueryBuilder::DELETE, $qb->getType()); + self::assertEquals('DELETE FROM users', (string) $qb); } public function testDeleteWhere() @@ -449,7 +449,7 @@ public function testDeleteWhere() $qb->delete('users', 'u') ->where('u.foo = ?'); - $this->assertEquals('DELETE FROM users u WHERE u.foo = ?', (string) $qb); + self::assertEquals('DELETE FROM users u WHERE u.foo = ?', (string) $qb); } public function testEmptyDelete() @@ -457,8 +457,8 @@ public function testEmptyDelete() $qb = new QueryBuilder($this->conn); $qb2 = $qb->delete(); - $this->assertEquals(QueryBuilder::DELETE, $qb->getType()); - $this->assertSame($qb2, $qb); + self::assertEquals(QueryBuilder::DELETE, $qb->getType()); + self::assertSame($qb2, $qb); } public function testInsertValues() @@ -472,8 +472,8 @@ public function testInsertValues() ) ); - $this->assertEquals(QueryBuilder::INSERT, $qb->getType()); - $this->assertEquals('INSERT INTO users (foo, bar) VALUES(?, ?)', (string) $qb); + self::assertEquals(QueryBuilder::INSERT, $qb->getType()); + self::assertEquals('INSERT INTO users (foo, bar) VALUES(?, ?)', (string) $qb); } public function testInsertReplaceValues() @@ -493,8 +493,8 @@ public function testInsertReplaceValues() ) ); - $this->assertEquals(QueryBuilder::INSERT, $qb->getType()); - $this->assertEquals('INSERT INTO users (bar, foo) VALUES(?, ?)', (string) $qb); + self::assertEquals(QueryBuilder::INSERT, $qb->getType()); + self::assertEquals('INSERT INTO users (bar, foo) VALUES(?, ?)', (string) $qb); } public function testInsertSetValue() @@ -505,8 +505,8 @@ public function testInsertSetValue() ->setValue('bar', '?') ->setValue('foo', '?'); - $this->assertEquals(QueryBuilder::INSERT, $qb->getType()); - $this->assertEquals('INSERT INTO users (foo, bar) VALUES(?, ?)', (string) $qb); + self::assertEquals(QueryBuilder::INSERT, $qb->getType()); + self::assertEquals('INSERT INTO users (foo, bar) VALUES(?, ?)', (string) $qb); } public function testInsertValuesSetValue() @@ -520,8 +520,8 @@ public function testInsertValuesSetValue() ) ->setValue('bar', '?'); - $this->assertEquals(QueryBuilder::INSERT, $qb->getType()); - $this->assertEquals('INSERT INTO users (foo, bar) VALUES(?, ?)', (string) $qb); + self::assertEquals(QueryBuilder::INSERT, $qb->getType()); + self::assertEquals('INSERT INTO users (foo, bar) VALUES(?, ?)', (string) $qb); } public function testEmptyInsert() @@ -529,30 +529,30 @@ public function testEmptyInsert() $qb = new QueryBuilder($this->conn); $qb2 = $qb->insert(); - $this->assertEquals(QueryBuilder::INSERT, $qb->getType()); - $this->assertSame($qb2, $qb); + self::assertEquals(QueryBuilder::INSERT, $qb->getType()); + self::assertSame($qb2, $qb); } public function testGetConnection() { $qb = new QueryBuilder($this->conn); - $this->assertSame($this->conn, $qb->getConnection()); + self::assertSame($this->conn, $qb->getConnection()); } public function testGetState() { $qb = new QueryBuilder($this->conn); - $this->assertEquals(QueryBuilder::STATE_CLEAN, $qb->getState()); + self::assertEquals(QueryBuilder::STATE_CLEAN, $qb->getState()); $qb->select('u.*')->from('users', 'u'); - $this->assertEquals(QueryBuilder::STATE_DIRTY, $qb->getState()); + self::assertEquals(QueryBuilder::STATE_DIRTY, $qb->getState()); $sql1 = $qb->getSQL(); - $this->assertEquals(QueryBuilder::STATE_CLEAN, $qb->getState()); - $this->assertEquals($sql1, $qb->getSQL()); + self::assertEquals(QueryBuilder::STATE_CLEAN, $qb->getState()); + self::assertEquals($sql1, $qb->getSQL()); } public function testSetMaxResults() @@ -560,8 +560,8 @@ public function testSetMaxResults() $qb = new QueryBuilder($this->conn); $qb->setMaxResults(10); - $this->assertEquals(QueryBuilder::STATE_DIRTY, $qb->getState()); - $this->assertEQuals(10, $qb->getMaxResults()); + self::assertEquals(QueryBuilder::STATE_DIRTY, $qb->getState()); + self::assertEQuals(10, $qb->getMaxResults()); } public function testSetFirstResult() @@ -569,8 +569,8 @@ public function testSetFirstResult() $qb = new QueryBuilder($this->conn); $qb->setFirstResult(10); - $this->assertEquals(QueryBuilder::STATE_DIRTY, $qb->getState()); - $this->assertEQuals(10, $qb->getFirstResult()); + self::assertEquals(QueryBuilder::STATE_DIRTY, $qb->getState()); + self::assertEQuals(10, $qb->getFirstResult()); } public function testResetQueryPart() @@ -579,9 +579,9 @@ public function testResetQueryPart() $qb->select('u.*')->from('users', 'u')->where('u.name = ?'); - $this->assertEquals('SELECT u.* FROM users u WHERE u.name = ?', (string)$qb); + self::assertEquals('SELECT u.* FROM users u WHERE u.name = ?', (string)$qb); $qb->resetQueryPart('where'); - $this->assertEquals('SELECT u.* FROM users u', (string)$qb); + self::assertEquals('SELECT u.* FROM users u', (string)$qb); } public function testResetQueryParts() @@ -590,9 +590,9 @@ public function testResetQueryParts() $qb->select('u.*')->from('users', 'u')->where('u.name = ?')->orderBy('u.name'); - $this->assertEquals('SELECT u.* FROM users u WHERE u.name = ? ORDER BY u.name ASC', (string)$qb); + self::assertEquals('SELECT u.* FROM users u WHERE u.name = ? ORDER BY u.name ASC', (string)$qb); $qb->resetQueryParts(array('where', 'orderBy')); - $this->assertEquals('SELECT u.* FROM users u', (string)$qb); + self::assertEquals('SELECT u.* FROM users u', (string)$qb); } public function testCreateNamedParameter() @@ -603,9 +603,9 @@ public function testCreateNamedParameter() $qb->expr()->eq('u.name', $qb->createNamedParameter(10, \PDO::PARAM_INT)) ); - $this->assertEquals('SELECT u.* FROM users u WHERE u.name = :dcValue1', (string)$qb); - $this->assertEquals(10, $qb->getParameter('dcValue1')); - $this->assertEquals(\PDO::PARAM_INT, $qb->getParameterType('dcValue1')); + self::assertEquals('SELECT u.* FROM users u WHERE u.name = :dcValue1', (string)$qb); + self::assertEquals(10, $qb->getParameter('dcValue1')); + self::assertEquals(\PDO::PARAM_INT, $qb->getParameterType('dcValue1')); } public function testCreateNamedParameterCustomPlaceholder() @@ -616,9 +616,9 @@ public function testCreateNamedParameterCustomPlaceholder() $qb->expr()->eq('u.name', $qb->createNamedParameter(10, \PDO::PARAM_INT, ':test')) ); - $this->assertEquals('SELECT u.* FROM users u WHERE u.name = :test', (string)$qb); - $this->assertEquals(10, $qb->getParameter('test')); - $this->assertEquals(\PDO::PARAM_INT, $qb->getParameterType('test')); + self::assertEquals('SELECT u.* FROM users u WHERE u.name = :test', (string)$qb); + self::assertEquals(10, $qb->getParameter('test')); + self::assertEquals(\PDO::PARAM_INT, $qb->getParameterType('test')); } public function testCreatePositionalParameter() @@ -629,9 +629,9 @@ public function testCreatePositionalParameter() $qb->expr()->eq('u.name', $qb->createPositionalParameter(10, \PDO::PARAM_INT)) ); - $this->assertEquals('SELECT u.* FROM users u WHERE u.name = ?', (string)$qb); - $this->assertEquals(10, $qb->getParameter(1)); - $this->assertEquals(\PDO::PARAM_INT, $qb->getParameterType(1)); + self::assertEquals('SELECT u.* FROM users u WHERE u.name = ?', (string)$qb); + self::assertEquals(10, $qb->getParameter(1)); + self::assertEquals(\PDO::PARAM_INT, $qb->getParameterType(1)); } /** @@ -649,7 +649,7 @@ public function testReferenceJoinFromJoin() ->where('nt.lang = :lang AND n.deleted != 1'); $this->expectException('Doctrine\DBAL\Query\QueryException', "The given alias 'invalid' is not part of any FROM or JOIN clause table. The currently registered aliases are: news, nv."); - $this->assertEquals('', $qb->getSQL()); + self::assertEquals('', $qb->getSQL()); } /** @@ -667,7 +667,7 @@ public function testSelectFromMasterWithWhereOnJoinedTables() ->where('nt.lang = ?') ->andWhere('n.deleted = 0'); - $this->assertEquals("SELECT COUNT(DISTINCT news.id) FROM newspages news INNER JOIN nodeversion nv ON nv.refId = news.id AND nv.refEntityname='Entity\\News' INNER JOIN nodetranslation nt ON nv.nodetranslation = nt.id INNER JOIN node n ON nt.node = n.id WHERE (nt.lang = ?) AND (n.deleted = 0)", $qb->getSQL()); + self::assertEquals("SELECT COUNT(DISTINCT news.id) FROM newspages news INNER JOIN nodeversion nv ON nv.refId = news.id AND nv.refEntityname='Entity\\News' INNER JOIN nodetranslation nt ON nv.nodetranslation = nt.id INNER JOIN node n ON nt.node = n.id WHERE (nt.lang = ?) AND (n.deleted = 0)", $qb->getSQL()); } /** @@ -685,7 +685,7 @@ public function testSelectWithMultipleFromAndJoins() ->where('u.id = a.user_id') ->andWhere('p.read = 1'); - $this->assertEquals('SELECT DISTINCT u.id FROM users u INNER JOIN permissions p ON p.user_id = u.id, articles a INNER JOIN comments c ON c.article_id = a.id WHERE (u.id = a.user_id) AND (p.read = 1)', $qb->getSQL()); + self::assertEquals('SELECT DISTINCT u.id FROM users u INNER JOIN permissions p ON p.user_id = u.id, articles a INNER JOIN comments c ON c.article_id = a.id WHERE (u.id = a.user_id) AND (p.read = 1)', $qb->getSQL()); } /** @@ -702,7 +702,7 @@ public function testSelectWithJoinsWithMultipleOnConditionsParseOrder() ->join('a', 'table_d', 'd', 'a.fk_d = d.id') ->join('c', 'table_e', 'e', 'e.fk_c = c.id AND e.fk_d = d.id'); - $this->assertEquals( + self::assertEquals( 'SELECT a.id ' . 'FROM table_a a ' . 'INNER JOIN table_b b ON a.fk_b = b.id ' . @@ -729,7 +729,7 @@ public function testSelectWithMultipleFromsAndJoinsWithMultipleOnConditionsParse ->join('c', 'table_e', 'e', 'e.fk_c = c.id AND e.fk_d = d.id') ->join('f', 'table_g', 'g', 'f.fk_g = g.id'); - $this->assertEquals( + self::assertEquals( 'SELECT a.id ' . 'FROM table_a a ' . 'INNER JOIN table_b b ON a.fk_b = b.id ' . @@ -754,12 +754,12 @@ public function testClone() $qb_clone = clone $qb; - $this->assertEquals((string) $qb, (string) $qb_clone); + self::assertEquals((string) $qb, (string) $qb_clone); $qb->andWhere('u.id = 1'); - $this->assertFalse($qb->getQueryParts() === $qb_clone->getQueryParts()); - $this->assertFalse($qb->getParameters() === $qb_clone->getParameters()); + self::assertFalse($qb->getQueryParts() === $qb_clone->getQueryParts()); + self::assertFalse($qb->getParameters() === $qb_clone->getParameters()); } public function testSimpleSelectWithoutTableAlias() @@ -769,7 +769,7 @@ public function testSimpleSelectWithoutTableAlias() $qb->select('id') ->from('users'); - $this->assertEquals('SELECT id FROM users', (string) $qb); + self::assertEquals('SELECT id FROM users', (string) $qb); } public function testSelectWithSimpleWhereWithoutTableAlias() @@ -780,7 +780,7 @@ public function testSelectWithSimpleWhereWithoutTableAlias() ->from('users') ->where('awesome=9001'); - $this->assertEquals("SELECT id, name FROM users WHERE awesome=9001", (string) $qb); + self::assertEquals("SELECT id, name FROM users WHERE awesome=9001", (string) $qb); } public function testComplexSelectWithoutTableAliases() @@ -795,7 +795,7 @@ public function testComplexSelectWithoutTableAliases() ->where('users.id = articles.user_id') ->andWhere('p.read = 1'); - $this->assertEquals('SELECT DISTINCT users.id FROM users INNER JOIN permissions p ON p.user_id = users.id, articles INNER JOIN comments c ON c.article_id = articles.id WHERE (users.id = articles.user_id) AND (p.read = 1)', $qb->getSQL()); + self::assertEquals('SELECT DISTINCT users.id FROM users INNER JOIN permissions p ON p.user_id = users.id, articles INNER JOIN comments c ON c.article_id = articles.id WHERE (users.id = articles.user_id) AND (p.read = 1)', $qb->getSQL()); } public function testComplexSelectWithSomeTableAliases() @@ -808,7 +808,7 @@ public function testComplexSelectWithSomeTableAliases() ->innerJoin('u', 'permissions', 'p', 'p.user_id = u.id') ->innerJoin('articles', 'comments', 'c', 'c.article_id = articles.id'); - $this->assertEquals('SELECT u.id FROM users u INNER JOIN permissions p ON p.user_id = u.id, articles INNER JOIN comments c ON c.article_id = articles.id', $qb->getSQL()); + self::assertEquals('SELECT u.id FROM users u INNER JOIN permissions p ON p.user_id = u.id, articles INNER JOIN comments c ON c.article_id = articles.id', $qb->getSQL()); } public function testSelectAllFromTableWithoutTableAlias() @@ -818,7 +818,7 @@ public function testSelectAllFromTableWithoutTableAlias() $qb->select('users.*') ->from('users'); - $this->assertEquals("SELECT users.* FROM users", (string) $qb); + self::assertEquals("SELECT users.* FROM users", (string) $qb); } public function testSelectAllWithoutTableAlias() @@ -828,7 +828,7 @@ public function testSelectAllWithoutTableAlias() $qb->select('*') ->from('users'); - $this->assertEquals("SELECT * FROM users", (string) $qb); + self::assertEquals("SELECT * FROM users", (string) $qb); } /** @@ -840,16 +840,16 @@ public function testGetParameterType() $qb->select('*')->from('users'); - $this->assertNull($qb->getParameterType('name')); + self::assertNull($qb->getParameterType('name')); $qb->where('name = :name'); $qb->setParameter('name', 'foo'); - $this->assertNull($qb->getParameterType('name')); + self::assertNull($qb->getParameterType('name')); $qb->setParameter('name', 'foo', \PDO::PARAM_STR); - $this->assertSame(\PDO::PARAM_STR, $qb->getParameterType('name')); + self::assertSame(\PDO::PARAM_STR, $qb->getParameterType('name')); } /** @@ -861,19 +861,19 @@ public function testGetParameterTypes() $qb->select('*')->from('users'); - $this->assertSame(array(), $qb->getParameterTypes()); + self::assertSame(array(), $qb->getParameterTypes()); $qb->where('name = :name'); $qb->setParameter('name', 'foo'); - $this->assertSame(array(), $qb->getParameterTypes()); + self::assertSame(array(), $qb->getParameterTypes()); $qb->setParameter('name', 'foo', \PDO::PARAM_STR); $qb->where('is_active = :isActive'); $qb->setParameter('isActive', true, \PDO::PARAM_BOOL); - $this->assertSame(array('name' => \PDO::PARAM_STR, 'isActive' => \PDO::PARAM_BOOL), $qb->getParameterTypes()); + self::assertSame(array('name' => \PDO::PARAM_STR, 'isActive' => \PDO::PARAM_BOOL), $qb->getParameterTypes()); } /** diff --git a/tests/Doctrine/Tests/DBAL/SQLParserUtilsTest.php b/tests/Doctrine/Tests/DBAL/SQLParserUtilsTest.php index 00c72ddf101..d284b107eb1 100644 --- a/tests/Doctrine/Tests/DBAL/SQLParserUtilsTest.php +++ b/tests/Doctrine/Tests/DBAL/SQLParserUtilsTest.php @@ -82,7 +82,7 @@ public function dataGetPlaceholderPositions() public function testGetPlaceholderPositions($query, $isPositional, $expectedParamPos) { $actualParamPos = SQLParserUtils::getPlaceholderPositions($query, $isPositional); - $this->assertEquals($expectedParamPos, $actualParamPos); + self::assertEquals($expectedParamPos, $actualParamPos); } public function dataExpandListParameters() @@ -373,9 +373,9 @@ public function testExpandListParameters($q, $p, $t, $expectedQuery, $expectedPa { list($query, $params, $types) = SQLParserUtils::expandListParameters($q, $p, $t); - $this->assertEquals($expectedQuery, $query, "Query was not rewritten correctly."); - $this->assertEquals($expectedParams, $params, "Params dont match"); - $this->assertEquals($expectedTypes, $types, "Types dont match"); + self::assertEquals($expectedQuery, $query, "Query was not rewritten correctly."); + self::assertEquals($expectedParams, $params, "Params dont match"); + self::assertEquals($expectedTypes, $types, "Types dont match"); } public function dataQueryWithMissingParameters() diff --git a/tests/Doctrine/Tests/DBAL/Schema/ColumnDiffTest.php b/tests/Doctrine/Tests/DBAL/Schema/ColumnDiffTest.php index 90a17d84fc2..13bf74f6aff 100644 --- a/tests/Doctrine/Tests/DBAL/Schema/ColumnDiffTest.php +++ b/tests/Doctrine/Tests/DBAL/Schema/ColumnDiffTest.php @@ -17,12 +17,12 @@ public function testPreservesOldColumnNameQuotation() $toColumn = new Column('bar', Type::getType(Type::INTEGER)); $columnDiff = new ColumnDiff('"foo"', $toColumn, array()); - $this->assertTrue($columnDiff->getOldColumnName()->isQuoted()); + self::assertTrue($columnDiff->getOldColumnName()->isQuoted()); $columnDiff = new ColumnDiff('"foo"', $toColumn, array(), $fromColumn); - $this->assertTrue($columnDiff->getOldColumnName()->isQuoted()); + self::assertTrue($columnDiff->getOldColumnName()->isQuoted()); $columnDiff = new ColumnDiff('foo', $toColumn, array(), $fromColumn); - $this->assertTrue($columnDiff->getOldColumnName()->isQuoted()); + self::assertTrue($columnDiff->getOldColumnName()->isQuoted()); } } diff --git a/tests/Doctrine/Tests/DBAL/Schema/ColumnTest.php b/tests/Doctrine/Tests/DBAL/Schema/ColumnTest.php index 4b11ab56edf..404a99f3afb 100644 --- a/tests/Doctrine/Tests/DBAL/Schema/ColumnTest.php +++ b/tests/Doctrine/Tests/DBAL/Schema/ColumnTest.php @@ -11,26 +11,26 @@ public function testGet() { $column = $this->createColumn(); - $this->assertEquals("foo", $column->getName()); - $this->assertSame(Type::getType('string'), $column->getType()); - - $this->assertEquals(200, $column->getLength()); - $this->assertEquals(5, $column->getPrecision()); - $this->assertEquals(2, $column->getScale()); - $this->assertTrue($column->getUnsigned()); - $this->assertFalse($column->getNotNull()); - $this->assertTrue($column->getFixed()); - $this->assertEquals("baz", $column->getDefault()); - - $this->assertEquals(array('foo' => 'bar'), $column->getPlatformOptions()); - $this->assertTrue($column->hasPlatformOption('foo')); - $this->assertEquals('bar', $column->getPlatformOption('foo')); - $this->assertFalse($column->hasPlatformOption('bar')); - - $this->assertEquals(array('bar' => 'baz'), $column->getCustomSchemaOptions()); - $this->assertTrue($column->hasCustomSchemaOption('bar')); - $this->assertEquals('baz', $column->getCustomSchemaOption('bar')); - $this->assertFalse($column->hasCustomSchemaOption('foo')); + self::assertEquals("foo", $column->getName()); + self::assertSame(Type::getType('string'), $column->getType()); + + self::assertEquals(200, $column->getLength()); + self::assertEquals(5, $column->getPrecision()); + self::assertEquals(2, $column->getScale()); + self::assertTrue($column->getUnsigned()); + self::assertFalse($column->getNotNull()); + self::assertTrue($column->getFixed()); + self::assertEquals("baz", $column->getDefault()); + + self::assertEquals(array('foo' => 'bar'), $column->getPlatformOptions()); + self::assertTrue($column->hasPlatformOption('foo')); + self::assertEquals('bar', $column->getPlatformOption('foo')); + self::assertFalse($column->hasPlatformOption('bar')); + + self::assertEquals(array('bar' => 'baz'), $column->getCustomSchemaOptions()); + self::assertTrue($column->hasCustomSchemaOption('bar')); + self::assertEquals('baz', $column->getCustomSchemaOption('bar')); + self::assertFalse($column->hasCustomSchemaOption('foo')); } public function testToArray() @@ -52,7 +52,7 @@ public function testToArray() 'bar' => 'baz' ); - $this->assertEquals($expected, $this->createColumn()->toArray()); + self::assertEquals($expected, $this->createColumn()->toArray()); } /** @@ -88,16 +88,16 @@ public function testQuotedColumnName() $mysqlPlatform = new \Doctrine\DBAL\Platforms\MySqlPlatform(); $sqlitePlatform = new \Doctrine\DBAL\Platforms\SqlitePlatform(); - $this->assertEquals('bar', $column->getName()); - $this->assertEquals('`bar`', $column->getQuotedName($mysqlPlatform)); - $this->assertEquals('"bar"', $column->getQuotedName($sqlitePlatform)); + self::assertEquals('bar', $column->getName()); + self::assertEquals('`bar`', $column->getQuotedName($mysqlPlatform)); + self::assertEquals('"bar"', $column->getQuotedName($sqlitePlatform)); $column = new Column("[bar]", $string); $sqlServerPlatform = new \Doctrine\DBAL\Platforms\SQLServerPlatform(); - $this->assertEquals('bar', $column->getName()); - $this->assertEquals('[bar]', $column->getQuotedName($sqlServerPlatform)); + self::assertEquals('bar', $column->getName()); + self::assertEquals('[bar]', $column->getQuotedName($sqlServerPlatform)); } /** @@ -109,7 +109,7 @@ public function testIsQuoted($columnName, $isQuoted) $type = Type::getType('string'); $column = new Column($columnName, $type); - $this->assertSame($isQuoted, $column->isQuoted()); + self::assertSame($isQuoted, $column->isQuoted()); } public function getIsQuoted() @@ -128,13 +128,13 @@ public function getIsQuoted() public function testColumnComment() { $column = new Column("bar", Type::getType('string')); - $this->assertNull($column->getComment()); + self::assertNull($column->getComment()); $column->setComment("foo"); - $this->assertEquals("foo", $column->getComment()); + self::assertEquals("foo", $column->getComment()); $columnArray = $column->toArray(); - $this->assertArrayHasKey('comment', $columnArray); - $this->assertEquals('foo', $columnArray['comment']); + self::assertArrayHasKey('comment', $columnArray); + self::assertEquals('foo', $columnArray['comment']); } } diff --git a/tests/Doctrine/Tests/DBAL/Schema/ComparatorTest.php b/tests/Doctrine/Tests/DBAL/Schema/ComparatorTest.php index eb7fbf36a4d..f5bfed15891 100644 --- a/tests/Doctrine/Tests/DBAL/Schema/ComparatorTest.php +++ b/tests/Doctrine/Tests/DBAL/Schema/ComparatorTest.php @@ -62,7 +62,7 @@ public function testCompareSame1() $expected = new SchemaDiff(); $expected->fromSchema = $schema1; - $this->assertEquals($expected, Comparator::compareSchemas( $schema1, $schema2 ) ); + self::assertEquals($expected, Comparator::compareSchemas( $schema1, $schema2 ) ); } public function testCompareSame2() @@ -86,7 +86,7 @@ public function testCompareSame2() $expected = new SchemaDiff(); $expected->fromSchema = $schema1; - $this->assertEquals($expected, Comparator::compareSchemas( $schema1, $schema2 ) ); + self::assertEquals($expected, Comparator::compareSchemas( $schema1, $schema2 ) ); } public function testCompareMissingTable() @@ -100,7 +100,7 @@ public function testCompareMissingTable() $expected = new SchemaDiff( array(), array(), array('bugdb' => $table), $schema1 ); - $this->assertEquals($expected, Comparator::compareSchemas( $schema1, $schema2 ) ); + self::assertEquals($expected, Comparator::compareSchemas( $schema1, $schema2 ) ); } public function testCompareNewTable() @@ -114,7 +114,7 @@ public function testCompareNewTable() $expected = new SchemaDiff( array('bugdb' => $table), array(), array(), $schema1 ); - $this->assertEquals($expected, Comparator::compareSchemas( $schema1, $schema2 ) ); + self::assertEquals($expected, Comparator::compareSchemas( $schema1, $schema2 ) ); } public function testCompareOnlyAutoincrementChanged() @@ -125,7 +125,7 @@ public function testCompareOnlyAutoincrementChanged() $comparator = new Comparator(); $changedProperties = $comparator->diffColumn($column1, $column2); - $this->assertEquals(array('autoincrement'), $changedProperties); + self::assertEquals(array('autoincrement'), $changedProperties); } public function testCompareMissingField() @@ -159,7 +159,7 @@ public function testCompareMissingField() $expected->fromSchema = $schema1; $expected->changedTables['bugdb']->fromTable = $schema1->getTable('bugdb'); - $this->assertEquals($expected, Comparator::compareSchemas( $schema1, $schema2 ) ); + self::assertEquals($expected, Comparator::compareSchemas( $schema1, $schema2 ) ); } public function testCompareNewField() @@ -192,7 +192,7 @@ public function testCompareNewField() $expected->fromSchema = $schema1; $expected->changedTables['bugdb']->fromTable = $schema1->getTable('bugdb'); - $this->assertEquals($expected, Comparator::compareSchemas( $schema1, $schema2 ) ); + self::assertEquals($expected, Comparator::compareSchemas( $schema1, $schema2 ) ); } public function testCompareChangedColumns_ChangeType() @@ -201,8 +201,8 @@ public function testCompareChangedColumns_ChangeType() $column2 = new Column('charfield1', Type::getType('integer')); $c = new Comparator(); - $this->assertEquals(array('type'), $c->diffColumn($column1, $column2)); - $this->assertEquals(array(), $c->diffColumn($column1, $column1)); + self::assertEquals(array('type'), $c->diffColumn($column1, $column2)); + self::assertEquals(array(), $c->diffColumn($column1, $column1)); } public function testCompareChangedColumns_ChangeCustomSchemaOption() @@ -217,8 +217,8 @@ public function testCompareChangedColumns_ChangeCustomSchemaOption() $column2->setCustomSchemaOption('foo2', 'bar2'); $c = new Comparator(); - $this->assertEquals(array('foo1', 'foo2'), $c->diffColumn($column1, $column2)); - $this->assertEquals(array(), $c->diffColumn($column1, $column1)); + self::assertEquals(array('foo1', 'foo2'), $c->diffColumn($column1, $column2)); + self::assertEquals(array(), $c->diffColumn($column1, $column1)); } public function testCompareChangeColumns_MultipleNewColumnsRename() @@ -233,12 +233,12 @@ public function testCompareChangeColumns_MultipleNewColumnsRename() $c = new Comparator(); $tableDiff = $c->diffTable($tableA, $tableB); - $this->assertCount(1, $tableDiff->renamedColumns, "we should have one rename datefield1 => new_datefield1."); - $this->assertArrayHasKey('datefield1', $tableDiff->renamedColumns, "'datefield1' should be set to be renamed to new_datefield1"); - $this->assertCount(1, $tableDiff->addedColumns, "'new_datefield2' should be added"); - $this->assertArrayHasKey('new_datefield2', $tableDiff->addedColumns, "'new_datefield2' should be added, not created through renaming!"); - $this->assertCount(0, $tableDiff->removedColumns, "Nothing should be removed."); - $this->assertCount(0, $tableDiff->changedColumns, "Nothing should be changed as all fields old & new have diff names."); + self::assertCount(1, $tableDiff->renamedColumns, "we should have one rename datefield1 => new_datefield1."); + self::assertArrayHasKey('datefield1', $tableDiff->renamedColumns, "'datefield1' should be set to be renamed to new_datefield1"); + self::assertCount(1, $tableDiff->addedColumns, "'new_datefield2' should be added"); + self::assertArrayHasKey('new_datefield2', $tableDiff->addedColumns, "'new_datefield2' should be added, not created through renaming!"); + self::assertCount(0, $tableDiff->removedColumns, "Nothing should be removed."); + self::assertCount(0, $tableDiff->changedColumns, "Nothing should be changed as all fields old & new have diff names."); } public function testCompareRemovedIndex() @@ -285,7 +285,7 @@ public function testCompareRemovedIndex() $expected->fromSchema = $schema1; $expected->changedTables['bugdb']->fromTable = $schema1->getTable('bugdb'); - $this->assertEquals($expected, Comparator::compareSchemas( $schema1, $schema2 ) ); + self::assertEquals($expected, Comparator::compareSchemas( $schema1, $schema2 ) ); } public function testCompareNewIndex() @@ -332,7 +332,7 @@ public function testCompareNewIndex() $expected->fromSchema = $schema1; $expected->changedTables['bugdb']->fromTable = $schema1->getTable('bugdb'); - $this->assertEquals($expected, Comparator::compareSchemas( $schema1, $schema2 ) ); + self::assertEquals($expected, Comparator::compareSchemas( $schema1, $schema2 ) ); } public function testCompareChangedIndex() @@ -386,7 +386,7 @@ public function testCompareChangedIndex() $expected->fromSchema = $schema1; $expected->changedTables['bugdb']->fromTable = $schema1->getTable('bugdb'); - $this->assertEquals($expected, Comparator::compareSchemas( $schema1, $schema2 )); + self::assertEquals($expected, Comparator::compareSchemas( $schema1, $schema2 )); } public function testCompareChangedIndexFieldPositions() @@ -426,7 +426,7 @@ public function testCompareChangedIndexFieldPositions() $expected->fromSchema = $schema1; $expected->changedTables['bugdb']->fromTable = $schema1->getTable('bugdb'); - $this->assertEquals($expected, Comparator::compareSchemas( $schema1, $schema2 )); + self::assertEquals($expected, Comparator::compareSchemas( $schema1, $schema2 )); } public function testCompareSequences() @@ -437,8 +437,8 @@ public function testCompareSequences() $c = new Comparator(); - $this->assertTrue($c->diffSequence($seq1, $seq2)); - $this->assertTrue($c->diffSequence($seq1, $seq3)); + self::assertTrue($c->diffSequence($seq1, $seq2)); + self::assertTrue($c->diffSequence($seq1, $seq3)); } public function testRemovedSequence() @@ -451,8 +451,8 @@ public function testRemovedSequence() $c = new Comparator(); $diffSchema = $c->compare($schema1, $schema2); - $this->assertEquals(1, count($diffSchema->removedSequences)); - $this->assertSame($seq, $diffSchema->removedSequences[0]); + self::assertEquals(1, count($diffSchema->removedSequences)); + self::assertSame($seq, $diffSchema->removedSequences[0]); } public function testAddedSequence() @@ -465,8 +465,8 @@ public function testAddedSequence() $c = new Comparator(); $diffSchema = $c->compare($schema1, $schema2); - $this->assertEquals(1, count($diffSchema->newSequences)); - $this->assertSame($seq, $diffSchema->newSequences[0]); + self::assertEquals(1, count($diffSchema->newSequences)); + self::assertSame($seq, $diffSchema->newSequences[0]); } public function testTableAddForeignKey() @@ -484,8 +484,8 @@ public function testTableAddForeignKey() $c = new Comparator(); $tableDiff = $c->diffTable($table1, $table2); - $this->assertInstanceOf('Doctrine\DBAL\Schema\TableDiff', $tableDiff); - $this->assertEquals(1, count($tableDiff->addedForeignKeys)); + self::assertInstanceOf('Doctrine\DBAL\Schema\TableDiff', $tableDiff); + self::assertEquals(1, count($tableDiff->addedForeignKeys)); } public function testTableRemoveForeignKey() @@ -503,8 +503,8 @@ public function testTableRemoveForeignKey() $c = new Comparator(); $tableDiff = $c->diffTable($table2, $table1); - $this->assertInstanceOf('Doctrine\DBAL\Schema\TableDiff', $tableDiff); - $this->assertEquals(1, count($tableDiff->removedForeignKeys)); + self::assertInstanceOf('Doctrine\DBAL\Schema\TableDiff', $tableDiff); + self::assertEquals(1, count($tableDiff->removedForeignKeys)); } public function testTableUpdateForeignKey() @@ -523,8 +523,8 @@ public function testTableUpdateForeignKey() $c = new Comparator(); $tableDiff = $c->diffTable($table1, $table2); - $this->assertInstanceOf('Doctrine\DBAL\Schema\TableDiff', $tableDiff); - $this->assertEquals(1, count($tableDiff->changedForeignKeys)); + self::assertInstanceOf('Doctrine\DBAL\Schema\TableDiff', $tableDiff); + self::assertEquals(1, count($tableDiff->changedForeignKeys)); } public function testMovedForeignKeyForeignTable() @@ -546,8 +546,8 @@ public function testMovedForeignKeyForeignTable() $c = new Comparator(); $tableDiff = $c->diffTable($table1, $table2); - $this->assertInstanceOf('Doctrine\DBAL\Schema\TableDiff', $tableDiff); - $this->assertEquals(1, count($tableDiff->changedForeignKeys)); + self::assertInstanceOf('Doctrine\DBAL\Schema\TableDiff', $tableDiff); + self::assertEquals(1, count($tableDiff->changedForeignKeys)); } public function testTablesCaseInsensitive() @@ -567,7 +567,7 @@ public function testTablesCaseInsensitive() $c = new Comparator(); $diff = $c->compare($schemaA, $schemaB); - $this->assertSchemaTableChangeCount($diff, 1, 0, 1); + self::assertSchemaTableChangeCount($diff, 1, 0, 1); } public function testSequencesCaseInsensitive() @@ -587,7 +587,7 @@ public function testSequencesCaseInsensitive() $c = new Comparator(); $diff = $c->compare($schemaA, $schemaB); - $this->assertSchemaSequenceChangeCount($diff, 1, 0, 1); + self::assertSchemaSequenceChangeCount($diff, 1, 0, 1); } public function testCompareColumnCompareCaseInsensitive() @@ -601,7 +601,7 @@ public function testCompareColumnCompareCaseInsensitive() $c = new Comparator(); $tableDiff = $c->diffTable($tableA, $tableB); - $this->assertFalse($tableDiff); + self::assertFalse($tableDiff); } public function testCompareIndexBasedOnPropertiesNotName() @@ -619,7 +619,7 @@ public function testCompareIndexBasedOnPropertiesNotName() $tableDiff->fromTable = $tableA; $tableDiff->renamedIndexes['foo_bar_idx'] = new Index('bar_foo_idx', array('id')); - $this->assertEquals( + self::assertEquals( $tableDiff, $c->diffTable($tableA, $tableB) ); @@ -638,7 +638,7 @@ public function testCompareForeignKeyBasedOnPropertiesNotName() $c = new Comparator(); $tableDiff = $c->diffTable($tableA, $tableB); - $this->assertFalse($tableDiff); + self::assertFalse($tableDiff); } public function testCompareForeignKey_RestrictNoAction_AreTheSame() @@ -647,7 +647,7 @@ public function testCompareForeignKey_RestrictNoAction_AreTheSame() $fk2 = new ForeignKeyConstraint(array("foo"), "bar", array("baz"), "fk1", array('onDelete' => 'RESTRICT')); $c = new Comparator(); - $this->assertFalse($c->diffForeignKey($fk1, $fk2)); + self::assertFalse($c->diffForeignKey($fk1, $fk2)); } /** @@ -659,7 +659,7 @@ public function testCompareForeignKeyNamesUnqualified_AsNoSchemaInformationIsAva $fk2 = new ForeignKeyConstraint(array("foo"), "baz.bar", array("baz"), "fk1"); $c = new Comparator(); - $this->assertFalse($c->diffForeignKey($fk1, $fk2)); + self::assertFalse($c->diffForeignKey($fk1, $fk2)); } public function testDetectRenameColumn() @@ -673,10 +673,10 @@ public function testDetectRenameColumn() $c = new Comparator(); $tableDiff = $c->diffTable($tableA, $tableB); - $this->assertEquals(0, count($tableDiff->addedColumns)); - $this->assertEquals(0, count($tableDiff->removedColumns)); - $this->assertArrayHasKey('foo', $tableDiff->renamedColumns); - $this->assertEquals('bar', $tableDiff->renamedColumns['foo']->getName()); + self::assertEquals(0, count($tableDiff->addedColumns)); + self::assertEquals(0, count($tableDiff->removedColumns)); + self::assertArrayHasKey('foo', $tableDiff->renamedColumns); + self::assertEquals('bar', $tableDiff->renamedColumns['foo']->getName()); } /** @@ -698,12 +698,12 @@ public function testDetectRenameColumnAmbiguous() $c = new Comparator(); $tableDiff = $c->diffTable($tableA, $tableB); - $this->assertEquals(1, count($tableDiff->addedColumns), "'baz' should be added, not created through renaming!"); - $this->assertArrayHasKey('baz', $tableDiff->addedColumns, "'baz' should be added, not created through renaming!"); - $this->assertEquals(2, count($tableDiff->removedColumns), "'foo' and 'bar' should both be dropped, an ambiguity exists which one could be renamed to 'baz'."); - $this->assertArrayHasKey('foo', $tableDiff->removedColumns, "'foo' should be removed."); - $this->assertArrayHasKey('bar', $tableDiff->removedColumns, "'bar' should be removed."); - $this->assertEquals(0, count($tableDiff->renamedColumns), "no renamings should take place."); + self::assertEquals(1, count($tableDiff->addedColumns), "'baz' should be added, not created through renaming!"); + self::assertArrayHasKey('baz', $tableDiff->addedColumns, "'baz' should be added, not created through renaming!"); + self::assertEquals(2, count($tableDiff->removedColumns), "'foo' and 'bar' should both be dropped, an ambiguity exists which one could be renamed to 'baz'."); + self::assertArrayHasKey('foo', $tableDiff->removedColumns, "'foo' should be removed."); + self::assertArrayHasKey('bar', $tableDiff->removedColumns, "'bar' should be removed."); + self::assertEquals(0, count($tableDiff->renamedColumns), "no renamings should take place."); } /** @@ -723,10 +723,10 @@ public function testDetectRenameIndex() $comparator = new Comparator(); $tableDiff = $comparator->diffTable($table1, $table2); - $this->assertCount(0, $tableDiff->addedIndexes); - $this->assertCount(0, $tableDiff->removedIndexes); - $this->assertArrayHasKey('idx_foo', $tableDiff->renamedIndexes); - $this->assertEquals('idx_bar', $tableDiff->renamedIndexes['idx_foo']->getName()); + self::assertCount(0, $tableDiff->addedIndexes); + self::assertCount(0, $tableDiff->removedIndexes); + self::assertArrayHasKey('idx_foo', $tableDiff->renamedIndexes); + self::assertEquals('idx_bar', $tableDiff->renamedIndexes['idx_foo']->getName()); } /** @@ -751,12 +751,12 @@ public function testDetectRenameIndexAmbiguous() $comparator = new Comparator(); $tableDiff = $comparator->diffTable($table1, $table2); - $this->assertCount(1, $tableDiff->addedIndexes); - $this->assertArrayHasKey('idx_baz', $tableDiff->addedIndexes); - $this->assertCount(2, $tableDiff->removedIndexes); - $this->assertArrayHasKey('idx_foo', $tableDiff->removedIndexes); - $this->assertArrayHasKey('idx_bar', $tableDiff->removedIndexes); - $this->assertCount(0, $tableDiff->renamedIndexes); + self::assertCount(1, $tableDiff->addedIndexes); + self::assertArrayHasKey('idx_baz', $tableDiff->addedIndexes); + self::assertCount(2, $tableDiff->removedIndexes); + self::assertArrayHasKey('idx_foo', $tableDiff->removedIndexes); + self::assertArrayHasKey('idx_bar', $tableDiff->removedIndexes); + self::assertCount(0, $tableDiff->renamedIndexes); } public function testDetectChangeIdentifierType() @@ -772,8 +772,8 @@ public function testDetectChangeIdentifierType() $c = new Comparator(); $tableDiff = $c->diffTable($tableA, $tableB); - $this->assertInstanceOf('Doctrine\DBAL\Schema\TableDiff', $tableDiff); - $this->assertArrayHasKey('id', $tableDiff->changedColumns); + self::assertInstanceOf('Doctrine\DBAL\Schema\TableDiff', $tableDiff); + self::assertArrayHasKey('id', $tableDiff->changedColumns); } @@ -798,10 +798,10 @@ public function testDiff() $c = new Comparator(); $tableDiff = $c->diffTable($table, $newtable); - $this->assertInstanceOf('Doctrine\DBAL\Schema\TableDiff', $tableDiff); - $this->assertEquals(array('twitterid', 'displayname'), array_keys($tableDiff->renamedColumns)); - $this->assertEquals(array('logged_in_at'), array_keys($tableDiff->addedColumns)); - $this->assertEquals(0, count($tableDiff->removedColumns)); + self::assertInstanceOf('Doctrine\DBAL\Schema\TableDiff', $tableDiff); + self::assertEquals(array('twitterid', 'displayname'), array_keys($tableDiff->renamedColumns)); + self::assertEquals(array('logged_in_at'), array_keys($tableDiff->addedColumns)); + self::assertEquals(0, count($tableDiff->removedColumns)); } @@ -820,7 +820,7 @@ public function testChangedSequence() $c = new \Doctrine\DBAL\Schema\Comparator; $diff = $c->compare($schema, $schemaNew); - $this->assertSame($diff->changedSequences[0] , $schemaNew->getSequence('baz')); + self::assertSame($diff->changedSequences[0] , $schemaNew->getSequence('baz')); } /** @@ -834,7 +834,7 @@ public function testDiffDecimalWithNullPrecision() $column2 = new Column('foo', Type::getType('decimal')); $c = new Comparator(); - $this->assertEquals(array(), $c->diffColumn($column, $column2)); + self::assertEquals(array(), $c->diffColumn($column, $column2)); } /** @@ -854,7 +854,7 @@ public function testFqnSchemaComparison() $expected = new SchemaDiff(); $expected->fromSchema = $oldSchema; - $this->assertEquals($expected, Comparator::compareSchemas($oldSchema, $newSchema)); + self::assertEquals($expected, Comparator::compareSchemas($oldSchema, $newSchema)); } /** @@ -880,8 +880,8 @@ public function testNamespacesComparison() $diff = Comparator::compareSchemas($oldSchema, $newSchema); - $this->assertEquals(array('bar' => 'bar', 'baz' => 'baz'), $diff->newNamespaces); - $this->assertCount(2, $diff->newTables); + self::assertEquals(array('bar' => 'bar', 'baz' => 'baz'), $diff->newNamespaces); + self::assertCount(2, $diff->newTables); } /** @@ -901,7 +901,7 @@ public function testFqnSchemaComparisonDifferentSchemaNameButSameTableNoDiff() $expected = new SchemaDiff(); $expected->fromSchema = $oldSchema; - $this->assertEquals($expected, Comparator::compareSchemas($oldSchema, $newSchema)); + self::assertEquals($expected, Comparator::compareSchemas($oldSchema, $newSchema)); } /** @@ -920,7 +920,7 @@ public function testFqnSchemaComparisonNoSchemaSame() $expected = new SchemaDiff(); $expected->fromSchema = $oldSchema; - $this->assertEquals($expected, Comparator::compareSchemas($oldSchema, $newSchema)); + self::assertEquals($expected, Comparator::compareSchemas($oldSchema, $newSchema)); } /** @@ -942,7 +942,7 @@ public function testAutoIncrementSequences() $c = new Comparator(); $diff = $c->compare($oldSchema, $newSchema); - $this->assertCount(0, $diff->removedSequences); + self::assertCount(0, $diff->removedSequences); } @@ -966,7 +966,7 @@ public function testAutoIncrementNoSequences() $c = new Comparator(); $diff = $c->compare($oldSchema, $newSchema); - $this->assertCount(0, $diff->newSequences); + self::assertCount(0, $diff->newSequences); } /** * You can get multiple drops for a FK when a table referenced by a foreign @@ -1003,8 +1003,8 @@ public function testAvoidMultipleDropForeignKey() $comparator = new Comparator(); $schemaDiff = $comparator->compare($oldSchema, $newSchema); - $this->assertCount(1, $schemaDiff->changedTables['table_c']->removedForeignKeys); - $this->assertCount(1, $schemaDiff->orphanedForeignKeys); + self::assertCount(1, $schemaDiff->changedTables['table_c']->removedForeignKeys); + self::assertCount(1, $schemaDiff->orphanedForeignKeys); } public function testCompareChangedColumn() @@ -1026,7 +1026,7 @@ public function testCompareChangedColumn() $columnDiff->fromColumn = $tableFoo->getColumn('id'); $columnDiff->changedProperties = array('type'); - $this->assertEquals($expected, Comparator::compareSchemas($oldSchema, $newSchema)); + self::assertEquals($expected, Comparator::compareSchemas($oldSchema, $newSchema)); } public function testCompareChangedBinaryColumn() @@ -1048,7 +1048,7 @@ public function testCompareChangedBinaryColumn() $columnDiff->fromColumn = $tableFoo->getColumn('id'); $columnDiff->changedProperties = array('length', 'fixed'); - $this->assertEquals($expected, Comparator::compareSchemas($oldSchema, $newSchema)); + self::assertEquals($expected, Comparator::compareSchemas($oldSchema, $newSchema)); } /** @@ -1062,7 +1062,7 @@ public function testCompareQuotedAndUnquotedForeignKeyColumns() $comparator = new Comparator(); $diff = $comparator->diffForeignKey($fk1, $fk2); - $this->assertFalse($diff); + self::assertFalse($diff); } /** @@ -1073,9 +1073,9 @@ public function testCompareQuotedAndUnquotedForeignKeyColumns() */ public function assertSchemaTableChangeCount($diff, $newTableCount=0, $changeTableCount=0, $removeTableCount=0) { - $this->assertEquals($newTableCount, count($diff->newTables)); - $this->assertEquals($changeTableCount, count($diff->changedTables)); - $this->assertEquals($removeTableCount, count($diff->removedTables)); + self::assertEquals($newTableCount, count($diff->newTables)); + self::assertEquals($changeTableCount, count($diff->changedTables)); + self::assertEquals($removeTableCount, count($diff->removedTables)); } /** @@ -1086,9 +1086,9 @@ public function assertSchemaTableChangeCount($diff, $newTableCount=0, $changeTab */ public function assertSchemaSequenceChangeCount($diff, $newSequenceCount=0, $changeSequenceCount=0, $removeSequenceCount=0) { - $this->assertEquals($newSequenceCount, count($diff->newSequences), "Expected number of new sequences is wrong."); - $this->assertEquals($changeSequenceCount, count($diff->changedSequences), "Expected number of changed sequences is wrong."); - $this->assertEquals($removeSequenceCount, count($diff->removedSequences), "Expected number of removed sequences is wrong."); + self::assertEquals($newSequenceCount, count($diff->newSequences), "Expected number of new sequences is wrong."); + self::assertEquals($changeSequenceCount, count($diff->changedSequences), "Expected number of changed sequences is wrong."); + self::assertEquals($removeSequenceCount, count($diff->removedSequences), "Expected number of removed sequences is wrong."); } public function testDiffColumnPlatformOptions() @@ -1100,12 +1100,12 @@ public function testDiffColumnPlatformOptions() $comparator = new Comparator(); - $this->assertEquals(array(), $comparator->diffColumn($column1, $column2)); - $this->assertEquals(array(), $comparator->diffColumn($column2, $column1)); - $this->assertEquals(array('bar'), $comparator->diffColumn($column1, $column3)); - $this->assertEquals(array('bar'), $comparator->diffColumn($column3, $column1)); - $this->assertEquals(array(), $comparator->diffColumn($column1, $column4)); - $this->assertEquals(array(), $comparator->diffColumn($column4, $column1)); + self::assertEquals(array(), $comparator->diffColumn($column1, $column2)); + self::assertEquals(array(), $comparator->diffColumn($column2, $column1)); + self::assertEquals(array('bar'), $comparator->diffColumn($column1, $column3)); + self::assertEquals(array('bar'), $comparator->diffColumn($column3, $column1)); + self::assertEquals(array(), $comparator->diffColumn($column1, $column4)); + self::assertEquals(array(), $comparator->diffColumn($column4, $column1)); } public function testComplexDiffColumn() @@ -1121,8 +1121,8 @@ public function testComplexDiffColumn() $comparator = new Comparator(); - $this->assertEquals(array(), $comparator->diffColumn($column1, $column2)); - $this->assertEquals(array(), $comparator->diffColumn($column2, $column1)); + self::assertEquals(array(), $comparator->diffColumn($column1, $column2)); + self::assertEquals(array(), $comparator->diffColumn($column2, $column1)); } /** @@ -1171,7 +1171,7 @@ public function testComparesNamespaces() $expected->newNamespaces = array('baz' => 'baz'); $expected->removedNamespaces = array('foo' => 'foo'); - $this->assertEquals($expected, $comparator->compare($fromSchema, $toSchema)); + self::assertEquals($expected, $comparator->compare($fromSchema, $toSchema)); } public function testCompareGuidColumns() @@ -1185,8 +1185,8 @@ public function testCompareGuidColumns() array('notnull' => false, 'length' => '36', 'fixed' => true, 'default' => 'NEWID()', 'comment' => 'GUID 2.') ); - $this->assertEquals(array('notnull', 'default', 'comment'), $comparator->diffColumn($column1, $column2)); - $this->assertEquals(array('notnull', 'default', 'comment'), $comparator->diffColumn($column2, $column1)); + self::assertEquals(array('notnull', 'default', 'comment'), $comparator->diffColumn($column1, $column2)); + self::assertEquals(array('notnull', 'default', 'comment'), $comparator->diffColumn($column2, $column1)); } /** @@ -1205,11 +1205,11 @@ public function testCompareColumnComments($comment1, $comment2, $equals) $actualDiff = $comparator->diffColumn($column1, $column2); - $this->assertSame($expectedDiff, $actualDiff); + self::assertSame($expectedDiff, $actualDiff); $actualDiff = $comparator->diffColumn($column2, $column1); - $this->assertSame($expectedDiff, $actualDiff); + self::assertSame($expectedDiff, $actualDiff); } public function getCompareColumnComments() @@ -1270,10 +1270,10 @@ public function testForeignKeyRemovalWithRenamedLocalColumn() )) )); $actual = Comparator::compareSchemas($fromSchema, $toSchema); - $this->assertArrayHasKey("table2", $actual->changedTables); - $this->assertCount(1, $actual->orphanedForeignKeys); - $this->assertEquals("fk_table2_table1", $actual->orphanedForeignKeys[0]->getName()); - $this->assertCount(1, $actual->changedTables['table2']->addedForeignKeys, "FK to table3 should be added."); - $this->assertEquals("table3", $actual->changedTables['table2']->addedForeignKeys[0]->getForeignTableName()); + self::assertArrayHasKey("table2", $actual->changedTables); + self::assertCount(1, $actual->orphanedForeignKeys); + self::assertEquals("fk_table2_table1", $actual->orphanedForeignKeys[0]->getName()); + self::assertCount(1, $actual->changedTables['table2']->addedForeignKeys, "FK to table3 should be added."); + self::assertEquals("table3", $actual->changedTables['table2']->addedForeignKeys[0]->getForeignTableName()); } } diff --git a/tests/Doctrine/Tests/DBAL/Schema/DB2SchemaManagerTest.php b/tests/Doctrine/Tests/DBAL/Schema/DB2SchemaManagerTest.php index 001280eddad..d5592a4cbde 100644 --- a/tests/Doctrine/Tests/DBAL/Schema/DB2SchemaManagerTest.php +++ b/tests/Doctrine/Tests/DBAL/Schema/DB2SchemaManagerTest.php @@ -60,7 +60,7 @@ public function testListTableNamesFiltersAssetNamesCorrectly() ], ])); - $this->assertSame( + self::assertSame( [ 'FOO', 'BAR', diff --git a/tests/Doctrine/Tests/DBAL/Schema/ForeignKeyConstraintTest.php b/tests/Doctrine/Tests/DBAL/Schema/ForeignKeyConstraintTest.php index 8fff59cfd63..291731bab6d 100644 --- a/tests/Doctrine/Tests/DBAL/Schema/ForeignKeyConstraintTest.php +++ b/tests/Doctrine/Tests/DBAL/Schema/ForeignKeyConstraintTest.php @@ -22,7 +22,7 @@ public function testIntersectsIndexColumns(array $indexColumns, $expectedResult) ->method('getColumns') ->will($this->returnValue($indexColumns)); - $this->assertSame($expectedResult, $foreignKey->intersectsIndexColumns($index)); + self::assertSame($expectedResult, $foreignKey->intersectsIndexColumns($index)); } /** diff --git a/tests/Doctrine/Tests/DBAL/Schema/IndexTest.php b/tests/Doctrine/Tests/DBAL/Schema/IndexTest.php index 65c6f09a90c..b62cf6efedc 100644 --- a/tests/Doctrine/Tests/DBAL/Schema/IndexTest.php +++ b/tests/Doctrine/Tests/DBAL/Schema/IndexTest.php @@ -14,26 +14,26 @@ public function createIndex($unique = false, $primary = false, $options = array( public function testCreateIndex() { $idx = $this->createIndex(); - $this->assertEquals("foo", $idx->getName()); + self::assertEquals("foo", $idx->getName()); $columns = $idx->getColumns(); - $this->assertEquals(2, count($columns)); - $this->assertEquals(array("bar", "baz"), $columns); - $this->assertFalse($idx->isUnique()); - $this->assertFalse($idx->isPrimary()); + self::assertEquals(2, count($columns)); + self::assertEquals(array("bar", "baz"), $columns); + self::assertFalse($idx->isUnique()); + self::assertFalse($idx->isPrimary()); } public function testCreatePrimary() { $idx = $this->createIndex(false, true); - $this->assertTrue($idx->isUnique()); - $this->assertTrue($idx->isPrimary()); + self::assertTrue($idx->isUnique()); + self::assertTrue($idx->isPrimary()); } public function testCreateUnique() { $idx = $this->createIndex(true, false); - $this->assertTrue($idx->isUnique()); - $this->assertFalse($idx->isPrimary()); + self::assertTrue($idx->isUnique()); + self::assertFalse($idx->isPrimary()); } /** @@ -45,8 +45,8 @@ public function testFulfilledByUnique() $idx2 = $this->createIndex(true, false); $idx3 = $this->createIndex(); - $this->assertTrue($idx1->isFullfilledBy($idx2)); - $this->assertFalse($idx1->isFullfilledBy($idx3)); + self::assertTrue($idx1->isFullfilledBy($idx2)); + self::assertFalse($idx1->isFullfilledBy($idx3)); } /** @@ -58,8 +58,8 @@ public function testFulfilledByPrimary() $idx2 = $this->createIndex(true, true); $idx3 = $this->createIndex(true, false); - $this->assertTrue($idx1->isFullfilledBy($idx2)); - $this->assertFalse($idx1->isFullfilledBy($idx3)); + self::assertTrue($idx1->isFullfilledBy($idx2)); + self::assertFalse($idx1->isFullfilledBy($idx3)); } /** @@ -72,9 +72,9 @@ public function testFulfilledByIndex() $pri = $this->createIndex(true, true); $uniq = $this->createIndex(true); - $this->assertTrue($idx1->isFullfilledBy($idx2)); - $this->assertTrue($idx1->isFullfilledBy($pri)); - $this->assertTrue($idx1->isFullfilledBy($uniq)); + self::assertTrue($idx1->isFullfilledBy($idx2)); + self::assertTrue($idx1->isFullfilledBy($pri)); + self::assertTrue($idx1->isFullfilledBy($uniq)); } public function testFulfilledWithPartial() @@ -83,13 +83,13 @@ public function testFulfilledWithPartial() $partial = new Index('partial', array('col1', 'col2'), true, false, array(), array('where' => 'col1 IS NULL')); $another = new Index('another', array('col1', 'col2'), true, false, array(), array('where' => 'col1 IS NULL')); - $this->assertFalse($partial->isFullfilledBy($without)); - $this->assertFalse($without->isFullfilledBy($partial)); + self::assertFalse($partial->isFullfilledBy($without)); + self::assertFalse($without->isFullfilledBy($partial)); - $this->assertTrue($partial->isFullfilledBy($partial)); + self::assertTrue($partial->isFullfilledBy($partial)); - $this->assertTrue($partial->isFullfilledBy($another)); - $this->assertTrue($another->isFullfilledBy($partial)); + self::assertTrue($partial->isFullfilledBy($another)); + self::assertTrue($another->isFullfilledBy($partial)); } public function testOverrulesWithPartial() @@ -98,13 +98,13 @@ public function testOverrulesWithPartial() $partial = new Index('partial', array('col1', 'col2'), true, false, array(), array('where' => 'col1 IS NULL')); $another = new Index('another', array('col1', 'col2'), true, false, array(), array('where' => 'col1 IS NULL')); - $this->assertFalse($partial->overrules($without)); - $this->assertFalse($without->overrules($partial)); + self::assertFalse($partial->overrules($without)); + self::assertFalse($without->overrules($partial)); - $this->assertTrue($partial->overrules($partial)); + self::assertTrue($partial->overrules($partial)); - $this->assertTrue($partial->overrules($another)); - $this->assertTrue($another->overrules($partial)); + self::assertTrue($partial->overrules($another)); + self::assertTrue($another->overrules($partial)); } /** @@ -113,17 +113,17 @@ public function testOverrulesWithPartial() public function testFlags() { $idx1 = $this->createIndex(); - $this->assertFalse($idx1->hasFlag('clustered')); - $this->assertEmpty($idx1->getFlags()); + self::assertFalse($idx1->hasFlag('clustered')); + self::assertEmpty($idx1->getFlags()); $idx1->addFlag('clustered'); - $this->assertTrue($idx1->hasFlag('clustered')); - $this->assertTrue($idx1->hasFlag('CLUSTERED')); - $this->assertSame(array('clustered'), $idx1->getFlags()); + self::assertTrue($idx1->hasFlag('clustered')); + self::assertTrue($idx1->hasFlag('CLUSTERED')); + self::assertSame(array('clustered'), $idx1->getFlags()); $idx1->removeFlag('clustered'); - $this->assertFalse($idx1->hasFlag('clustered')); - $this->assertEmpty($idx1->getFlags()); + self::assertFalse($idx1->hasFlag('clustered')); + self::assertEmpty($idx1->getFlags()); } /** @@ -133,25 +133,25 @@ public function testIndexQuotes() { $index = new Index("foo", array("`bar`", "`baz`")); - $this->assertTrue($index->spansColumns(array("bar", "baz"))); - $this->assertTrue($index->hasColumnAtPosition("bar", 0)); - $this->assertTrue($index->hasColumnAtPosition("baz", 1)); + self::assertTrue($index->spansColumns(array("bar", "baz"))); + self::assertTrue($index->hasColumnAtPosition("bar", 0)); + self::assertTrue($index->hasColumnAtPosition("baz", 1)); - $this->assertFalse($index->hasColumnAtPosition("bar", 1)); - $this->assertFalse($index->hasColumnAtPosition("baz", 0)); + self::assertFalse($index->hasColumnAtPosition("bar", 1)); + self::assertFalse($index->hasColumnAtPosition("baz", 0)); } public function testOptions() { $idx1 = $this->createIndex(); - $this->assertFalse($idx1->hasOption('where')); - $this->assertEmpty($idx1->getOptions()); + self::assertFalse($idx1->hasOption('where')); + self::assertEmpty($idx1->getOptions()); $idx2 = $this->createIndex(false, false, array('where' => 'name IS NULL')); - $this->assertTrue($idx2->hasOption('where')); - $this->assertTrue($idx2->hasOption('WHERE')); - $this->assertSame('name IS NULL', $idx2->getOption('where')); - $this->assertSame('name IS NULL', $idx2->getOption('WHERE')); - $this->assertSame(array('where' => 'name IS NULL'), $idx2->getOptions()); + self::assertTrue($idx2->hasOption('where')); + self::assertTrue($idx2->hasOption('WHERE')); + self::assertSame('name IS NULL', $idx2->getOption('where')); + self::assertSame('name IS NULL', $idx2->getOption('WHERE')); + self::assertSame(array('where' => 'name IS NULL'), $idx2->getOptions()); } } diff --git a/tests/Doctrine/Tests/DBAL/Schema/MySqlSchemaManagerTest.php b/tests/Doctrine/Tests/DBAL/Schema/MySqlSchemaManagerTest.php index 5e4361d4041..d79389f5a11 100644 --- a/tests/Doctrine/Tests/DBAL/Schema/MySqlSchemaManagerTest.php +++ b/tests/Doctrine/Tests/DBAL/Schema/MySqlSchemaManagerTest.php @@ -30,11 +30,11 @@ public function testCompositeForeignKeys() { $this->conn->expects($this->once())->method('fetchAll')->will($this->returnValue($this->getFKDefinition())); $fkeys = $this->manager->listTableForeignKeys('dummy'); - $this->assertEquals(1, count($fkeys), "Table has to have one foreign key."); + self::assertEquals(1, count($fkeys), "Table has to have one foreign key."); - $this->assertInstanceOf('Doctrine\DBAL\Schema\ForeignKeyConstraint', $fkeys[0]); - $this->assertEquals(array('column_1', 'column_2', 'column_3'), array_map('strtolower', $fkeys[0]->getLocalColumns())); - $this->assertEquals(array('column_1', 'column_2', 'column_3'), array_map('strtolower', $fkeys[0]->getForeignColumns())); + self::assertInstanceOf('Doctrine\DBAL\Schema\ForeignKeyConstraint', $fkeys[0]); + self::assertEquals(array('column_1', 'column_2', 'column_3'), array_map('strtolower', $fkeys[0]->getLocalColumns())); + self::assertEquals(array('column_1', 'column_2', 'column_3'), array_map('strtolower', $fkeys[0]->getForeignColumns())); } public function getFKDefinition() diff --git a/tests/Doctrine/Tests/DBAL/Schema/Platforms/MySQLSchemaTest.php b/tests/Doctrine/Tests/DBAL/Schema/Platforms/MySQLSchemaTest.php index d4f06a38b0c..7c64daa81cc 100644 --- a/tests/Doctrine/Tests/DBAL/Schema/Platforms/MySQLSchemaTest.php +++ b/tests/Doctrine/Tests/DBAL/Schema/Platforms/MySQLSchemaTest.php @@ -35,7 +35,7 @@ public function testSwitchPrimaryKeyOrder() $diff = $this->comparator->diffTable($tableOld, $tableNew); $sql = $this->platform->getAlterTableSQL($diff); - $this->assertEquals( + self::assertEquals( array( 'ALTER TABLE test DROP PRIMARY KEY', 'ALTER TABLE test ADD PRIMARY KEY (bar_id, foo_id)' @@ -57,7 +57,7 @@ public function testGenerateForeignKeySQL() $sqls[] = $this->platform->getCreateForeignKeySQL($fk, $tableOld); } - $this->assertEquals(array("ALTER TABLE test ADD CONSTRAINT FK_D87F7E0C8E48560F FOREIGN KEY (foo_id) REFERENCES test_foreign (foo_id)"), $sqls); + self::assertEquals(array("ALTER TABLE test ADD CONSTRAINT FK_D87F7E0C8E48560F FOREIGN KEY (foo_id) REFERENCES test_foreign (foo_id)"), $sqls); } /** @@ -75,7 +75,7 @@ public function testClobNoAlterTable() $diff = $this->comparator->diffTable($tableOld, $tableNew); $sql = $this->platform->getAlterTableSQL($diff); - $this->assertEquals( + self::assertEquals( array('ALTER TABLE test ADD PRIMARY KEY (id)'), $sql ); diff --git a/tests/Doctrine/Tests/DBAL/Schema/PostgreSQLSchemaManagerTest.php b/tests/Doctrine/Tests/DBAL/Schema/PostgreSQLSchemaManagerTest.php index 010c35e4b7e..29c680b4c48 100644 --- a/tests/Doctrine/Tests/DBAL/Schema/PostgreSQLSchemaManagerTest.php +++ b/tests/Doctrine/Tests/DBAL/Schema/PostgreSQLSchemaManagerTest.php @@ -64,7 +64,7 @@ public function testFiltersSequences() $this->connection->expects($this->exactly(3)) ->method('fetchAll'); - $this->assertEquals( + self::assertEquals( [ new Sequence('schema.foo', 2, 2), new Sequence('schema.bar', 1, 1), diff --git a/tests/Doctrine/Tests/DBAL/Schema/SchemaDiffTest.php b/tests/Doctrine/Tests/DBAL/Schema/SchemaDiffTest.php index e0776f6eea5..2f33fa9275b 100644 --- a/tests/Doctrine/Tests/DBAL/Schema/SchemaDiffTest.php +++ b/tests/Doctrine/Tests/DBAL/Schema/SchemaDiffTest.php @@ -18,7 +18,7 @@ public function testSchemaDiffToSql() $expected = array('create_schema', 'drop_orphan_fk', 'alter_seq', 'drop_seq', 'create_seq', 'create_table', 'create_foreign_key', 'drop_table', 'alter_table'); - $this->assertEquals($expected, $sql); + self::assertEquals($expected, $sql); } public function testSchemaDiffToSaveSql() @@ -30,7 +30,7 @@ public function testSchemaDiffToSaveSql() $expected = array('create_schema', 'alter_seq', 'create_seq', 'create_table', 'create_foreign_key', 'alter_table'); - $this->assertEquals($expected, $sql); + self::assertEquals($expected, $sql); } public function createPlatform($unsafe = false) diff --git a/tests/Doctrine/Tests/DBAL/Schema/SchemaTest.php b/tests/Doctrine/Tests/DBAL/Schema/SchemaTest.php index ddfdf16b7d3..a73bfbcaa99 100644 --- a/tests/Doctrine/Tests/DBAL/Schema/SchemaTest.php +++ b/tests/Doctrine/Tests/DBAL/Schema/SchemaTest.php @@ -15,13 +15,13 @@ public function testAddTable() $schema = new Schema(array($table)); - $this->assertTrue($schema->hasTable($tableName)); + self::assertTrue($schema->hasTable($tableName)); $tables = $schema->getTables(); - $this->assertTrue( isset($tables[$tableName]) ); - $this->assertSame($table, $tables[$tableName]); - $this->assertSame($table, $schema->getTable($tableName)); - $this->assertTrue($schema->hasTable($tableName)); + self::assertTrue( isset($tables[$tableName]) ); + self::assertSame($table, $tables[$tableName]); + self::assertSame($table, $schema->getTable($tableName)); + self::assertTrue($schema->hasTable($tableName)); } public function testTableMatchingCaseInsensitive() @@ -29,12 +29,12 @@ public function testTableMatchingCaseInsensitive() $table = new Table("Foo"); $schema = new Schema(array($table)); - $this->assertTrue($schema->hasTable("foo")); - $this->assertTrue($schema->hasTable("FOO")); + self::assertTrue($schema->hasTable("foo")); + self::assertTrue($schema->hasTable("FOO")); - $this->assertSame($table, $schema->getTable('FOO')); - $this->assertSame($table, $schema->getTable('foo')); - $this->assertSame($table, $schema->getTable('Foo')); + self::assertSame($table, $schema->getTable('FOO')); + self::assertSame($table, $schema->getTable('foo')); + self::assertSame($table, $schema->getTable('Foo')); } public function testGetUnknownTableThrowsException() @@ -62,11 +62,11 @@ public function testRenameTable() $table = new Table($tableName); $schema = new Schema(array($table)); - $this->assertTrue($schema->hasTable("foo")); + self::assertTrue($schema->hasTable("foo")); $schema->renameTable("foo", "bar"); - $this->assertFalse($schema->hasTable("foo")); - $this->assertTrue($schema->hasTable("bar")); - $this->assertSame($table, $schema->getTable("bar")); + self::assertFalse($schema->hasTable("foo")); + self::assertTrue($schema->hasTable("bar")); + self::assertSame($table, $schema->getTable("bar")); } public function testDropTable() @@ -75,24 +75,24 @@ public function testDropTable() $table = new Table($tableName); $schema = new Schema(array($table)); - $this->assertTrue($schema->hasTable("foo")); + self::assertTrue($schema->hasTable("foo")); $schema->dropTable("foo"); - $this->assertFalse($schema->hasTable("foo")); + self::assertFalse($schema->hasTable("foo")); } public function testCreateTable() { $schema = new Schema(); - $this->assertFalse($schema->hasTable("foo")); + self::assertFalse($schema->hasTable("foo")); $table = $schema->createTable("foo"); - $this->assertInstanceOf('Doctrine\DBAL\Schema\Table', $table); - $this->assertEquals("foo", $table->getName()); - $this->assertTrue($schema->hasTable("foo")); + self::assertInstanceOf('Doctrine\DBAL\Schema\Table', $table); + self::assertEquals("foo", $table->getName()); + self::assertTrue($schema->hasTable("foo")); } public function testAddSequences() @@ -101,11 +101,11 @@ public function testAddSequences() $schema = new Schema(array(), array($sequence)); - $this->assertTrue($schema->hasSequence("a_seq")); - $this->assertInstanceOf('Doctrine\DBAL\Schema\Sequence', $schema->getSequence("a_seq")); + self::assertTrue($schema->hasSequence("a_seq")); + self::assertInstanceOf('Doctrine\DBAL\Schema\Sequence', $schema->getSequence("a_seq")); $sequences = $schema->getSequences(); - $this->assertArrayHasKey('public.a_seq', $sequences); + self::assertArrayHasKey('public.a_seq', $sequences); } public function testSequenceAccessCaseInsensitive() @@ -113,13 +113,13 @@ public function testSequenceAccessCaseInsensitive() $sequence = new Sequence("a_Seq"); $schema = new Schema(array(), array($sequence)); - $this->assertTrue($schema->hasSequence('a_seq')); - $this->assertTrue($schema->hasSequence('a_Seq')); - $this->assertTrue($schema->hasSequence('A_SEQ')); + self::assertTrue($schema->hasSequence('a_seq')); + self::assertTrue($schema->hasSequence('a_Seq')); + self::assertTrue($schema->hasSequence('A_SEQ')); - $this->assertEquals($sequence, $schema->getSequence('a_seq')); - $this->assertEquals($sequence, $schema->getSequence('a_Seq')); - $this->assertEquals($sequence, $schema->getSequence('A_SEQ')); + self::assertEquals($sequence, $schema->getSequence('a_seq')); + self::assertEquals($sequence, $schema->getSequence('a_Seq')); + self::assertEquals($sequence, $schema->getSequence('A_SEQ')); } public function testGetUnknownSequenceThrowsException() @@ -135,15 +135,15 @@ public function testCreateSequence() $schema = new Schema(); $sequence = $schema->createSequence('a_seq', 10, 20); - $this->assertEquals('a_seq', $sequence->getName()); - $this->assertEquals(10, $sequence->getAllocationSize()); - $this->assertEquals(20, $sequence->getInitialValue()); + self::assertEquals('a_seq', $sequence->getName()); + self::assertEquals(10, $sequence->getAllocationSize()); + self::assertEquals(20, $sequence->getInitialValue()); - $this->assertTrue($schema->hasSequence("a_seq")); - $this->assertInstanceOf('Doctrine\DBAL\Schema\Sequence', $schema->getSequence("a_seq")); + self::assertTrue($schema->hasSequence("a_seq")); + self::assertInstanceOf('Doctrine\DBAL\Schema\Sequence', $schema->getSequence("a_seq")); $sequences = $schema->getSequences(); - $this->assertArrayHasKey('public.a_seq', $sequences); + self::assertArrayHasKey('public.a_seq', $sequences); } public function testDropSequence() @@ -153,7 +153,7 @@ public function testDropSequence() $schema = new Schema(array(), array($sequence)); $schema->dropSequence("a_seq"); - $this->assertFalse($schema->hasSequence("a_seq")); + self::assertFalse($schema->hasSequence("a_seq")); } public function testAddSequenceTwiceThrowsException() @@ -176,7 +176,7 @@ public function testConfigMaxIdentifierLength() $table->addIndex(array('long_id')); $index = current($table->getIndexes()); - $this->assertEquals(5, strlen($index->getName())); + self::assertEquals(5, strlen($index->getName())); } public function testDeepClone() @@ -194,17 +194,17 @@ public function testDeepClone() $schemaNew = clone $schema; - $this->assertNotSame($sequence, $schemaNew->getSequence('baz')); + self::assertNotSame($sequence, $schemaNew->getSequence('baz')); - $this->assertNotSame($tableA, $schemaNew->getTable('foo')); - $this->assertNotSame($tableA->getColumn('id'), $schemaNew->getTable('foo')->getColumn('id')); + self::assertNotSame($tableA, $schemaNew->getTable('foo')); + self::assertNotSame($tableA->getColumn('id'), $schemaNew->getTable('foo')->getColumn('id')); - $this->assertNotSame($tableB, $schemaNew->getTable('bar')); - $this->assertNotSame($tableB->getColumn('id'), $schemaNew->getTable('bar')->getColumn('id')); + self::assertNotSame($tableB, $schemaNew->getTable('bar')); + self::assertNotSame($tableB->getColumn('id'), $schemaNew->getTable('bar')->getColumn('id')); $fk = $schemaNew->getTable('bar')->getForeignKeys(); $fk = current($fk); - $this->assertSame($schemaNew->getTable('bar'), $this->readAttribute($fk, '_localTable')); + self::assertSame($schemaNew->getTable('bar'), $this->readAttribute($fk, '_localTable')); } /** @@ -217,7 +217,7 @@ public function testHasTableForQuotedAsset() $tableA = $schema->createTable('foo'); $tableA->addColumn('id', 'integer'); - $this->assertTrue($schema->hasTable('`foo`')); + self::assertTrue($schema->hasTable('`foo`')); } /** @@ -227,21 +227,21 @@ public function testHasNamespace() { $schema = new Schema(); - $this->assertFalse($schema->hasNamespace('foo')); + self::assertFalse($schema->hasNamespace('foo')); $schema->createTable('foo'); - $this->assertFalse($schema->hasNamespace('foo')); + self::assertFalse($schema->hasNamespace('foo')); $schema->createTable('bar.baz'); - $this->assertFalse($schema->hasNamespace('baz')); - $this->assertTrue($schema->hasNamespace('bar')); - $this->assertFalse($schema->hasNamespace('tab')); + self::assertFalse($schema->hasNamespace('baz')); + self::assertTrue($schema->hasNamespace('bar')); + self::assertFalse($schema->hasNamespace('tab')); $schema->createTable('tab.taz'); - $this->assertTrue($schema->hasNamespace('tab')); + self::assertTrue($schema->hasNamespace('tab')); } /** @@ -251,23 +251,23 @@ public function testCreatesNamespace() { $schema = new Schema(); - $this->assertFalse($schema->hasNamespace('foo')); + self::assertFalse($schema->hasNamespace('foo')); $schema->createNamespace('foo'); - $this->assertTrue($schema->hasNamespace('foo')); - $this->assertTrue($schema->hasNamespace('FOO')); - $this->assertTrue($schema->hasNamespace('`foo`')); - $this->assertTrue($schema->hasNamespace('`FOO`')); + self::assertTrue($schema->hasNamespace('foo')); + self::assertTrue($schema->hasNamespace('FOO')); + self::assertTrue($schema->hasNamespace('`foo`')); + self::assertTrue($schema->hasNamespace('`FOO`')); $schema->createNamespace('`bar`'); - $this->assertTrue($schema->hasNamespace('bar')); - $this->assertTrue($schema->hasNamespace('BAR')); - $this->assertTrue($schema->hasNamespace('`bar`')); - $this->assertTrue($schema->hasNamespace('`BAR`')); + self::assertTrue($schema->hasNamespace('bar')); + self::assertTrue($schema->hasNamespace('BAR')); + self::assertTrue($schema->hasNamespace('`bar`')); + self::assertTrue($schema->hasNamespace('`BAR`')); - $this->assertSame(array('foo' => 'foo', 'bar' => '`bar`'), $schema->getNamespaces()); + self::assertSame(array('foo' => 'foo', 'bar' => '`bar`'), $schema->getNamespaces()); } /** @@ -290,27 +290,27 @@ public function testCreatesNamespaceThroughAddingTableImplicitly() { $schema = new Schema(); - $this->assertFalse($schema->hasNamespace('foo')); + self::assertFalse($schema->hasNamespace('foo')); $schema->createTable('baz'); - $this->assertFalse($schema->hasNamespace('foo')); - $this->assertFalse($schema->hasNamespace('baz')); + self::assertFalse($schema->hasNamespace('foo')); + self::assertFalse($schema->hasNamespace('baz')); $schema->createTable('foo.bar'); - $this->assertTrue($schema->hasNamespace('foo')); - $this->assertFalse($schema->hasNamespace('bar')); + self::assertTrue($schema->hasNamespace('foo')); + self::assertFalse($schema->hasNamespace('bar')); $schema->createTable('`baz`.bloo'); - $this->assertTrue($schema->hasNamespace('baz')); - $this->assertFalse($schema->hasNamespace('bloo')); + self::assertTrue($schema->hasNamespace('baz')); + self::assertFalse($schema->hasNamespace('bloo')); $schema->createTable('`baz`.moo'); - $this->assertTrue($schema->hasNamespace('baz')); - $this->assertFalse($schema->hasNamespace('moo')); + self::assertTrue($schema->hasNamespace('baz')); + self::assertFalse($schema->hasNamespace('moo')); } /** @@ -320,27 +320,27 @@ public function testCreatesNamespaceThroughAddingSequenceImplicitly() { $schema = new Schema(); - $this->assertFalse($schema->hasNamespace('foo')); + self::assertFalse($schema->hasNamespace('foo')); $schema->createSequence('baz'); - $this->assertFalse($schema->hasNamespace('foo')); - $this->assertFalse($schema->hasNamespace('baz')); + self::assertFalse($schema->hasNamespace('foo')); + self::assertFalse($schema->hasNamespace('baz')); $schema->createSequence('foo.bar'); - $this->assertTrue($schema->hasNamespace('foo')); - $this->assertFalse($schema->hasNamespace('bar')); + self::assertTrue($schema->hasNamespace('foo')); + self::assertFalse($schema->hasNamespace('bar')); $schema->createSequence('`baz`.bloo'); - $this->assertTrue($schema->hasNamespace('baz')); - $this->assertFalse($schema->hasNamespace('bloo')); + self::assertTrue($schema->hasNamespace('baz')); + self::assertFalse($schema->hasNamespace('bloo')); $schema->createSequence('`baz`.moo'); - $this->assertTrue($schema->hasNamespace('baz')); - $this->assertFalse($schema->hasNamespace('moo')); + self::assertTrue($schema->hasNamespace('baz')); + self::assertFalse($schema->hasNamespace('moo')); } /** @@ -386,7 +386,7 @@ public function testVisitsVisitor() $visitor->expects($this->exactly(2)) ->method('acceptSequence'); - $this->assertNull($schema->visit($visitor)); + self::assertNull($schema->visit($visitor)); } /** @@ -447,6 +447,6 @@ public function testVisitsNamespaceVisitor() $visitor->expects($this->exactly(2)) ->method('acceptSequence'); - $this->assertNull($schema->visit($visitor)); + self::assertNull($schema->visit($visitor)); } } diff --git a/tests/Doctrine/Tests/DBAL/Schema/SequenceTest.php b/tests/Doctrine/Tests/DBAL/Schema/SequenceTest.php index 13b0f102f84..9414830b48a 100644 --- a/tests/Doctrine/Tests/DBAL/Schema/SequenceTest.php +++ b/tests/Doctrine/Tests/DBAL/Schema/SequenceTest.php @@ -20,9 +20,9 @@ public function testIsAutoincrementFor() $sequence2 = new Sequence("bar_id_seq"); $sequence3 = new Sequence("other.foo_id_seq"); - $this->assertTrue($sequence->isAutoIncrementsFor($table)); - $this->assertFalse($sequence2->isAutoIncrementsFor($table)); - $this->assertFalse($sequence3->isAutoIncrementsFor($table)); + self::assertTrue($sequence->isAutoIncrementsFor($table)); + self::assertFalse($sequence2->isAutoIncrementsFor($table)); + self::assertFalse($sequence3->isAutoIncrementsFor($table)); } public function testIsAutoincrementForCaseInsensitive() @@ -37,11 +37,11 @@ public function testIsAutoincrementForCaseInsensitive() $sequence3 = new Sequence("bar_ID_seq"); $sequence4 = new Sequence("other.foo_id_seq"); - $this->assertTrue($sequence->isAutoIncrementsFor($table)); - $this->assertTrue($sequence1->isAutoIncrementsFor($table)); - $this->assertFalse($sequence2->isAutoIncrementsFor($table)); - $this->assertFalse($sequence3->isAutoIncrementsFor($table)); - $this->assertFalse($sequence4->isAutoIncrementsFor($table)); + self::assertTrue($sequence->isAutoIncrementsFor($table)); + self::assertTrue($sequence1->isAutoIncrementsFor($table)); + self::assertFalse($sequence2->isAutoIncrementsFor($table)); + self::assertFalse($sequence3->isAutoIncrementsFor($table)); + self::assertFalse($sequence4->isAutoIncrementsFor($table)); } } diff --git a/tests/Doctrine/Tests/DBAL/Schema/SqliteSchemaManagerTest.php b/tests/Doctrine/Tests/DBAL/Schema/SqliteSchemaManagerTest.php index 656d8717804..874e0734112 100644 --- a/tests/Doctrine/Tests/DBAL/Schema/SqliteSchemaManagerTest.php +++ b/tests/Doctrine/Tests/DBAL/Schema/SqliteSchemaManagerTest.php @@ -19,7 +19,7 @@ public function testParseColumnCollation($collation, $column, $sql) $ref = new \ReflectionMethod($manager, 'parseColumnCollationFromSQL'); $ref->setAccessible(true); - $this->assertEquals($collation, $ref->invoke($manager, $column, $sql)); + self::assertEquals($collation, $ref->invoke($manager, $column, $sql)); } public function getDataColumnCollation() diff --git a/tests/Doctrine/Tests/DBAL/Schema/Synchronizer/SingleDatabaseSynchronizerTest.php b/tests/Doctrine/Tests/DBAL/Schema/Synchronizer/SingleDatabaseSynchronizerTest.php index b01ab85deff..06b30e08d28 100644 --- a/tests/Doctrine/Tests/DBAL/Schema/Synchronizer/SingleDatabaseSynchronizerTest.php +++ b/tests/Doctrine/Tests/DBAL/Schema/Synchronizer/SingleDatabaseSynchronizerTest.php @@ -45,7 +45,7 @@ public function testGetCreateSchema() $table->setPrimaryKey(array('id')); $sql = $this->synchronizer->getCreateSchema($schema); - $this->assertEquals(array('CREATE TABLE test (id INTEGER NOT NULL, PRIMARY KEY(id))'), $sql); + self::assertEquals(array('CREATE TABLE test (id INTEGER NOT NULL, PRIMARY KEY(id))'), $sql); } public function testGetUpdateSchema() @@ -56,7 +56,7 @@ public function testGetUpdateSchema() $table->setPrimaryKey(array('id')); $sql = $this->synchronizer->getUpdateSchema($schema); - $this->assertEquals(array('CREATE TABLE test (id INTEGER NOT NULL, PRIMARY KEY(id))'), $sql); + self::assertEquals(array('CREATE TABLE test (id INTEGER NOT NULL, PRIMARY KEY(id))'), $sql); } public function testGetDropSchema() @@ -69,7 +69,7 @@ public function testGetDropSchema() $this->synchronizer->createSchema($schema); $sql = $this->synchronizer->getDropSchema($schema); - $this->assertEquals(array('DROP TABLE test'), $sql); + self::assertEquals(array('DROP TABLE test'), $sql); } public function testGetDropAllSchema() @@ -82,7 +82,7 @@ public function testGetDropAllSchema() $this->synchronizer->createSchema($schema); $sql = $this->synchronizer->getDropAllSchema(); - $this->assertEquals(array('DROP TABLE test'), $sql); + self::assertEquals(array('DROP TABLE test'), $sql); } } diff --git a/tests/Doctrine/Tests/DBAL/Schema/TableDiffTest.php b/tests/Doctrine/Tests/DBAL/Schema/TableDiffTest.php index 239038ea8ad..f78d9519a12 100644 --- a/tests/Doctrine/Tests/DBAL/Schema/TableDiffTest.php +++ b/tests/Doctrine/Tests/DBAL/Schema/TableDiffTest.php @@ -15,7 +15,7 @@ public function testReturnsName() { $tableDiff = new TableDiff('foo'); - $this->assertEquals(new Identifier('foo'), $tableDiff->getName(new MockPlatform())); + self::assertEquals(new Identifier('foo'), $tableDiff->getName(new MockPlatform())); } /** @@ -36,7 +36,7 @@ public function testPrefersNameFromTableObject() ->with($platformMock) ->will($this->returnValue('foo')); - $this->assertEquals(new Identifier('foo'), $tableDiff->getName($platformMock)); + self::assertEquals(new Identifier('foo'), $tableDiff->getName($platformMock)); } /** @@ -46,10 +46,10 @@ public function testReturnsNewName() { $tableDiff = new TableDiff('foo'); - $this->assertFalse($tableDiff->getNewName()); + self::assertFalse($tableDiff->getNewName()); $tableDiff->newName = 'bar'; - $this->assertEquals(new Identifier('bar'), $tableDiff->getNewName()); + self::assertEquals(new Identifier('bar'), $tableDiff->getNewName()); } } diff --git a/tests/Doctrine/Tests/DBAL/Schema/TableTest.php b/tests/Doctrine/Tests/DBAL/Schema/TableTest.php index c0f5484ad1f..0ef0fac9de0 100644 --- a/tests/Doctrine/Tests/DBAL/Schema/TableTest.php +++ b/tests/Doctrine/Tests/DBAL/Schema/TableTest.php @@ -21,7 +21,7 @@ public function testCreateWithInvalidTableName() public function testGetName() { $table = new Table("foo", array(), array(), array()); - $this->assertEquals("foo", $table->getName()); + self::assertEquals("foo", $table->getName()); } public function testColumns() @@ -32,14 +32,14 @@ public function testColumns() $columns[] = new Column("bar", $type); $table = new Table("foo", $columns, array(), array()); - $this->assertTrue($table->hasColumn("foo")); - $this->assertTrue($table->hasColumn("bar")); - $this->assertFalse($table->hasColumn("baz")); + self::assertTrue($table->hasColumn("foo")); + self::assertTrue($table->hasColumn("bar")); + self::assertFalse($table->hasColumn("baz")); - $this->assertInstanceOf('Doctrine\DBAL\Schema\Column', $table->getColumn("foo")); - $this->assertInstanceOf('Doctrine\DBAL\Schema\Column', $table->getColumn("bar")); + self::assertInstanceOf('Doctrine\DBAL\Schema\Column', $table->getColumn("foo")); + self::assertInstanceOf('Doctrine\DBAL\Schema\Column', $table->getColumn("bar")); - $this->assertEquals(2, count($table->getColumns())); + self::assertEquals(2, count($table->getColumns())); } public function testColumnsCaseInsensitive() @@ -47,13 +47,13 @@ public function testColumnsCaseInsensitive() $table = new Table("foo"); $column = $table->addColumn('Foo', 'integer'); - $this->assertTrue($table->hasColumn('Foo')); - $this->assertTrue($table->hasColumn('foo')); - $this->assertTrue($table->hasColumn('FOO')); + self::assertTrue($table->hasColumn('Foo')); + self::assertTrue($table->hasColumn('foo')); + self::assertTrue($table->hasColumn('FOO')); - $this->assertSame($column, $table->getColumn('Foo')); - $this->assertSame($column, $table->getColumn('foo')); - $this->assertSame($column, $table->getColumn('FOO')); + self::assertSame($column, $table->getColumn('Foo')); + self::assertSame($column, $table->getColumn('foo')); + self::assertSame($column, $table->getColumn('FOO')); } public function testCreateColumn() @@ -62,10 +62,10 @@ public function testCreateColumn() $table = new Table("foo"); - $this->assertFalse($table->hasColumn("bar")); + self::assertFalse($table->hasColumn("bar")); $table->addColumn("bar", 'integer'); - $this->assertTrue($table->hasColumn("bar")); - $this->assertSame($type, $table->getColumn("bar")->getType()); + self::assertTrue($table->hasColumn("bar")); + self::assertSame($type, $table->getColumn("bar")->getType()); } public function testDropColumn() @@ -76,13 +76,13 @@ public function testDropColumn() $columns[] = new Column("bar", $type); $table = new Table("foo", $columns, array(), array()); - $this->assertTrue($table->hasColumn("foo")); - $this->assertTrue($table->hasColumn("bar")); + self::assertTrue($table->hasColumn("foo")); + self::assertTrue($table->hasColumn("bar")); $table->dropColumn("foo")->dropColumn("bar"); - $this->assertFalse($table->hasColumn("foo")); - $this->assertFalse($table->hasColumn("bar")); + self::assertFalse($table->hasColumn("foo")); + self::assertFalse($table->hasColumn("bar")); } public function testGetUnknownColumnThrowsException() @@ -113,8 +113,8 @@ public function testCreateIndex() $table->addIndex(array("foo", "bar"), "foo_foo_bar_idx"); $table->addUniqueIndex(array("bar", "baz"), "foo_bar_baz_uniq"); - $this->assertTrue($table->hasIndex("foo_foo_bar_idx")); - $this->assertTrue($table->hasIndex("foo_bar_baz_uniq")); + self::assertTrue($table->hasIndex("foo_foo_bar_idx")); + self::assertTrue($table->hasIndex("foo_bar_baz_uniq")); } public function testIndexCaseInsensitive() @@ -129,9 +129,9 @@ public function testIndexCaseInsensitive() $table->addIndex(array("foo", "bar", "baz"), "Foo_Idx"); - $this->assertTrue($table->hasIndex('foo_idx')); - $this->assertTrue($table->hasIndex('Foo_Idx')); - $this->assertTrue($table->hasIndex('FOO_IDX')); + self::assertTrue($table->hasIndex('foo_idx')); + self::assertTrue($table->hasIndex('Foo_Idx')); + self::assertTrue($table->hasIndex('FOO_IDX')); } public function testAddIndexes() @@ -147,13 +147,13 @@ public function testAddIndexes() ); $table = new Table("foo", $columns, $indexes, array()); - $this->assertTrue($table->hasIndex("the_primary")); - $this->assertTrue($table->hasIndex("bar_idx")); - $this->assertFalse($table->hasIndex("some_idx")); + self::assertTrue($table->hasIndex("the_primary")); + self::assertTrue($table->hasIndex("bar_idx")); + self::assertFalse($table->hasIndex("some_idx")); - $this->assertInstanceOf('Doctrine\DBAL\Schema\Index', $table->getPrimaryKey()); - $this->assertInstanceOf('Doctrine\DBAL\Schema\Index', $table->getIndex('the_primary')); - $this->assertInstanceOf('Doctrine\DBAL\Schema\Index', $table->getIndex('bar_idx')); + self::assertInstanceOf('Doctrine\DBAL\Schema\Index', $table->getPrimaryKey()); + self::assertInstanceOf('Doctrine\DBAL\Schema\Index', $table->getIndex('the_primary')); + self::assertInstanceOf('Doctrine\DBAL\Schema\Index', $table->getIndex('bar_idx')); } public function testGetUnknownIndexThrowsException() @@ -197,16 +197,16 @@ public function testConstraints() $tableA = new Table("foo", array(), array(), array($constraint)); $constraints = $tableA->getForeignKeys(); - $this->assertEquals(1, count($constraints)); - $this->assertSame($constraint, array_shift($constraints)); + self::assertEquals(1, count($constraints)); + self::assertSame($constraint, array_shift($constraints)); } public function testOptions() { $table = new Table("foo", array(), array(), array(), false, array("foo" => "bar")); - $this->assertTrue($table->hasOption("foo")); - $this->assertEquals("bar", $table->getOption("foo")); + self::assertTrue($table->hasOption("foo")); + self::assertEquals("bar", $table->getOption("foo")); } public function testBuilderSetPrimaryKey() @@ -216,10 +216,10 @@ public function testBuilderSetPrimaryKey() $table->addColumn("bar", 'integer'); $table->setPrimaryKey(array("bar")); - $this->assertTrue($table->hasIndex("primary")); - $this->assertInstanceOf('Doctrine\DBAL\Schema\Index', $table->getPrimaryKey()); - $this->assertTrue($table->getIndex("primary")->isUnique()); - $this->assertTrue($table->getIndex("primary")->isPrimary()); + self::assertTrue($table->hasIndex("primary")); + self::assertInstanceOf('Doctrine\DBAL\Schema\Index', $table->getPrimaryKey()); + self::assertTrue($table->getIndex("primary")->isUnique()); + self::assertTrue($table->getIndex("primary")->isPrimary()); } public function testBuilderAddUniqueIndex() @@ -229,9 +229,9 @@ public function testBuilderAddUniqueIndex() $table->addColumn("bar", 'integer'); $table->addUniqueIndex(array("bar"), "my_idx"); - $this->assertTrue($table->hasIndex("my_idx")); - $this->assertTrue($table->getIndex("my_idx")->isUnique()); - $this->assertFalse($table->getIndex("my_idx")->isPrimary()); + self::assertTrue($table->hasIndex("my_idx")); + self::assertTrue($table->getIndex("my_idx")->isUnique()); + self::assertFalse($table->getIndex("my_idx")->isPrimary()); } public function testBuilderAddIndex() @@ -241,9 +241,9 @@ public function testBuilderAddIndex() $table->addColumn("bar", 'integer'); $table->addIndex(array("bar"), "my_idx"); - $this->assertTrue($table->hasIndex("my_idx")); - $this->assertFalse($table->getIndex("my_idx")->isUnique()); - $this->assertFalse($table->getIndex("my_idx")->isPrimary()); + self::assertTrue($table->hasIndex("my_idx")); + self::assertFalse($table->getIndex("my_idx")->isUnique()); + self::assertFalse($table->getIndex("my_idx")->isPrimary()); } public function testBuilderAddIndexWithInvalidNameThrowsException() @@ -267,8 +267,8 @@ public function testBuilderOptions() { $table = new Table("foo"); $table->addOption("foo", "bar"); - $this->assertTrue($table->hasOption("foo")); - $this->assertEquals("bar", $table->getOption("foo")); + self::assertTrue($table->hasOption("foo")); + self::assertEquals("bar", $table->getOption("foo")); } public function testAddForeignKeyConstraint_UnknownLocalColumn_ThrowsException() @@ -308,13 +308,13 @@ public function testAddForeignKeyConstraint() $table->addForeignKeyConstraint($foreignTable, array("id"), array("id"), array("foo" => "bar")); $constraints = $table->getForeignKeys(); - $this->assertEquals(1, count($constraints)); + self::assertEquals(1, count($constraints)); $constraint = current($constraints); - $this->assertInstanceOf('Doctrine\DBAL\Schema\ForeignKeyConstraint', $constraint); + self::assertInstanceOf('Doctrine\DBAL\Schema\ForeignKeyConstraint', $constraint); - $this->assertTrue($constraint->hasOption("foo")); - $this->assertEquals("bar", $constraint->getOption("foo")); + self::assertTrue($constraint->hasOption("foo")); + self::assertEquals("bar", $constraint->getOption("foo")); } public function testAddIndexWithCaseSensitiveColumnProblem() @@ -324,9 +324,9 @@ public function testAddIndexWithCaseSensitiveColumnProblem() $table->addIndex(array("ID"), "my_idx"); - $this->assertTrue($table->hasIndex('my_idx')); - $this->assertEquals(array("ID"), $table->getIndex("my_idx")->getColumns()); - $this->assertTrue($table->getIndex('my_idx')->spansColumns(array('id'))); + self::assertTrue($table->hasIndex('my_idx')); + self::assertEquals(array("ID"), $table->getIndex("my_idx")->getColumns()); + self::assertTrue($table->getIndex('my_idx')->spansColumns(array('id'))); } public function testAddPrimaryKey_ColumnsAreExplicitlySetToNotNull() @@ -334,11 +334,11 @@ public function testAddPrimaryKey_ColumnsAreExplicitlySetToNotNull() $table = new Table("foo"); $column = $table->addColumn("id", 'integer', array('notnull' => false)); - $this->assertFalse($column->getNotnull()); + self::assertFalse($column->getNotnull()); $table->setPrimaryKey(array('id')); - $this->assertTrue($column->getNotnull()); + self::assertTrue($column->getNotnull()); } /** @@ -350,7 +350,7 @@ public function testAllowImplicitSchemaTableInAutogeneratedIndexNames() $table->addColumn('baz', 'integer', array()); $table->addIndex(array('baz')); - $this->assertEquals(1, count($table->getIndexes())); + self::assertEquals(1, count($table->getIndexes())); } /** @@ -367,11 +367,11 @@ public function testAddForeignKeyIndexImplicitly() $table->addForeignKeyConstraint($foreignTable, array("id"), array("id"), array("foo" => "bar")); $indexes = $table->getIndexes(); - $this->assertEquals(1, count($indexes)); + self::assertEquals(1, count($indexes)); $index = current($indexes); - $this->assertTrue($table->hasIndex($index->getName())); - $this->assertEquals(array('id'), $index->getColumns()); + self::assertTrue($table->hasIndex($index->getName())); + self::assertEquals(array('id'), $index->getColumns()); } /** @@ -388,9 +388,9 @@ public function testAddForeignKeyDoesNotCreateDuplicateIndex() $table->addForeignKeyConstraint($foreignTable, array('bar'), array('foo')); - $this->assertCount(1, $table->getIndexes()); - $this->assertTrue($table->hasIndex('bar_idx')); - $this->assertSame(array('bar'), $table->getIndex('bar_idx')->getColumns()); + self::assertCount(1, $table->getIndexes()); + self::assertTrue($table->hasIndex('bar_idx')); + self::assertSame(array('bar'), $table->getIndex('bar_idx')->getColumns()); } /** @@ -411,13 +411,13 @@ public function testAddForeignKeyAddsImplicitIndexIfIndexColumnsDoNotSpan() $table->addForeignKeyConstraint($foreignTable, array('bar', 'baz'), array('foo', 'baz')); - $this->assertCount(3, $table->getIndexes()); - $this->assertTrue($table->hasIndex('composite_idx')); - $this->assertTrue($table->hasIndex('full_idx')); - $this->assertTrue($table->hasIndex('idx_8c73652176ff8caa78240498')); - $this->assertSame(array('baz', 'bar'), $table->getIndex('composite_idx')->getColumns()); - $this->assertSame(array('bar', 'baz', 'bloo'), $table->getIndex('full_idx')->getColumns()); - $this->assertSame(array('bar', 'baz'), $table->getIndex('idx_8c73652176ff8caa78240498')->getColumns()); + self::assertCount(3, $table->getIndexes()); + self::assertTrue($table->hasIndex('composite_idx')); + self::assertTrue($table->hasIndex('full_idx')); + self::assertTrue($table->hasIndex('idx_8c73652176ff8caa78240498')); + self::assertSame(array('baz', 'bar'), $table->getIndex('composite_idx')->getColumns()); + self::assertSame(array('bar', 'baz', 'bloo'), $table->getIndex('full_idx')->getColumns()); + self::assertSame(array('bar', 'baz'), $table->getIndex('idx_8c73652176ff8caa78240498')->getColumns()); } /** @@ -431,12 +431,12 @@ public function testOverrulingIndexDoesNotDropOverruledIndex() $table->addIndex(array('baz')); $indexes = $table->getIndexes(); - $this->assertEquals(1, count($indexes)); + self::assertEquals(1, count($indexes)); $index = current($indexes); $table->addUniqueIndex(array('baz')); - $this->assertEquals(2, count($table->getIndexes())); - $this->assertTrue($table->hasIndex($index->getName())); + self::assertEquals(2, count($table->getIndexes())); + self::assertTrue($table->hasIndex($index->getName())); } /** @@ -449,11 +449,11 @@ public function testAllowsAddingDuplicateIndexesBasedOnColumns() $table->addIndex(array('bar'), 'bar_idx'); $table->addIndex(array('bar'), 'duplicate_idx'); - $this->assertCount(2, $table->getIndexes()); - $this->assertTrue($table->hasIndex('bar_idx')); - $this->assertTrue($table->hasIndex('duplicate_idx')); - $this->assertSame(array('bar'), $table->getIndex('bar_idx')->getColumns()); - $this->assertSame(array('bar'), $table->getIndex('duplicate_idx')->getColumns()); + self::assertCount(2, $table->getIndexes()); + self::assertTrue($table->hasIndex('bar_idx')); + self::assertTrue($table->hasIndex('duplicate_idx')); + self::assertSame(array('bar'), $table->getIndex('bar_idx')->getColumns()); + self::assertSame(array('bar'), $table->getIndex('duplicate_idx')->getColumns()); } /** @@ -467,11 +467,11 @@ public function testAllowsAddingFulfillingIndexesBasedOnColumns() $table->addIndex(array('bar'), 'bar_idx'); $table->addIndex(array('bar', 'baz'), 'fulfilling_idx'); - $this->assertCount(2, $table->getIndexes()); - $this->assertTrue($table->hasIndex('bar_idx')); - $this->assertTrue($table->hasIndex('fulfilling_idx')); - $this->assertSame(array('bar'), $table->getIndex('bar_idx')->getColumns()); - $this->assertSame(array('bar', 'baz'), $table->getIndex('fulfilling_idx')->getColumns()); + self::assertCount(2, $table->getIndexes()); + self::assertTrue($table->hasIndex('bar_idx')); + self::assertTrue($table->hasIndex('fulfilling_idx')); + self::assertSame(array('bar'), $table->getIndex('bar_idx')->getColumns()); + self::assertSame(array('bar', 'baz'), $table->getIndex('fulfilling_idx')->getColumns()); } /** @@ -487,10 +487,10 @@ public function testPrimaryKeyOverrulingUniqueIndexDoesNotDropUniqueIndex() $table->setPrimaryKey(array('baz')); $indexes = $table->getIndexes(); - $this->assertEquals(2, count($indexes), "Table should only contain both the primary key table index and the unique one, even though it was overruled."); + self::assertEquals(2, count($indexes), "Table should only contain both the primary key table index and the unique one, even though it was overruled."); - $this->assertTrue($table->hasPrimaryKey()); - $this->assertTrue($table->hasIndex('idx_unique')); + self::assertTrue($table->hasPrimaryKey()); + self::assertTrue($table->hasIndex('idx_unique')); } public function testAddingFulfillingRegularIndexOverridesImplicitForeignKeyConstraintIndex() @@ -502,12 +502,12 @@ public function testAddingFulfillingRegularIndexOverridesImplicitForeignKeyConst $localTable->addColumn('id', 'integer'); $localTable->addForeignKeyConstraint($foreignTable, array('id'), array('id')); - $this->assertCount(1, $localTable->getIndexes()); + self::assertCount(1, $localTable->getIndexes()); $localTable->addIndex(array('id'), 'explicit_idx'); - $this->assertCount(1, $localTable->getIndexes()); - $this->assertTrue($localTable->hasIndex('explicit_idx')); + self::assertCount(1, $localTable->getIndexes()); + self::assertTrue($localTable->hasIndex('explicit_idx')); } public function testAddingFulfillingUniqueIndexOverridesImplicitForeignKeyConstraintIndex() @@ -519,12 +519,12 @@ public function testAddingFulfillingUniqueIndexOverridesImplicitForeignKeyConstr $localTable->addColumn('id', 'integer'); $localTable->addForeignKeyConstraint($foreignTable, array('id'), array('id')); - $this->assertCount(1, $localTable->getIndexes()); + self::assertCount(1, $localTable->getIndexes()); $localTable->addUniqueIndex(array('id'), 'explicit_idx'); - $this->assertCount(1, $localTable->getIndexes()); - $this->assertTrue($localTable->hasIndex('explicit_idx')); + self::assertCount(1, $localTable->getIndexes()); + self::assertTrue($localTable->hasIndex('explicit_idx')); } public function testAddingFulfillingPrimaryKeyOverridesImplicitForeignKeyConstraintIndex() @@ -536,12 +536,12 @@ public function testAddingFulfillingPrimaryKeyOverridesImplicitForeignKeyConstra $localTable->addColumn('id', 'integer'); $localTable->addForeignKeyConstraint($foreignTable, array('id'), array('id')); - $this->assertCount(1, $localTable->getIndexes()); + self::assertCount(1, $localTable->getIndexes()); $localTable->setPrimaryKey(array('id'), 'explicit_idx'); - $this->assertCount(1, $localTable->getIndexes()); - $this->assertTrue($localTable->hasIndex('explicit_idx')); + self::assertCount(1, $localTable->getIndexes()); + self::assertTrue($localTable->hasIndex('explicit_idx')); } public function testAddingFulfillingExplicitIndexOverridingImplicitForeignKeyConstraintIndexWithSameNameDoesNotThrowException() @@ -553,16 +553,16 @@ public function testAddingFulfillingExplicitIndexOverridingImplicitForeignKeyCon $localTable->addColumn('id', 'integer'); $localTable->addForeignKeyConstraint($foreignTable, array('id'), array('id')); - $this->assertCount(1, $localTable->getIndexes()); - $this->assertTrue($localTable->hasIndex('IDX_8BD688E8BF396750')); + self::assertCount(1, $localTable->getIndexes()); + self::assertTrue($localTable->hasIndex('IDX_8BD688E8BF396750')); $implicitIndex = $localTable->getIndex('IDX_8BD688E8BF396750'); $localTable->addIndex(array('id'), 'IDX_8BD688E8BF396750'); - $this->assertCount(1, $localTable->getIndexes()); - $this->assertTrue($localTable->hasIndex('IDX_8BD688E8BF396750')); - $this->assertNotSame($implicitIndex, $localTable->getIndex('IDX_8BD688E8BF396750')); + self::assertCount(1, $localTable->getIndexes()); + self::assertTrue($localTable->hasIndex('IDX_8BD688E8BF396750')); + self::assertNotSame($implicitIndex, $localTable->getIndex('IDX_8BD688E8BF396750')); } /** @@ -575,9 +575,9 @@ public function testQuotedTableName() $mysqlPlatform = new \Doctrine\DBAL\Platforms\MySqlPlatform(); $sqlitePlatform = new \Doctrine\DBAL\Platforms\SqlitePlatform(); - $this->assertEquals('bar', $table->getName()); - $this->assertEquals('`bar`', $table->getQuotedName($mysqlPlatform)); - $this->assertEquals('"bar"', $table->getQuotedName($sqlitePlatform)); + self::assertEquals('bar', $table->getName()); + self::assertEquals('`bar`', $table->getQuotedName($mysqlPlatform)); + self::assertEquals('"bar"', $table->getQuotedName($sqlitePlatform)); } /** @@ -587,12 +587,12 @@ public function testTableHasPrimaryKey() { $table = new Table("test"); - $this->assertFalse($table->hasPrimaryKey()); + self::assertFalse($table->hasPrimaryKey()); $table->addColumn("foo", "integer"); $table->setPrimaryKey(array("foo")); - $this->assertTrue($table->hasPrimaryKey()); + self::assertTrue($table->hasPrimaryKey()); } /** @@ -627,8 +627,8 @@ public function testAddForeignKeyWithQuotedColumnsAndTable() public function testQuoteSchemaPrefixed() { $table = new Table("`test`.`test`"); - $this->assertEquals("test.test", $table->getName()); - $this->assertEquals("`test`.`test`", $table->getQuotedName(new \Doctrine\DBAL\Platforms\MySqlPlatform)); + self::assertEquals("test.test", $table->getName()); + self::assertEquals("`test`.`test`", $table->getQuotedName(new \Doctrine\DBAL\Platforms\MySqlPlatform)); } /** @@ -637,12 +637,12 @@ public function testQuoteSchemaPrefixed() public function testFullQualifiedTableName() { $table = new Table("`test`.`test`"); - $this->assertEquals('test.test', $table->getFullQualifiedName("test")); - $this->assertEquals('test.test', $table->getFullQualifiedName("other")); + self::assertEquals('test.test', $table->getFullQualifiedName("test")); + self::assertEquals('test.test', $table->getFullQualifiedName("other")); $table = new Table("test"); - $this->assertEquals('test.test', $table->getFullQualifiedName("test")); - $this->assertEquals('other.test', $table->getFullQualifiedName("other")); + self::assertEquals('test.test', $table->getFullQualifiedName("test")); + self::assertEquals('other.test', $table->getFullQualifiedName("other")); } /** @@ -654,10 +654,10 @@ public function testDropIndex() $table->addColumn('id', 'integer'); $table->addIndex(array('id'), 'idx'); - $this->assertTrue($table->hasIndex('idx')); + self::assertTrue($table->hasIndex('idx')); $table->dropIndex('idx'); - $this->assertFalse($table->hasIndex('idx')); + self::assertFalse($table->hasIndex('idx')); } /** @@ -669,10 +669,10 @@ public function testDropPrimaryKey() $table->addColumn('id', 'integer'); $table->setPrimaryKey(array('id')); - $this->assertTrue($table->hasPrimaryKey()); + self::assertTrue($table->hasPrimaryKey()); $table->dropPrimaryKey(); - $this->assertFalse($table->hasPrimaryKey()); + self::assertFalse($table->hasPrimaryKey()); } /** @@ -690,61 +690,61 @@ public function testRenameIndex() $table->addUniqueIndex(array('bar', 'baz'), 'uniq'); // Rename to custom name. - $this->assertSame($table, $table->renameIndex('pk', 'pk_new')); - $this->assertSame($table, $table->renameIndex('idx', 'idx_new')); - $this->assertSame($table, $table->renameIndex('uniq', 'uniq_new')); - - $this->assertTrue($table->hasPrimaryKey()); - $this->assertTrue($table->hasIndex('pk_new')); - $this->assertTrue($table->hasIndex('idx_new')); - $this->assertTrue($table->hasIndex('uniq_new')); - - $this->assertFalse($table->hasIndex('pk')); - $this->assertFalse($table->hasIndex('idx')); - $this->assertFalse($table->hasIndex('uniq')); - - $this->assertEquals(new Index('pk_new', array('id'), true, true), $table->getPrimaryKey()); - $this->assertEquals(new Index('pk_new', array('id'), true, true), $table->getIndex('pk_new')); - $this->assertEquals( + self::assertSame($table, $table->renameIndex('pk', 'pk_new')); + self::assertSame($table, $table->renameIndex('idx', 'idx_new')); + self::assertSame($table, $table->renameIndex('uniq', 'uniq_new')); + + self::assertTrue($table->hasPrimaryKey()); + self::assertTrue($table->hasIndex('pk_new')); + self::assertTrue($table->hasIndex('idx_new')); + self::assertTrue($table->hasIndex('uniq_new')); + + self::assertFalse($table->hasIndex('pk')); + self::assertFalse($table->hasIndex('idx')); + self::assertFalse($table->hasIndex('uniq')); + + self::assertEquals(new Index('pk_new', array('id'), true, true), $table->getPrimaryKey()); + self::assertEquals(new Index('pk_new', array('id'), true, true), $table->getIndex('pk_new')); + self::assertEquals( new Index('idx_new', array('foo'), false, false, array('flag')), $table->getIndex('idx_new') ); - $this->assertEquals(new Index('uniq_new', array('bar', 'baz'), true), $table->getIndex('uniq_new')); + self::assertEquals(new Index('uniq_new', array('bar', 'baz'), true), $table->getIndex('uniq_new')); // Rename to auto-generated name. - $this->assertSame($table, $table->renameIndex('pk_new', null)); - $this->assertSame($table, $table->renameIndex('idx_new', null)); - $this->assertSame($table, $table->renameIndex('uniq_new', null)); - - $this->assertTrue($table->hasPrimaryKey()); - $this->assertTrue($table->hasIndex('primary')); - $this->assertTrue($table->hasIndex('IDX_D87F7E0C8C736521')); - $this->assertTrue($table->hasIndex('UNIQ_D87F7E0C76FF8CAA78240498')); - - $this->assertFalse($table->hasIndex('pk_new')); - $this->assertFalse($table->hasIndex('idx_new')); - $this->assertFalse($table->hasIndex('uniq_new')); - - $this->assertEquals(new Index('primary', array('id'), true, true), $table->getPrimaryKey()); - $this->assertEquals(new Index('primary', array('id'), true, true), $table->getIndex('primary')); - $this->assertEquals( + self::assertSame($table, $table->renameIndex('pk_new', null)); + self::assertSame($table, $table->renameIndex('idx_new', null)); + self::assertSame($table, $table->renameIndex('uniq_new', null)); + + self::assertTrue($table->hasPrimaryKey()); + self::assertTrue($table->hasIndex('primary')); + self::assertTrue($table->hasIndex('IDX_D87F7E0C8C736521')); + self::assertTrue($table->hasIndex('UNIQ_D87F7E0C76FF8CAA78240498')); + + self::assertFalse($table->hasIndex('pk_new')); + self::assertFalse($table->hasIndex('idx_new')); + self::assertFalse($table->hasIndex('uniq_new')); + + self::assertEquals(new Index('primary', array('id'), true, true), $table->getPrimaryKey()); + self::assertEquals(new Index('primary', array('id'), true, true), $table->getIndex('primary')); + self::assertEquals( new Index('IDX_D87F7E0C8C736521', array('foo'), false, false, array('flag')), $table->getIndex('IDX_D87F7E0C8C736521') ); - $this->assertEquals( + self::assertEquals( new Index('UNIQ_D87F7E0C76FF8CAA78240498', array('bar', 'baz'), true), $table->getIndex('UNIQ_D87F7E0C76FF8CAA78240498') ); // Rename to same name (changed case). - $this->assertSame($table, $table->renameIndex('primary', 'PRIMARY')); - $this->assertSame($table, $table->renameIndex('IDX_D87F7E0C8C736521', 'idx_D87F7E0C8C736521')); - $this->assertSame($table, $table->renameIndex('UNIQ_D87F7E0C76FF8CAA78240498', 'uniq_D87F7E0C76FF8CAA78240498')); + self::assertSame($table, $table->renameIndex('primary', 'PRIMARY')); + self::assertSame($table, $table->renameIndex('IDX_D87F7E0C8C736521', 'idx_D87F7E0C8C736521')); + self::assertSame($table, $table->renameIndex('UNIQ_D87F7E0C76FF8CAA78240498', 'uniq_D87F7E0C76FF8CAA78240498')); - $this->assertTrue($table->hasPrimaryKey()); - $this->assertTrue($table->hasIndex('primary')); - $this->assertTrue($table->hasIndex('IDX_D87F7E0C8C736521')); - $this->assertTrue($table->hasIndex('UNIQ_D87F7E0C76FF8CAA78240498')); + self::assertTrue($table->hasPrimaryKey()); + self::assertTrue($table->hasIndex('primary')); + self::assertTrue($table->hasIndex('IDX_D87F7E0C8C736521')); + self::assertTrue($table->hasIndex('UNIQ_D87F7E0C76FF8CAA78240498')); } /** @@ -758,7 +758,7 @@ public function testKeepsIndexOptionsOnRenamingRegularIndex() $table->renameIndex('idx_bar', 'idx_baz'); - $this->assertSame(array('where' => '1 = 1'), $table->getIndex('idx_baz')->getOptions()); + self::assertSame(array('where' => '1 = 1'), $table->getIndex('idx_baz')->getOptions()); } /** @@ -772,7 +772,7 @@ public function testKeepsIndexOptionsOnRenamingUniqueIndex() $table->renameIndex('idx_bar', 'idx_baz'); - $this->assertSame(array('where' => '1 = 1'), $table->getIndex('idx_baz')->getOptions()); + self::assertSame(array('where' => '1 = 1'), $table->getIndex('idx_baz')->getOptions()); } /** @@ -815,37 +815,37 @@ public function testNormalizesColumnNames($assetName) $table->addIndex(array($assetName), $assetName); $table->addForeignKeyConstraint('test', array($assetName), array($assetName), array(), $assetName); - $this->assertTrue($table->hasColumn($assetName)); - $this->assertTrue($table->hasColumn('foo')); - $this->assertInstanceOf('Doctrine\DBAL\Schema\Column', $table->getColumn($assetName)); - $this->assertInstanceOf('Doctrine\DBAL\Schema\Column', $table->getColumn('foo')); + self::assertTrue($table->hasColumn($assetName)); + self::assertTrue($table->hasColumn('foo')); + self::assertInstanceOf('Doctrine\DBAL\Schema\Column', $table->getColumn($assetName)); + self::assertInstanceOf('Doctrine\DBAL\Schema\Column', $table->getColumn('foo')); - $this->assertTrue($table->hasIndex($assetName)); - $this->assertTrue($table->hasIndex('foo')); - $this->assertInstanceOf('Doctrine\DBAL\Schema\Index', $table->getIndex($assetName)); - $this->assertInstanceOf('Doctrine\DBAL\Schema\Index', $table->getIndex('foo')); + self::assertTrue($table->hasIndex($assetName)); + self::assertTrue($table->hasIndex('foo')); + self::assertInstanceOf('Doctrine\DBAL\Schema\Index', $table->getIndex($assetName)); + self::assertInstanceOf('Doctrine\DBAL\Schema\Index', $table->getIndex('foo')); - $this->assertTrue($table->hasForeignKey($assetName)); - $this->assertTrue($table->hasForeignKey('foo')); - $this->assertInstanceOf('Doctrine\DBAL\Schema\ForeignKeyConstraint', $table->getForeignKey($assetName)); - $this->assertInstanceOf('Doctrine\DBAL\Schema\ForeignKeyConstraint', $table->getForeignKey('foo')); + self::assertTrue($table->hasForeignKey($assetName)); + self::assertTrue($table->hasForeignKey('foo')); + self::assertInstanceOf('Doctrine\DBAL\Schema\ForeignKeyConstraint', $table->getForeignKey($assetName)); + self::assertInstanceOf('Doctrine\DBAL\Schema\ForeignKeyConstraint', $table->getForeignKey('foo')); $table->renameIndex($assetName, $assetName); - $this->assertTrue($table->hasIndex($assetName)); - $this->assertTrue($table->hasIndex('foo')); + self::assertTrue($table->hasIndex($assetName)); + self::assertTrue($table->hasIndex('foo')); $table->renameIndex($assetName, 'foo'); - $this->assertTrue($table->hasIndex($assetName)); - $this->assertTrue($table->hasIndex('foo')); + self::assertTrue($table->hasIndex($assetName)); + self::assertTrue($table->hasIndex('foo')); $table->renameIndex('foo', $assetName); - $this->assertTrue($table->hasIndex($assetName)); - $this->assertTrue($table->hasIndex('foo')); + self::assertTrue($table->hasIndex($assetName)); + self::assertTrue($table->hasIndex('foo')); $table->renameIndex($assetName, 'bar'); - $this->assertFalse($table->hasIndex($assetName)); - $this->assertFalse($table->hasIndex('foo')); - $this->assertTrue($table->hasIndex('bar')); + self::assertFalse($table->hasIndex($assetName)); + self::assertFalse($table->hasIndex('foo')); + self::assertTrue($table->hasIndex('bar')); $table->renameIndex('bar', $assetName); @@ -853,12 +853,12 @@ public function testNormalizesColumnNames($assetName) $table->dropIndex($assetName); $table->removeForeignKey($assetName); - $this->assertFalse($table->hasColumn($assetName)); - $this->assertFalse($table->hasColumn('foo')); - $this->assertFalse($table->hasIndex($assetName)); - $this->assertFalse($table->hasIndex('foo')); - $this->assertFalse($table->hasForeignKey($assetName)); - $this->assertFalse($table->hasForeignKey('foo')); + self::assertFalse($table->hasColumn($assetName)); + self::assertFalse($table->hasColumn('foo')); + self::assertFalse($table->hasIndex($assetName)); + self::assertFalse($table->hasIndex('foo')); + self::assertFalse($table->hasForeignKey($assetName)); + self::assertFalse($table->hasForeignKey('foo')); } public function getNormalizesAssetNames() diff --git a/tests/Doctrine/Tests/DBAL/Schema/Visitor/CreateSchemaSqlCollectorTest.php b/tests/Doctrine/Tests/DBAL/Schema/Visitor/CreateSchemaSqlCollectorTest.php index fba52392e2b..bc76b62010a 100644 --- a/tests/Doctrine/Tests/DBAL/Schema/Visitor/CreateSchemaSqlCollectorTest.php +++ b/tests/Doctrine/Tests/DBAL/Schema/Visitor/CreateSchemaSqlCollectorTest.php @@ -56,11 +56,11 @@ public function testAcceptsNamespace() $this->visitor->acceptNamespace('foo'); - $this->assertEmpty($this->visitor->getQueries()); + self::assertEmpty($this->visitor->getQueries()); $this->visitor->acceptNamespace('foo'); - $this->assertSame(array('foo'), $this->visitor->getQueries()); + self::assertSame(array('foo'), $this->visitor->getQueries()); } public function testAcceptsTable() @@ -69,7 +69,7 @@ public function testAcceptsTable() $this->visitor->acceptTable($table); - $this->assertSame(array('foo'), $this->visitor->getQueries()); + self::assertSame(array('foo'), $this->visitor->getQueries()); } public function testAcceptsForeignKey() @@ -87,11 +87,11 @@ public function testAcceptsForeignKey() $this->visitor->acceptForeignKey($table, $foreignKey); - $this->assertEmpty($this->visitor->getQueries()); + self::assertEmpty($this->visitor->getQueries()); $this->visitor->acceptForeignKey($table, $foreignKey); - $this->assertSame(array('foo'), $this->visitor->getQueries()); + self::assertSame(array('foo'), $this->visitor->getQueries()); } public function testAcceptsSequences() @@ -100,7 +100,7 @@ public function testAcceptsSequences() $this->visitor->acceptSequence($sequence); - $this->assertSame(array('foo'), $this->visitor->getQueries()); + self::assertSame(array('foo'), $this->visitor->getQueries()); } public function testResetsQueries() @@ -120,11 +120,11 @@ public function testResetsQueries() $this->visitor->acceptForeignKey($table, $foreignKey); $this->visitor->acceptSequence($sequence); - $this->assertNotEmpty($this->visitor->getQueries()); + self::assertNotEmpty($this->visitor->getQueries()); $this->visitor->resetQueries(); - $this->assertEmpty($this->visitor->getQueries()); + self::assertEmpty($this->visitor->getQueries()); } /** diff --git a/tests/Doctrine/Tests/DBAL/Schema/Visitor/RemoveNamespacedAssetsTest.php b/tests/Doctrine/Tests/DBAL/Schema/Visitor/RemoveNamespacedAssetsTest.php index 5338ce76d7c..2c6e59039bb 100644 --- a/tests/Doctrine/Tests/DBAL/Schema/Visitor/RemoveNamespacedAssetsTest.php +++ b/tests/Doctrine/Tests/DBAL/Schema/Visitor/RemoveNamespacedAssetsTest.php @@ -25,7 +25,7 @@ public function testRemoveNamespacedAssets() $schema->visit(new RemoveNamespacedAssets()); $tables = $schema->getTables(); - $this->assertEquals(array("test.test", "test.baz"), array_keys($tables), "Only 2 tables should be present, both in 'test' namespace."); + self::assertEquals(array("test.test", "test.baz"), array_keys($tables), "Only 2 tables should be present, both in 'test' namespace."); } /** @@ -48,7 +48,7 @@ public function testCleanupForeignKeys() $schema->visit(new RemoveNamespacedAssets()); $sql = $schema->toSql(new MySqlPlatform()); - $this->assertEquals(1, count($sql), "Just one CREATE TABLE statement, no foreign key and table to foo.bar"); + self::assertEquals(1, count($sql), "Just one CREATE TABLE statement, no foreign key and table to foo.bar"); } /** @@ -71,7 +71,7 @@ public function testCleanupForeignKeysDifferentOrder() $schema->visit(new RemoveNamespacedAssets()); $sql = $schema->toSql(new MySqlPlatform()); - $this->assertEquals(1, count($sql), "Just one CREATE TABLE statement, no foreign key and table to foo.bar"); + self::assertEquals(1, count($sql), "Just one CREATE TABLE statement, no foreign key and table to foo.bar"); } } diff --git a/tests/Doctrine/Tests/DBAL/Schema/Visitor/SchemaSqlCollectorTest.php b/tests/Doctrine/Tests/DBAL/Schema/Visitor/SchemaSqlCollectorTest.php index c65fe9cb0fa..96a441210e1 100644 --- a/tests/Doctrine/Tests/DBAL/Schema/Visitor/SchemaSqlCollectorTest.php +++ b/tests/Doctrine/Tests/DBAL/Schema/Visitor/SchemaSqlCollectorTest.php @@ -25,7 +25,7 @@ public function testCreateSchema() $sql = $schema->toSql($platformMock); - $this->assertEquals(array("foo", "foo", "bar", "baz"), $sql); + self::assertEquals(array("foo", "foo", "bar", "baz"), $sql); } public function testDropSchema() @@ -47,7 +47,7 @@ public function testDropSchema() $sql = $schema->toDropSql($platformMock); - $this->assertEquals(array("fk", "seq", "tbl", "tbl"), $sql); + self::assertEquals(array("fk", "seq", "tbl", "tbl"), $sql); } /** diff --git a/tests/Doctrine/Tests/DBAL/Sharding/PoolingShardConnectionTest.php b/tests/Doctrine/Tests/DBAL/Sharding/PoolingShardConnectionTest.php index 9ede74e1e3c..ae3e05b0e14 100644 --- a/tests/Doctrine/Tests/DBAL/Sharding/PoolingShardConnectionTest.php +++ b/tests/Doctrine/Tests/DBAL/Sharding/PoolingShardConnectionTest.php @@ -37,25 +37,25 @@ public function testConnect() 'shardChoser' => 'Doctrine\DBAL\Sharding\ShardChoser\MultiTenantShardChoser', )); - $this->assertFalse($conn->isConnected(0)); + self::assertFalse($conn->isConnected(0)); $conn->connect(0); - $this->assertEquals(1, $conn->fetchColumn('SELECT 1')); - $this->assertTrue($conn->isConnected(0)); + self::assertEquals(1, $conn->fetchColumn('SELECT 1')); + self::assertTrue($conn->isConnected(0)); - $this->assertFalse($conn->isConnected(1)); + self::assertFalse($conn->isConnected(1)); $conn->connect(1); - $this->assertEquals(1, $conn->fetchColumn('SELECT 1')); - $this->assertTrue($conn->isConnected(1)); + self::assertEquals(1, $conn->fetchColumn('SELECT 1')); + self::assertTrue($conn->isConnected(1)); - $this->assertFalse($conn->isConnected(2)); + self::assertFalse($conn->isConnected(2)); $conn->connect(2); - $this->assertEquals(1, $conn->fetchColumn('SELECT 1')); - $this->assertTrue($conn->isConnected(2)); + self::assertEquals(1, $conn->fetchColumn('SELECT 1')); + self::assertTrue($conn->isConnected(2)); $conn->close(); - $this->assertFalse($conn->isConnected(0)); - $this->assertFalse($conn->isConnected(1)); - $this->assertFalse($conn->isConnected(2)); + self::assertFalse($conn->isConnected(0)); + self::assertFalse($conn->isConnected(1)); + self::assertFalse($conn->isConnected(2)); } public function testNoGlobalServerException() @@ -192,16 +192,16 @@ public function testGetActiveShardId() 'shardChoser' => 'Doctrine\DBAL\Sharding\ShardChoser\MultiTenantShardChoser', )); - $this->assertNull($conn->getActiveShardId()); + self::assertNull($conn->getActiveShardId()); $conn->connect(0); - $this->assertEquals(0, $conn->getActiveShardId()); + self::assertEquals(0, $conn->getActiveShardId()); $conn->connect(1); - $this->assertEquals(1, $conn->getActiveShardId()); + self::assertEquals(1, $conn->getActiveShardId()); $conn->close(); - $this->assertNull($conn->getActiveShardId()); + self::assertNull($conn->getActiveShardId()); } public function testGetParamsOverride() @@ -216,7 +216,7 @@ public function testGetParamsOverride() 'shardChoser' => 'Doctrine\DBAL\Sharding\ShardChoser\MultiTenantShardChoser', )); - $this->assertEquals(array( + self::assertEquals(array( 'wrapperClass' => 'Doctrine\DBAL\Sharding\PoolingShardConnection', 'driver' => 'pdo_sqlite', 'global' => array('memory' => true, 'host' => 'localhost'), @@ -229,7 +229,7 @@ public function testGetParamsOverride() ), $conn->getParams()); $conn->connect(1); - $this->assertEquals(array( + self::assertEquals(array( 'wrapperClass' => 'Doctrine\DBAL\Sharding\PoolingShardConnection', 'driver' => 'pdo_sqlite', 'global' => array('memory' => true, 'host' => 'localhost'), @@ -256,10 +256,10 @@ public function testGetHostOverride() 'shardChoser' => 'Doctrine\DBAL\Sharding\ShardChoser\MultiTenantShardChoser', )); - $this->assertEquals('localhost', $conn->getHost()); + self::assertEquals('localhost', $conn->getHost()); $conn->connect(1); - $this->assertEquals('foo', $conn->getHost()); + self::assertEquals('foo', $conn->getHost()); } public function testGetPortOverride() @@ -275,10 +275,10 @@ public function testGetPortOverride() 'shardChoser' => 'Doctrine\DBAL\Sharding\ShardChoser\MultiTenantShardChoser', )); - $this->assertEquals(3306, $conn->getPort()); + self::assertEquals(3306, $conn->getPort()); $conn->connect(1); - $this->assertEquals(3307, $conn->getPort()); + self::assertEquals(3307, $conn->getPort()); } public function testGetUsernameOverride() @@ -294,10 +294,10 @@ public function testGetUsernameOverride() 'shardChoser' => 'Doctrine\DBAL\Sharding\ShardChoser\MultiTenantShardChoser', )); - $this->assertEquals('foo', $conn->getUsername()); + self::assertEquals('foo', $conn->getUsername()); $conn->connect(1); - $this->assertEquals('bar', $conn->getUsername()); + self::assertEquals('bar', $conn->getUsername()); } public function testGetPasswordOverride() @@ -313,9 +313,9 @@ public function testGetPasswordOverride() 'shardChoser' => 'Doctrine\DBAL\Sharding\ShardChoser\MultiTenantShardChoser', )); - $this->assertEquals('foo', $conn->getPassword()); + self::assertEquals('foo', $conn->getPassword()); $conn->connect(1); - $this->assertEquals('bar', $conn->getPassword()); + self::assertEquals('bar', $conn->getPassword()); } } diff --git a/tests/Doctrine/Tests/DBAL/Sharding/PoolingShardManagerTest.php b/tests/Doctrine/Tests/DBAL/Sharding/PoolingShardManagerTest.php index ec1581a99e6..b39efcf0b45 100644 --- a/tests/Doctrine/Tests/DBAL/Sharding/PoolingShardManagerTest.php +++ b/tests/Doctrine/Tests/DBAL/Sharding/PoolingShardManagerTest.php @@ -56,7 +56,7 @@ public function testSelectGlobal() $shardManager = new PoolingShardManager($conn, $this->createPassthroughShardChoser()); $shardManager->selectGlobal(); - $this->assertNull($shardManager->getCurrentDistributionValue()); + self::assertNull($shardManager->getCurrentDistributionValue()); } public function testSelectShard() @@ -69,7 +69,7 @@ public function testSelectShard() $shardManager = new PoolingShardManager($conn); $shardManager->selectShard($shardId); - $this->assertEquals($shardId, $shardManager->getCurrentDistributionValue()); + self::assertEquals($shardId, $shardManager->getCurrentDistributionValue()); } public function testGetShards() @@ -84,7 +84,7 @@ public function testGetShards() $shardManager = new PoolingShardManager($conn, $this->createPassthroughShardChoser()); $shards = $shardManager->getShards(); - $this->assertEquals(array(array('id' => 1), array('id' => 2)), $shards); + self::assertEquals(array(array('id' => 1), array('id' => 2)), $shards); } public function testQueryAll() @@ -114,7 +114,7 @@ public function testQueryAll() $shardManager = new PoolingShardManager($conn, $this->createPassthroughShardChoser()); $result = $shardManager->queryAll($sql, $params, $types); - $this->assertEquals(array(array('id' => 1), array('id' => 2)), $result); + self::assertEquals(array(array('id' => 1), array('id' => 2)), $result); } public function testQueryAllWithStaticShardChoser() @@ -144,7 +144,7 @@ public function testQueryAllWithStaticShardChoser() $shardManager = new PoolingShardManager($conn, $this->createStaticShardChoser()); $result = $shardManager->queryAll($sql, $params, $types); - $this->assertEquals(array(array('id' => 1), array('id' => 2)), $result); + self::assertEquals(array(array('id' => 1), array('id' => 2)), $result); } } diff --git a/tests/Doctrine/Tests/DBAL/Sharding/SQLAzure/FunctionalTest.php b/tests/Doctrine/Tests/DBAL/Sharding/SQLAzure/FunctionalTest.php index b93c4d24a3d..c2229baec27 100644 --- a/tests/Doctrine/Tests/DBAL/Sharding/SQLAzure/FunctionalTest.php +++ b/tests/Doctrine/Tests/DBAL/Sharding/SQLAzure/FunctionalTest.php @@ -31,14 +31,14 @@ public function testSharding() $query = "SELECT * FROM Products"; $data = $this->conn->fetchAll($query); - $this->assertTrue(count($data) > 0); + self::assertTrue(count($data) > 0); $query = "SELECT * FROM Customers"; $data = $this->conn->fetchAll($query); - $this->assertTrue(count($data) > 0); + self::assertTrue(count($data) > 0); $data = $this->sm->queryAll("SELECT * FROM Customers"); - $this->assertTrue(count($data) > 0); + self::assertTrue(count($data) > 0); } } diff --git a/tests/Doctrine/Tests/DBAL/Sharding/SQLAzure/MultiTenantVisitorTest.php b/tests/Doctrine/Tests/DBAL/Sharding/SQLAzure/MultiTenantVisitorTest.php index 4575d14f512..99be4eff108 100644 --- a/tests/Doctrine/Tests/DBAL/Sharding/SQLAzure/MultiTenantVisitorTest.php +++ b/tests/Doctrine/Tests/DBAL/Sharding/SQLAzure/MultiTenantVisitorTest.php @@ -36,8 +36,8 @@ public function testMultiTenantPrimaryKey() $foo->setPrimaryKey(array('id')); $schema->visit($visitor); - $this->assertEquals(array('id', 'tenant_id'), $foo->getPrimaryKey()->getColumns()); - $this->assertTrue($foo->hasColumn('tenant_id')); + self::assertEquals(array('id', 'tenant_id'), $foo->getPrimaryKey()->getColumns()); + self::assertTrue($foo->hasColumn('tenant_id')); } public function testMultiTenantNonPrimaryKey() @@ -57,9 +57,9 @@ public function testMultiTenantNonPrimaryKey() $schema->visit($visitor); - $this->assertEquals(array('id'), $foo->getPrimaryKey()->getColumns()); - $this->assertTrue($foo->hasColumn('tenant_id')); - $this->assertEquals(array('created', 'tenant_id'), $foo->getIndex('idx')->getColumns()); + self::assertEquals(array('id'), $foo->getPrimaryKey()->getColumns()); + self::assertTrue($foo->hasColumn('tenant_id')); + self::assertEquals(array('created', 'tenant_id'), $foo->getIndex('idx')->getColumns()); } } diff --git a/tests/Doctrine/Tests/DBAL/Sharding/SQLAzure/SQLAzureFederationsSynchronizerTest.php b/tests/Doctrine/Tests/DBAL/Sharding/SQLAzure/SQLAzureFederationsSynchronizerTest.php index a73163ec642..06b7dff35ea 100644 --- a/tests/Doctrine/Tests/DBAL/Sharding/SQLAzure/SQLAzureFederationsSynchronizerTest.php +++ b/tests/Doctrine/Tests/DBAL/Sharding/SQLAzure/SQLAzureFederationsSynchronizerTest.php @@ -12,7 +12,7 @@ public function testCreateSchema() $synchronizer = new SQLAzureFederationsSynchronizer($this->conn, $this->sm); $sql = $synchronizer->getCreateSchema($schema); - $this->assertEquals(array ( + self::assertEquals(array ( "--Create Federation\nCREATE FEDERATION Orders_Federation (CustID INT RANGE)", "USE FEDERATION Orders_Federation (CustID = 0) WITH RESET, FILTERING = OFF;", "CREATE TABLE Products (ProductID INT NOT NULL, SupplierID INT NOT NULL, ProductName NVARCHAR(255) NOT NULL, Price NUMERIC(12, 2) NOT NULL, PRIMARY KEY (ProductID))", @@ -31,7 +31,7 @@ public function testUpdateSchema() $sql = $synchronizer->getUpdateSchema($schema); - $this->assertEquals(array(), $sql); + self::assertEquals(array(), $sql); } public function testDropSchema() @@ -43,7 +43,7 @@ public function testDropSchema() $synchronizer->createSchema($schema); $sql = $synchronizer->getDropSchema($schema); - $this->assertEQuals(5, count($sql)); + self::assertEQuals(5, count($sql)); } } diff --git a/tests/Doctrine/Tests/DBAL/Sharding/SQLAzure/SQLAzureShardManagerTest.php b/tests/Doctrine/Tests/DBAL/Sharding/SQLAzure/SQLAzureShardManagerTest.php index e252f172596..eb8b9262bf5 100644 --- a/tests/Doctrine/Tests/DBAL/Sharding/SQLAzure/SQLAzureShardManagerTest.php +++ b/tests/Doctrine/Tests/DBAL/Sharding/SQLAzure/SQLAzureShardManagerTest.php @@ -35,7 +35,7 @@ public function testGetDefaultDistributionValue() $conn = $this->createConnection(array('sharding' => array('federationName' => 'abc', 'distributionKey' => 'foo', 'distributionType' => 'integer'))); $sm = new SQLAzureShardManager($conn); - $this->assertNull($sm->getCurrentDistributionValue()); + self::assertNull($sm->getCurrentDistributionValue()); } public function testSelectGlobalTransactionActive() @@ -69,7 +69,7 @@ public function testSelectShard() $sm = new SQLAzureShardManager($conn); $sm->selectShard(1234); - $this->assertEquals(1234, $sm->getCurrentDistributionValue()); + self::assertEquals(1234, $sm->getCurrentDistributionValue()); } public function testSelectShardNoDistributionValue() diff --git a/tests/Doctrine/Tests/DBAL/Sharding/ShardChoser/MultiTenantShardChoserTest.php b/tests/Doctrine/Tests/DBAL/Sharding/ShardChoser/MultiTenantShardChoserTest.php index fa470bd8d50..cf4da5b317d 100644 --- a/tests/Doctrine/Tests/DBAL/Sharding/ShardChoser/MultiTenantShardChoserTest.php +++ b/tests/Doctrine/Tests/DBAL/Sharding/ShardChoser/MultiTenantShardChoserTest.php @@ -28,8 +28,8 @@ public function testPickShard() $choser = new MultiTenantShardChoser(); $conn = $this->createConnectionMock(); - $this->assertEquals(1, $choser->pickShard(1, $conn)); - $this->assertEquals(2, $choser->pickShard(2, $conn)); + self::assertEquals(1, $choser->pickShard(1, $conn)); + self::assertEquals(2, $choser->pickShard(2, $conn)); } private function createConnectionMock() diff --git a/tests/Doctrine/Tests/DBAL/Tools/Console/RunSqlCommandTest.php b/tests/Doctrine/Tests/DBAL/Tools/Console/RunSqlCommandTest.php index 7fbcac3da34..e5e995f53dc 100644 --- a/tests/Doctrine/Tests/DBAL/Tools/Console/RunSqlCommandTest.php +++ b/tests/Doctrine/Tests/DBAL/Tools/Console/RunSqlCommandTest.php @@ -43,7 +43,7 @@ public function testMissingSqlArgument() )); $this->fail('Expected a runtime exception when omitting sql argument'); } catch (\RuntimeException $e) { - $this->assertContains("Argument 'SQL", $e->getMessage()); + self::assertContains("Argument 'SQL", $e->getMessage()); } } @@ -57,7 +57,7 @@ public function testIncorrectDepthOption() )); $this->fail('Expected a logic exception when executing with a stringy depth'); } catch (\LogicException $e) { - $this->assertContains("Option 'depth'", $e->getMessage()); + self::assertContains("Option 'depth'", $e->getMessage()); } } @@ -70,8 +70,8 @@ public function testSelectStatementsPrintsResult() 'sql' => 'SELECT 1', )); - $this->assertRegExp('@int.*1.*@', $this->commandTester->getDisplay()); - $this->assertRegExp('@array.*1.*@', $this->commandTester->getDisplay()); + self::assertRegExp('@int.*1.*@', $this->commandTester->getDisplay()); + self::assertRegExp('@array.*1.*@', $this->commandTester->getDisplay()); } public function testUpdateStatementsPrintsAffectedLines() @@ -83,8 +83,8 @@ public function testUpdateStatementsPrintsAffectedLines() 'sql' => 'UPDATE foo SET bar = 42', )); - $this->assertRegExp('@int.*42.*@', $this->commandTester->getDisplay()); - $this->assertNotRegExp('@array.*1.*@', $this->commandTester->getDisplay()); + self::assertRegExp('@int.*42.*@', $this->commandTester->getDisplay()); + self::assertNotRegExp('@array.*1.*@', $this->commandTester->getDisplay()); } private function expectConnectionExecuteUpdate() @@ -117,7 +117,7 @@ public function testStatementsWithFetchResultPrintsResult() '--force-fetch' => true, )); - $this->assertRegExp('@int.*1.*@', $this->commandTester->getDisplay()); - $this->assertRegExp('@array.*1.*@', $this->commandTester->getDisplay()); + self::assertRegExp('@int.*1.*@', $this->commandTester->getDisplay()); + self::assertRegExp('@array.*1.*@', $this->commandTester->getDisplay()); } } diff --git a/tests/Doctrine/Tests/DBAL/Types/ArrayTest.php b/tests/Doctrine/Tests/DBAL/Types/ArrayTest.php index 2a54bdc1f79..fbf0c0a9999 100644 --- a/tests/Doctrine/Tests/DBAL/Types/ArrayTest.php +++ b/tests/Doctrine/Tests/DBAL/Types/ArrayTest.php @@ -25,14 +25,14 @@ protected function tearDown() public function testArrayConvertsToDatabaseValue() { - $this->assertTrue( + self::assertTrue( is_string($this->_type->convertToDatabaseValue(array(), $this->_platform)) ); } public function testArrayConvertsToPHPValue() { - $this->assertTrue( + self::assertTrue( is_array($this->_type->convertToPHPValue(serialize(array()), $this->_platform)) ); } @@ -46,7 +46,7 @@ public function testConversionFailure() public function testNullConversion() { - $this->assertNull($this->_type->convertToPHPValue(null, $this->_platform)); + self::assertNull($this->_type->convertToPHPValue(null, $this->_platform)); } /** @@ -54,6 +54,6 @@ public function testNullConversion() */ public function testFalseConversion() { - $this->assertFalse($this->_type->convertToPHPValue(serialize(false), $this->_platform)); + self::assertFalse($this->_type->convertToPHPValue(serialize(false), $this->_platform)); } } diff --git a/tests/Doctrine/Tests/DBAL/Types/BaseDateTypeTestCase.php b/tests/Doctrine/Tests/DBAL/Types/BaseDateTypeTestCase.php index 953d6362935..7d9ee6a546f 100644 --- a/tests/Doctrine/Tests/DBAL/Types/BaseDateTypeTestCase.php +++ b/tests/Doctrine/Tests/DBAL/Types/BaseDateTypeTestCase.php @@ -29,7 +29,7 @@ protected function setUp() $this->platform = new MockPlatform(); $this->currentTimezone = date_default_timezone_get(); - $this->assertInstanceOf('Doctrine\DBAL\Types\Type', $this->type); + self::assertInstanceOf('Doctrine\DBAL\Types\Type', $this->type); } /** @@ -42,7 +42,7 @@ protected function tearDown() public function testDateConvertsToDatabaseValue() { - $this->assertInternalType('string', $this->type->convertToDatabaseValue(new \DateTime(), $this->platform)); + self::assertInternalType('string', $this->type->convertToDatabaseValue(new \DateTime(), $this->platform)); } /** @@ -59,14 +59,14 @@ public function testInvalidTypeConversionToDatabaseValue($value) public function testNullConversion() { - $this->assertNull($this->type->convertToPHPValue(null, $this->platform)); + self::assertNull($this->type->convertToPHPValue(null, $this->platform)); } public function testConvertDateTimeToPHPValue() { $date = new \DateTime('now'); - $this->assertSame($date, $this->type->convertToPHPValue($date, $this->platform)); + self::assertSame($date, $this->type->convertToPHPValue($date, $this->platform)); } /** diff --git a/tests/Doctrine/Tests/DBAL/Types/BinaryTest.php b/tests/Doctrine/Tests/DBAL/Types/BinaryTest.php index 44529b252a8..a68bf692381 100644 --- a/tests/Doctrine/Tests/DBAL/Types/BinaryTest.php +++ b/tests/Doctrine/Tests/DBAL/Types/BinaryTest.php @@ -28,22 +28,22 @@ protected function setUp() public function testReturnsBindingType() { - $this->assertSame(\PDO::PARAM_LOB, $this->type->getBindingType()); + self::assertSame(\PDO::PARAM_LOB, $this->type->getBindingType()); } public function testReturnsName() { - $this->assertSame(Type::BINARY, $this->type->getName()); + self::assertSame(Type::BINARY, $this->type->getName()); } public function testReturnsSQLDeclaration() { - $this->assertSame('DUMMYBINARY', $this->type->getSQLDeclaration(array(), $this->platform)); + self::assertSame('DUMMYBINARY', $this->type->getSQLDeclaration(array(), $this->platform)); } public function testBinaryNullConvertsToPHPValue() { - $this->assertNull($this->type->convertToPHPValue(null, $this->platform)); + self::assertNull($this->type->convertToPHPValue(null, $this->platform)); } public function testBinaryStringConvertsToPHPValue() @@ -51,8 +51,8 @@ public function testBinaryStringConvertsToPHPValue() $databaseValue = 'binary string'; $phpValue = $this->type->convertToPHPValue($databaseValue, $this->platform); - $this->assertInternalType('resource', $phpValue); - $this->assertEquals($databaseValue, stream_get_contents($phpValue)); + self::assertInternalType('resource', $phpValue); + self::assertEquals($databaseValue, stream_get_contents($phpValue)); } public function testBinaryResourceConvertsToPHPValue() @@ -60,7 +60,7 @@ public function testBinaryResourceConvertsToPHPValue() $databaseValue = fopen('data://text/plain;base64,' . base64_encode('binary string'), 'r'); $phpValue = $this->type->convertToPHPValue($databaseValue, $this->platform); - $this->assertSame($databaseValue, $phpValue); + self::assertSame($databaseValue, $phpValue); } /** diff --git a/tests/Doctrine/Tests/DBAL/Types/BlobTest.php b/tests/Doctrine/Tests/DBAL/Types/BlobTest.php index 3913d772d64..4b5677f1a70 100644 --- a/tests/Doctrine/Tests/DBAL/Types/BlobTest.php +++ b/tests/Doctrine/Tests/DBAL/Types/BlobTest.php @@ -28,7 +28,7 @@ protected function setUp() public function testBlobNullConvertsToPHPValue() { - $this->assertNull($this->type->convertToPHPValue(null, $this->platform)); + self::assertNull($this->type->convertToPHPValue(null, $this->platform)); } public function testBinaryStringConvertsToPHPValue() @@ -36,8 +36,8 @@ public function testBinaryStringConvertsToPHPValue() $databaseValue = $this->getBinaryString(); $phpValue = $this->type->convertToPHPValue($databaseValue, $this->platform); - $this->assertInternalType('resource', $phpValue); - $this->assertSame($databaseValue, stream_get_contents($phpValue)); + self::assertInternalType('resource', $phpValue); + self::assertSame($databaseValue, stream_get_contents($phpValue)); } public function testBinaryResourceConvertsToPHPValue() @@ -45,7 +45,7 @@ public function testBinaryResourceConvertsToPHPValue() $databaseValue = fopen('data://text/plain;base64,' . base64_encode($this->getBinaryString()), 'r'); $phpValue = $this->type->convertToPHPValue($databaseValue, $this->platform); - $this->assertSame($databaseValue, $phpValue); + self::assertSame($databaseValue, $phpValue); } /** diff --git a/tests/Doctrine/Tests/DBAL/Types/BooleanTest.php b/tests/Doctrine/Tests/DBAL/Types/BooleanTest.php index 3bc459b08f3..30b0874874a 100644 --- a/tests/Doctrine/Tests/DBAL/Types/BooleanTest.php +++ b/tests/Doctrine/Tests/DBAL/Types/BooleanTest.php @@ -19,16 +19,16 @@ protected function setUp() public function testBooleanConvertsToDatabaseValue() { - $this->assertInternalType('integer', $this->_type->convertToDatabaseValue(1, $this->_platform)); + self::assertInternalType('integer', $this->_type->convertToDatabaseValue(1, $this->_platform)); } public function testBooleanConvertsToPHPValue() { - $this->assertInternalType('bool', $this->_type->convertToPHPValue(0, $this->_platform)); + self::assertInternalType('bool', $this->_type->convertToPHPValue(0, $this->_platform)); } public function testBooleanNullConvertsToPHPValue() { - $this->assertNull($this->_type->convertToPHPValue(null, $this->_platform)); + self::assertNull($this->_type->convertToPHPValue(null, $this->_platform)); } } diff --git a/tests/Doctrine/Tests/DBAL/Types/ConversionExceptionTest.php b/tests/Doctrine/Tests/DBAL/Types/ConversionExceptionTest.php index 6ee20f170eb..d888d066bf9 100644 --- a/tests/Doctrine/Tests/DBAL/Types/ConversionExceptionTest.php +++ b/tests/Doctrine/Tests/DBAL/Types/ConversionExceptionTest.php @@ -15,8 +15,8 @@ public function testConversionFailedInvalidTypeWithScalar($scalarValue) { $exception = ConversionException::conversionFailedInvalidType($scalarValue, 'foo', ['bar', 'baz']); - $this->assertInstanceOf('Doctrine\DBAL\Types\ConversionException', $exception); - $this->assertRegExp( + self::assertInstanceOf('Doctrine\DBAL\Types\ConversionException', $exception); + self::assertRegExp( '/^Could not convert PHP value \'.*\' of type \'(string|boolean|float|double|integer)\' to type \'foo\'. ' . 'Expected one of the following types: bar, baz$/', $exception->getMessage() @@ -31,8 +31,8 @@ public function testConversionFailedInvalidTypeWithNonScalar($nonScalar) { $exception = ConversionException::conversionFailedInvalidType($nonScalar, 'foo', ['bar', 'baz']); - $this->assertInstanceOf('Doctrine\DBAL\Types\ConversionException', $exception); - $this->assertRegExp( + self::assertInstanceOf('Doctrine\DBAL\Types\ConversionException', $exception); + self::assertRegExp( '/^Could not convert PHP value of type \'(.*)\' to type \'foo\'. ' . 'Expected one of the following types: bar, baz$/', $exception->getMessage() @@ -45,8 +45,8 @@ public function testConversionFailedFormatPreservesPreviousException() $exception = ConversionException::conversionFailedFormat('foo', 'bar', 'baz', $previous); - $this->assertInstanceOf('Doctrine\DBAL\Types\ConversionException', $exception); - $this->assertSame($previous, $exception->getPrevious()); + self::assertInstanceOf('Doctrine\DBAL\Types\ConversionException', $exception); + self::assertSame($previous, $exception->getPrevious()); } /** diff --git a/tests/Doctrine/Tests/DBAL/Types/DateImmutableTypeTest.php b/tests/Doctrine/Tests/DBAL/Types/DateImmutableTypeTest.php index e5733ec4db7..9d32448be51 100644 --- a/tests/Doctrine/Tests/DBAL/Types/DateImmutableTypeTest.php +++ b/tests/Doctrine/Tests/DBAL/Types/DateImmutableTypeTest.php @@ -27,17 +27,17 @@ protected function setUp() public function testFactoryCreatesCorrectType() { - $this->assertSame(DateImmutableType::class, get_class($this->type)); + self::assertSame(DateImmutableType::class, get_class($this->type)); } public function testReturnsName() { - $this->assertSame('date_immutable', $this->type->getName()); + self::assertSame('date_immutable', $this->type->getName()); } public function testReturnsBindingType() { - $this->assertSame(\PDO::PARAM_STR, $this->type->getBindingType()); + self::assertSame(\PDO::PARAM_STR, $this->type->getBindingType()); } public function testConvertsDateTimeImmutableInstanceToDatabaseValue() @@ -47,7 +47,7 @@ public function testConvertsDateTimeImmutableInstanceToDatabaseValue() $this->platform->getDateFormatString()->willReturn('Y-m-d')->shouldBeCalled(); $date->format('Y-m-d')->willReturn('2016-01-01')->shouldBeCalled(); - $this->assertSame( + self::assertSame( '2016-01-01', $this->type->convertToDatabaseValue($date->reveal(), $this->platform->reveal()) ); @@ -55,7 +55,7 @@ public function testConvertsDateTimeImmutableInstanceToDatabaseValue() public function testConvertsNullToDatabaseValue() { - $this->assertNull($this->type->convertToDatabaseValue(null, $this->platform->reveal())); + self::assertNull($this->type->convertToDatabaseValue(null, $this->platform->reveal())); } public function testDoesNotSupportMutableDateTimeToDatabaseValueConversion() @@ -69,12 +69,12 @@ public function testConvertsDateTimeImmutableInstanceToPHPValue() { $date = new \DateTimeImmutable(); - $this->assertSame($date, $this->type->convertToPHPValue($date, $this->platform->reveal())); + self::assertSame($date, $this->type->convertToPHPValue($date, $this->platform->reveal())); } public function testConvertsNullToPHPValue() { - $this->assertNull($this->type->convertToPHPValue(null, $this->platform->reveal())); + self::assertNull($this->type->convertToPHPValue(null, $this->platform->reveal())); } public function testConvertsDateStringToPHPValue() @@ -83,8 +83,8 @@ public function testConvertsDateStringToPHPValue() $date = $this->type->convertToPHPValue('2016-01-01', $this->platform->reveal()); - $this->assertInstanceOf(\DateTimeImmutable::class, $date); - $this->assertSame('2016-01-01', $date->format('Y-m-d')); + self::assertInstanceOf(\DateTimeImmutable::class, $date); + self::assertSame('2016-01-01', $date->format('Y-m-d')); } public function testResetTimeFractionsWhenConvertingToPHPValue() @@ -93,7 +93,7 @@ public function testResetTimeFractionsWhenConvertingToPHPValue() $date = $this->type->convertToPHPValue('2016-01-01', $this->platform->reveal()); - $this->assertSame('2016-01-01 00:00:00.000000', $date->format('Y-m-d H:i:s.u')); + self::assertSame('2016-01-01 00:00:00.000000', $date->format('Y-m-d H:i:s.u')); } public function testThrowsExceptionDuringConversionToPHPValueWithInvalidDateString() @@ -105,6 +105,6 @@ public function testThrowsExceptionDuringConversionToPHPValueWithInvalidDateStri public function testRequiresSQLCommentHint() { - $this->assertTrue($this->type->requiresSQLCommentHint($this->platform->reveal())); + self::assertTrue($this->type->requiresSQLCommentHint($this->platform->reveal())); } } diff --git a/tests/Doctrine/Tests/DBAL/Types/DateIntervalTest.php b/tests/Doctrine/Tests/DBAL/Types/DateIntervalTest.php index efb6049bcd1..417d0ded454 100644 --- a/tests/Doctrine/Tests/DBAL/Types/DateIntervalTest.php +++ b/tests/Doctrine/Tests/DBAL/Types/DateIntervalTest.php @@ -25,7 +25,7 @@ protected function setUp() $this->platform = new MockPlatform(); $this->type = Type::getType('dateinterval'); - $this->assertInstanceOf('Doctrine\DBAL\Types\DateIntervalType', $this->type); + self::assertInstanceOf('Doctrine\DBAL\Types\DateIntervalType', $this->type); } public function testDateIntervalConvertsToDatabaseValue() @@ -35,14 +35,14 @@ public function testDateIntervalConvertsToDatabaseValue() $expected = 'P02Y00M01DT01H02M03S'; $actual = $this->type->convertToDatabaseValue($interval, $this->platform); - $this->assertEquals($expected, $actual); + self::assertEquals($expected, $actual); } public function testDateIntervalConvertsToPHPValue() { $date = $this->type->convertToPHPValue('P02Y00M01DT01H02M03S', $this->platform); - $this->assertInstanceOf('DateInterval', $date); - $this->assertEquals('P02Y00M01DT01H02M03S', $date->format('P%YY%MM%DDT%HH%IM%SS')); + self::assertInstanceOf('DateInterval', $date); + self::assertEquals('P02Y00M01DT01H02M03S', $date->format('P%YY%MM%DDT%HH%IM%SS')); } public function testInvalidDateIntervalFormatConversion() @@ -53,7 +53,7 @@ public function testInvalidDateIntervalFormatConversion() public function testDateIntervalNullConversion() { - $this->assertNull($this->type->convertToPHPValue(null, $this->platform)); + self::assertNull($this->type->convertToPHPValue(null, $this->platform)); } /** @@ -61,7 +61,7 @@ public function testDateIntervalNullConversion() */ public function testRequiresSQLCommentHint() { - $this->assertTrue($this->type->requiresSQLCommentHint($this->platform)); + self::assertTrue($this->type->requiresSQLCommentHint($this->platform)); } /** diff --git a/tests/Doctrine/Tests/DBAL/Types/DateTest.php b/tests/Doctrine/Tests/DBAL/Types/DateTest.php index 75464cb1f02..dd30e7dbba4 100644 --- a/tests/Doctrine/Tests/DBAL/Types/DateTest.php +++ b/tests/Doctrine/Tests/DBAL/Types/DateTest.php @@ -19,7 +19,7 @@ protected function setUp() public function testDateConvertsToPHPValue() { // Birthday of jwage and also birthday of Doctrine. Send him a present ;) - $this->assertTrue( + self::assertTrue( $this->type->convertToPHPValue('1985-09-01', $this->platform) instanceof \DateTime ); @@ -29,7 +29,7 @@ public function testDateResetsNonDatePartsToZeroUnixTimeValues() { $date = $this->type->convertToPHPValue('1985-09-01', $this->platform); - $this->assertEquals('00:00:00', $date->format('H:i:s')); + self::assertEquals('00:00:00', $date->format('H:i:s')); } public function testDateRests_SummerTimeAffection() @@ -37,12 +37,12 @@ public function testDateRests_SummerTimeAffection() date_default_timezone_set('Europe/Berlin'); $date = $this->type->convertToPHPValue('2009-08-01', $this->platform); - $this->assertEquals('00:00:00', $date->format('H:i:s')); - $this->assertEquals('2009-08-01', $date->format('Y-m-d')); + self::assertEquals('00:00:00', $date->format('H:i:s')); + self::assertEquals('2009-08-01', $date->format('Y-m-d')); $date = $this->type->convertToPHPValue('2009-11-01', $this->platform); - $this->assertEquals('00:00:00', $date->format('H:i:s')); - $this->assertEquals('2009-11-01', $date->format('Y-m-d')); + self::assertEquals('00:00:00', $date->format('H:i:s')); + self::assertEquals('2009-11-01', $date->format('Y-m-d')); } public function testInvalidDateFormatConversion() diff --git a/tests/Doctrine/Tests/DBAL/Types/DateTimeImmutableTypeTest.php b/tests/Doctrine/Tests/DBAL/Types/DateTimeImmutableTypeTest.php index 73da0a68b44..a134180830c 100644 --- a/tests/Doctrine/Tests/DBAL/Types/DateTimeImmutableTypeTest.php +++ b/tests/Doctrine/Tests/DBAL/Types/DateTimeImmutableTypeTest.php @@ -27,17 +27,17 @@ protected function setUp() public function testFactoryCreatesCorrectType() { - $this->assertSame(DateTimeImmutableType::class, get_class($this->type)); + self::assertSame(DateTimeImmutableType::class, get_class($this->type)); } public function testReturnsName() { - $this->assertSame('datetime_immutable', $this->type->getName()); + self::assertSame('datetime_immutable', $this->type->getName()); } public function testReturnsBindingType() { - $this->assertSame(\PDO::PARAM_STR, $this->type->getBindingType()); + self::assertSame(\PDO::PARAM_STR, $this->type->getBindingType()); } public function testConvertsDateTimeImmutableInstanceToDatabaseValue() @@ -47,7 +47,7 @@ public function testConvertsDateTimeImmutableInstanceToDatabaseValue() $this->platform->getDateTimeFormatString()->willReturn('Y-m-d H:i:s')->shouldBeCalled(); $date->format('Y-m-d H:i:s')->willReturn('2016-01-01 15:58:59')->shouldBeCalled(); - $this->assertSame( + self::assertSame( '2016-01-01 15:58:59', $this->type->convertToDatabaseValue($date->reveal(), $this->platform->reveal()) ); @@ -55,7 +55,7 @@ public function testConvertsDateTimeImmutableInstanceToDatabaseValue() public function testConvertsNullToDatabaseValue() { - $this->assertNull($this->type->convertToDatabaseValue(null, $this->platform->reveal())); + self::assertNull($this->type->convertToDatabaseValue(null, $this->platform->reveal())); } public function testDoesNotSupportMutableDateTimeToDatabaseValueConversion() @@ -69,12 +69,12 @@ public function testConvertsDateTimeImmutableInstanceToPHPValue() { $date = new \DateTimeImmutable(); - $this->assertSame($date, $this->type->convertToPHPValue($date, $this->platform->reveal())); + self::assertSame($date, $this->type->convertToPHPValue($date, $this->platform->reveal())); } public function testConvertsNullToPHPValue() { - $this->assertNull($this->type->convertToPHPValue(null, $this->platform->reveal())); + self::assertNull($this->type->convertToPHPValue(null, $this->platform->reveal())); } public function testConvertsDateTimeStringToPHPValue() @@ -83,8 +83,8 @@ public function testConvertsDateTimeStringToPHPValue() $date = $this->type->convertToPHPValue('2016-01-01 15:58:59', $this->platform->reveal()); - $this->assertInstanceOf(\DateTimeImmutable::class, $date); - $this->assertSame('2016-01-01 15:58:59', $date->format('Y-m-d H:i:s')); + self::assertInstanceOf(\DateTimeImmutable::class, $date); + self::assertSame('2016-01-01 15:58:59', $date->format('Y-m-d H:i:s')); } /** @@ -96,7 +96,7 @@ public function testConvertsDateTimeStringWithMicrosecondsToPHPValue() $date = $this->type->convertToPHPValue('2016-01-01 15:58:59.123456', $this->platform->reveal()); - $this->assertSame('2016-01-01 15:58:59', $date->format('Y-m-d H:i:s')); + self::assertSame('2016-01-01 15:58:59', $date->format('Y-m-d H:i:s')); } public function testThrowsExceptionDuringConversionToPHPValueWithInvalidDateTimeString() @@ -108,6 +108,6 @@ public function testThrowsExceptionDuringConversionToPHPValueWithInvalidDateTime public function testRequiresSQLCommentHint() { - $this->assertTrue($this->type->requiresSQLCommentHint($this->platform->reveal())); + self::assertTrue($this->type->requiresSQLCommentHint($this->platform->reveal())); } } diff --git a/tests/Doctrine/Tests/DBAL/Types/DateTimeTest.php b/tests/Doctrine/Tests/DBAL/Types/DateTimeTest.php index 2ace9ab6277..3b66c260c8d 100644 --- a/tests/Doctrine/Tests/DBAL/Types/DateTimeTest.php +++ b/tests/Doctrine/Tests/DBAL/Types/DateTimeTest.php @@ -23,15 +23,15 @@ public function testDateTimeConvertsToDatabaseValue() $expected = $date->format($this->platform->getDateTimeTzFormatString()); $actual = $this->type->convertToDatabaseValue($date, $this->platform); - $this->assertEquals($expected, $actual); + self::assertEquals($expected, $actual); } public function testDateTimeConvertsToPHPValue() { // Birthday of jwage and also birthday of Doctrine. Send him a present ;) $date = $this->type->convertToPHPValue('1985-09-01 00:00:00', $this->platform); - $this->assertInstanceOf('DateTime', $date); - $this->assertEquals('1985-09-01 00:00:00', $date->format('Y-m-d H:i:s')); + self::assertInstanceOf('DateTime', $date); + self::assertEquals('1985-09-01 00:00:00', $date->format('Y-m-d H:i:s')); } public function testInvalidDateTimeFormatConversion() @@ -46,6 +46,6 @@ public function testConvertsNonMatchingFormatToPhpValueWithParser() $actual = $this->type->convertToPHPValue($date, $this->platform); - $this->assertEquals('1985-09-01 10:10:10', $actual->format('Y-m-d H:i:s')); + self::assertEquals('1985-09-01 10:10:10', $actual->format('Y-m-d H:i:s')); } } diff --git a/tests/Doctrine/Tests/DBAL/Types/DateTimeTzImmutableTypeTest.php b/tests/Doctrine/Tests/DBAL/Types/DateTimeTzImmutableTypeTest.php index b5f28f18751..87d448ceab0 100644 --- a/tests/Doctrine/Tests/DBAL/Types/DateTimeTzImmutableTypeTest.php +++ b/tests/Doctrine/Tests/DBAL/Types/DateTimeTzImmutableTypeTest.php @@ -27,17 +27,17 @@ protected function setUp() public function testFactoryCreatesCorrectType() { - $this->assertSame(DateTimeTzImmutableType::class, get_class($this->type)); + self::assertSame(DateTimeTzImmutableType::class, get_class($this->type)); } public function testReturnsName() { - $this->assertSame('datetimetz_immutable', $this->type->getName()); + self::assertSame('datetimetz_immutable', $this->type->getName()); } public function testReturnsBindingType() { - $this->assertSame(\PDO::PARAM_STR, $this->type->getBindingType()); + self::assertSame(\PDO::PARAM_STR, $this->type->getBindingType()); } public function testConvertsDateTimeImmutableInstanceToDatabaseValue() @@ -47,7 +47,7 @@ public function testConvertsDateTimeImmutableInstanceToDatabaseValue() $this->platform->getDateTimeTzFormatString()->willReturn('Y-m-d H:i:s T')->shouldBeCalled(); $date->format('Y-m-d H:i:s T')->willReturn('2016-01-01 15:58:59 UTC')->shouldBeCalled(); - $this->assertSame( + self::assertSame( '2016-01-01 15:58:59 UTC', $this->type->convertToDatabaseValue($date->reveal(), $this->platform->reveal()) ); @@ -55,7 +55,7 @@ public function testConvertsDateTimeImmutableInstanceToDatabaseValue() public function testConvertsNullToDatabaseValue() { - $this->assertNull($this->type->convertToDatabaseValue(null, $this->platform->reveal())); + self::assertNull($this->type->convertToDatabaseValue(null, $this->platform->reveal())); } public function testDoesNotSupportMutableDateTimeToDatabaseValueConversion() @@ -69,12 +69,12 @@ public function testConvertsDateTimeImmutableInstanceToPHPValue() { $date = new \DateTimeImmutable(); - $this->assertSame($date, $this->type->convertToPHPValue($date, $this->platform->reveal())); + self::assertSame($date, $this->type->convertToPHPValue($date, $this->platform->reveal())); } public function testConvertsNullToPHPValue() { - $this->assertNull($this->type->convertToPHPValue(null, $this->platform->reveal())); + self::assertNull($this->type->convertToPHPValue(null, $this->platform->reveal())); } public function testConvertsDateTimeWithTimezoneStringToPHPValue() @@ -83,8 +83,8 @@ public function testConvertsDateTimeWithTimezoneStringToPHPValue() $date = $this->type->convertToPHPValue('2016-01-01 15:58:59 UTC', $this->platform->reveal()); - $this->assertInstanceOf(\DateTimeImmutable::class, $date); - $this->assertSame('2016-01-01 15:58:59 UTC', $date->format('Y-m-d H:i:s T')); + self::assertInstanceOf(\DateTimeImmutable::class, $date); + self::assertSame('2016-01-01 15:58:59 UTC', $date->format('Y-m-d H:i:s T')); } public function testThrowsExceptionDuringConversionToPHPValueWithInvalidDateTimeWithTimezoneString() @@ -96,6 +96,6 @@ public function testThrowsExceptionDuringConversionToPHPValueWithInvalidDateTime public function testRequiresSQLCommentHint() { - $this->assertTrue($this->type->requiresSQLCommentHint($this->platform->reveal())); + self::assertTrue($this->type->requiresSQLCommentHint($this->platform->reveal())); } } diff --git a/tests/Doctrine/Tests/DBAL/Types/DateTimeTzTest.php b/tests/Doctrine/Tests/DBAL/Types/DateTimeTzTest.php index 9bd72710660..bcc77b4c989 100644 --- a/tests/Doctrine/Tests/DBAL/Types/DateTimeTzTest.php +++ b/tests/Doctrine/Tests/DBAL/Types/DateTimeTzTest.php @@ -23,15 +23,15 @@ public function testDateTimeConvertsToDatabaseValue() $expected = $date->format($this->platform->getDateTimeTzFormatString()); $actual = $this->type->convertToDatabaseValue($date, $this->platform); - $this->assertEquals($expected, $actual); + self::assertEquals($expected, $actual); } public function testDateTimeConvertsToPHPValue() { // Birthday of jwage and also birthday of Doctrine. Send him a present ;) $date = $this->type->convertToPHPValue('1985-09-01 00:00:00', $this->platform); - $this->assertInstanceOf('DateTime', $date); - $this->assertEquals('1985-09-01 00:00:00', $date->format('Y-m-d H:i:s')); + self::assertInstanceOf('DateTime', $date); + self::assertEquals('1985-09-01 00:00:00', $date->format('Y-m-d H:i:s')); } public function testInvalidDateFormatConversion() diff --git a/tests/Doctrine/Tests/DBAL/Types/DecimalTest.php b/tests/Doctrine/Tests/DBAL/Types/DecimalTest.php index 3fa045350e9..49c75845509 100644 --- a/tests/Doctrine/Tests/DBAL/Types/DecimalTest.php +++ b/tests/Doctrine/Tests/DBAL/Types/DecimalTest.php @@ -19,11 +19,11 @@ protected function setUp() public function testDecimalConvertsToPHPValue() { - $this->assertInternalType('string', $this->_type->convertToPHPValue('5.5', $this->_platform)); + self::assertInternalType('string', $this->_type->convertToPHPValue('5.5', $this->_platform)); } public function testDecimalNullConvertsToPHPValue() { - $this->assertNull($this->_type->convertToPHPValue(null, $this->_platform)); + self::assertNull($this->_type->convertToPHPValue(null, $this->_platform)); } } diff --git a/tests/Doctrine/Tests/DBAL/Types/FloatTest.php b/tests/Doctrine/Tests/DBAL/Types/FloatTest.php index b1fa9062df6..d4e58b505cc 100644 --- a/tests/Doctrine/Tests/DBAL/Types/FloatTest.php +++ b/tests/Doctrine/Tests/DBAL/Types/FloatTest.php @@ -17,21 +17,21 @@ protected function setUp() public function testFloatConvertsToPHPValue() { - $this->assertInternalType('float', $this->_type->convertToPHPValue('5.5', $this->_platform)); + self::assertInternalType('float', $this->_type->convertToPHPValue('5.5', $this->_platform)); } public function testFloatNullConvertsToPHPValue() { - $this->assertNull($this->_type->convertToPHPValue(null, $this->_platform)); + self::assertNull($this->_type->convertToPHPValue(null, $this->_platform)); } public function testFloatConvertToDatabaseValue() { - $this->assertInternalType('float', $this->_type->convertToDatabaseValue(5.5, $this->_platform)); + self::assertInternalType('float', $this->_type->convertToDatabaseValue(5.5, $this->_platform)); } public function testFloatNullConvertToDatabaseValue() { - $this->assertNull($this->_type->convertToDatabaseValue(null, $this->_platform)); + self::assertNull($this->_type->convertToDatabaseValue(null, $this->_platform)); } } diff --git a/tests/Doctrine/Tests/DBAL/Types/GuidTypeTest.php b/tests/Doctrine/Tests/DBAL/Types/GuidTypeTest.php index d40fcf96b3b..63b7bc5c43e 100644 --- a/tests/Doctrine/Tests/DBAL/Types/GuidTypeTest.php +++ b/tests/Doctrine/Tests/DBAL/Types/GuidTypeTest.php @@ -19,24 +19,24 @@ protected function setUp() public function testConvertToPHPValue() { - $this->assertInternalType("string", $this->_type->convertToPHPValue("foo", $this->_platform)); - $this->assertInternalType("string", $this->_type->convertToPHPValue("", $this->_platform)); + self::assertInternalType("string", $this->_type->convertToPHPValue("foo", $this->_platform)); + self::assertInternalType("string", $this->_type->convertToPHPValue("", $this->_platform)); } public function testNullConversion() { - $this->assertNull($this->_type->convertToPHPValue(null, $this->_platform)); + self::assertNull($this->_type->convertToPHPValue(null, $this->_platform)); } public function testNativeGuidSupport() { - $this->assertTrue($this->_type->requiresSQLCommentHint($this->_platform)); + self::assertTrue($this->_type->requiresSQLCommentHint($this->_platform)); $mock = $this->createMock(get_class($this->_platform)); $mock->expects($this->any()) ->method('hasNativeGuidType') ->will($this->returnValue(true)); - $this->assertFalse($this->_type->requiresSQLCommentHint($mock)); + self::assertFalse($this->_type->requiresSQLCommentHint($mock)); } } diff --git a/tests/Doctrine/Tests/DBAL/Types/IntegerTest.php b/tests/Doctrine/Tests/DBAL/Types/IntegerTest.php index 517c7b733de..e4c7b475293 100644 --- a/tests/Doctrine/Tests/DBAL/Types/IntegerTest.php +++ b/tests/Doctrine/Tests/DBAL/Types/IntegerTest.php @@ -19,12 +19,12 @@ protected function setUp() public function testIntegerConvertsToPHPValue() { - $this->assertInternalType('integer', $this->_type->convertToPHPValue('1', $this->_platform)); - $this->assertInternalType('integer', $this->_type->convertToPHPValue('0', $this->_platform)); + self::assertInternalType('integer', $this->_type->convertToPHPValue('1', $this->_platform)); + self::assertInternalType('integer', $this->_type->convertToPHPValue('0', $this->_platform)); } public function testIntegerNullConvertsToPHPValue() { - $this->assertNull($this->_type->convertToPHPValue(null, $this->_platform)); + self::assertNull($this->_type->convertToPHPValue(null, $this->_platform)); } } diff --git a/tests/Doctrine/Tests/DBAL/Types/JsonArrayTest.php b/tests/Doctrine/Tests/DBAL/Types/JsonArrayTest.php index 372e7550cf7..bbfc0365e30 100644 --- a/tests/Doctrine/Tests/DBAL/Types/JsonArrayTest.php +++ b/tests/Doctrine/Tests/DBAL/Types/JsonArrayTest.php @@ -28,27 +28,27 @@ protected function setUp() public function testReturnsBindingType() { - $this->assertSame(\PDO::PARAM_STR, $this->type->getBindingType()); + self::assertSame(\PDO::PARAM_STR, $this->type->getBindingType()); } public function testReturnsName() { - $this->assertSame(Type::JSON_ARRAY, $this->type->getName()); + self::assertSame(Type::JSON_ARRAY, $this->type->getName()); } public function testReturnsSQLDeclaration() { - $this->assertSame('DUMMYJSON', $this->type->getSQLDeclaration(array(), $this->platform)); + self::assertSame('DUMMYJSON', $this->type->getSQLDeclaration(array(), $this->platform)); } public function testJsonNullConvertsToPHPValue() { - $this->assertSame(array(), $this->type->convertToPHPValue(null, $this->platform)); + self::assertSame(array(), $this->type->convertToPHPValue(null, $this->platform)); } public function testJsonEmptyStringConvertsToPHPValue() { - $this->assertSame(array(), $this->type->convertToPHPValue('', $this->platform)); + self::assertSame(array(), $this->type->convertToPHPValue('', $this->platform)); } public function testJsonStringConvertsToPHPValue() @@ -57,7 +57,7 @@ public function testJsonStringConvertsToPHPValue() $databaseValue = json_encode($value); $phpValue = $this->type->convertToPHPValue($databaseValue, $this->platform); - $this->assertEquals($value, $phpValue); + self::assertEquals($value, $phpValue); } public function testJsonResourceConvertsToPHPValue() @@ -66,11 +66,11 @@ public function testJsonResourceConvertsToPHPValue() $databaseValue = fopen('data://text/plain;base64,' . base64_encode(json_encode($value)), 'r'); $phpValue = $this->type->convertToPHPValue($databaseValue, $this->platform); - $this->assertSame($value, $phpValue); + self::assertSame($value, $phpValue); } public function testRequiresSQLCommentHint() { - $this->assertTrue($this->type->requiresSQLCommentHint($this->platform)); + self::assertTrue($this->type->requiresSQLCommentHint($this->platform)); } } diff --git a/tests/Doctrine/Tests/DBAL/Types/JsonTest.php b/tests/Doctrine/Tests/DBAL/Types/JsonTest.php index fc9e64bac34..851b2e972b6 100644 --- a/tests/Doctrine/Tests/DBAL/Types/JsonTest.php +++ b/tests/Doctrine/Tests/DBAL/Types/JsonTest.php @@ -28,27 +28,27 @@ protected function setUp() public function testReturnsBindingType() { - $this->assertSame(\PDO::PARAM_STR, $this->type->getBindingType()); + self::assertSame(\PDO::PARAM_STR, $this->type->getBindingType()); } public function testReturnsName() { - $this->assertSame(Type::JSON, $this->type->getName()); + self::assertSame(Type::JSON, $this->type->getName()); } public function testReturnsSQLDeclaration() { - $this->assertSame('DUMMYJSON', $this->type->getSQLDeclaration(array(), $this->platform)); + self::assertSame('DUMMYJSON', $this->type->getSQLDeclaration(array(), $this->platform)); } public function testJsonNullConvertsToPHPValue() { - $this->assertNull($this->type->convertToPHPValue(null, $this->platform)); + self::assertNull($this->type->convertToPHPValue(null, $this->platform)); } public function testJsonEmptyStringConvertsToPHPValue() { - $this->assertNull($this->type->convertToPHPValue('', $this->platform)); + self::assertNull($this->type->convertToPHPValue('', $this->platform)); } public function testJsonStringConvertsToPHPValue() @@ -57,7 +57,7 @@ public function testJsonStringConvertsToPHPValue() $databaseValue = json_encode($value); $phpValue = $this->type->convertToPHPValue($databaseValue, $this->platform); - $this->assertEquals($value, $phpValue); + self::assertEquals($value, $phpValue); } /** @dataProvider providerFailure */ @@ -78,11 +78,11 @@ public function testJsonResourceConvertsToPHPValue() $databaseValue = fopen('data://text/plain;base64,' . base64_encode(json_encode($value)), 'r'); $phpValue = $this->type->convertToPHPValue($databaseValue, $this->platform); - $this->assertSame($value, $phpValue); + self::assertSame($value, $phpValue); } public function testRequiresSQLCommentHint() { - $this->assertTrue($this->type->requiresSQLCommentHint($this->platform)); + self::assertTrue($this->type->requiresSQLCommentHint($this->platform)); } } diff --git a/tests/Doctrine/Tests/DBAL/Types/ObjectTest.php b/tests/Doctrine/Tests/DBAL/Types/ObjectTest.php index 062394d888b..a314adcf0aa 100644 --- a/tests/Doctrine/Tests/DBAL/Types/ObjectTest.php +++ b/tests/Doctrine/Tests/DBAL/Types/ObjectTest.php @@ -24,12 +24,12 @@ protected function tearDown() public function testObjectConvertsToDatabaseValue() { - $this->assertInternalType('string', $this->_type->convertToDatabaseValue(new \stdClass(), $this->_platform)); + self::assertInternalType('string', $this->_type->convertToDatabaseValue(new \stdClass(), $this->_platform)); } public function testObjectConvertsToPHPValue() { - $this->assertInternalType('object', $this->_type->convertToPHPValue(serialize(new \stdClass), $this->_platform)); + self::assertInternalType('object', $this->_type->convertToPHPValue(serialize(new \stdClass), $this->_platform)); } public function testConversionFailure() @@ -41,7 +41,7 @@ public function testConversionFailure() public function testNullConversion() { - $this->assertNull($this->_type->convertToPHPValue(null, $this->_platform)); + self::assertNull($this->_type->convertToPHPValue(null, $this->_platform)); } /** @@ -49,6 +49,6 @@ public function testNullConversion() */ public function testFalseConversion() { - $this->assertFalse($this->_type->convertToPHPValue(serialize(false), $this->_platform)); + self::assertFalse($this->_type->convertToPHPValue(serialize(false), $this->_platform)); } } diff --git a/tests/Doctrine/Tests/DBAL/Types/SmallIntTest.php b/tests/Doctrine/Tests/DBAL/Types/SmallIntTest.php index 8f81471007a..eb0f381de5a 100644 --- a/tests/Doctrine/Tests/DBAL/Types/SmallIntTest.php +++ b/tests/Doctrine/Tests/DBAL/Types/SmallIntTest.php @@ -19,12 +19,12 @@ protected function setUp() public function testSmallIntConvertsToPHPValue() { - $this->assertInternalType('integer', $this->_type->convertToPHPValue('1', $this->_platform)); - $this->assertInternalType('integer', $this->_type->convertToPHPValue('0', $this->_platform)); + self::assertInternalType('integer', $this->_type->convertToPHPValue('1', $this->_platform)); + self::assertInternalType('integer', $this->_type->convertToPHPValue('0', $this->_platform)); } public function testSmallIntNullConvertsToPHPValue() { - $this->assertNull($this->_type->convertToPHPValue(null, $this->_platform)); + self::assertNull($this->_type->convertToPHPValue(null, $this->_platform)); } } diff --git a/tests/Doctrine/Tests/DBAL/Types/StringTest.php b/tests/Doctrine/Tests/DBAL/Types/StringTest.php index cb30f0e2513..4c20268f0a5 100644 --- a/tests/Doctrine/Tests/DBAL/Types/StringTest.php +++ b/tests/Doctrine/Tests/DBAL/Types/StringTest.php @@ -19,29 +19,29 @@ protected function setUp() public function testReturnsSqlDeclarationFromPlatformVarchar() { - $this->assertEquals("DUMMYVARCHAR()", $this->_type->getSqlDeclaration(array(), $this->_platform)); + self::assertEquals("DUMMYVARCHAR()", $this->_type->getSqlDeclaration(array(), $this->_platform)); } public function testReturnsDefaultLengthFromPlatformVarchar() { - $this->assertEquals(255, $this->_type->getDefaultLength($this->_platform)); + self::assertEquals(255, $this->_type->getDefaultLength($this->_platform)); } public function testConvertToPHPValue() { - $this->assertInternalType("string", $this->_type->convertToPHPValue("foo", $this->_platform)); - $this->assertInternalType("string", $this->_type->convertToPHPValue("", $this->_platform)); + self::assertInternalType("string", $this->_type->convertToPHPValue("foo", $this->_platform)); + self::assertInternalType("string", $this->_type->convertToPHPValue("", $this->_platform)); } public function testNullConversion() { - $this->assertNull($this->_type->convertToPHPValue(null, $this->_platform)); + self::assertNull($this->_type->convertToPHPValue(null, $this->_platform)); } public function testSQLConversion() { - $this->assertFalse($this->_type->canRequireSQLConversion(), "String type can never require SQL conversion to work."); - $this->assertEquals('t.foo', $this->_type->convertToDatabaseValueSQL('t.foo', $this->_platform)); - $this->assertEquals('t.foo', $this->_type->convertToPHPValueSQL('t.foo', $this->_platform)); + self::assertFalse($this->_type->canRequireSQLConversion(), "String type can never require SQL conversion to work."); + self::assertEquals('t.foo', $this->_type->convertToDatabaseValueSQL('t.foo', $this->_platform)); + self::assertEquals('t.foo', $this->_type->convertToPHPValueSQL('t.foo', $this->_platform)); } } diff --git a/tests/Doctrine/Tests/DBAL/Types/TimeImmutableTypeTest.php b/tests/Doctrine/Tests/DBAL/Types/TimeImmutableTypeTest.php index 0dca385245c..9bca6fa0c34 100644 --- a/tests/Doctrine/Tests/DBAL/Types/TimeImmutableTypeTest.php +++ b/tests/Doctrine/Tests/DBAL/Types/TimeImmutableTypeTest.php @@ -27,17 +27,17 @@ protected function setUp() public function testFactoryCreatesCorrectType() { - $this->assertSame(TimeImmutableType::class, get_class($this->type)); + self::assertSame(TimeImmutableType::class, get_class($this->type)); } public function testReturnsName() { - $this->assertSame('time_immutable', $this->type->getName()); + self::assertSame('time_immutable', $this->type->getName()); } public function testReturnsBindingType() { - $this->assertSame(\PDO::PARAM_STR, $this->type->getBindingType()); + self::assertSame(\PDO::PARAM_STR, $this->type->getBindingType()); } public function testConvertsDateTimeImmutableInstanceToDatabaseValue() @@ -47,7 +47,7 @@ public function testConvertsDateTimeImmutableInstanceToDatabaseValue() $this->platform->getTimeFormatString()->willReturn('H:i:s')->shouldBeCalled(); $date->format('H:i:s')->willReturn('15:58:59')->shouldBeCalled(); - $this->assertSame( + self::assertSame( '15:58:59', $this->type->convertToDatabaseValue($date->reveal(), $this->platform->reveal()) ); @@ -55,7 +55,7 @@ public function testConvertsDateTimeImmutableInstanceToDatabaseValue() public function testConvertsNullToDatabaseValue() { - $this->assertNull($this->type->convertToDatabaseValue(null, $this->platform->reveal())); + self::assertNull($this->type->convertToDatabaseValue(null, $this->platform->reveal())); } public function testDoesNotSupportMutableDateTimeToDatabaseValueConversion() @@ -69,12 +69,12 @@ public function testConvertsDateTimeImmutableInstanceToPHPValue() { $date = new \DateTimeImmutable(); - $this->assertSame($date, $this->type->convertToPHPValue($date, $this->platform->reveal())); + self::assertSame($date, $this->type->convertToPHPValue($date, $this->platform->reveal())); } public function testConvertsNullToPHPValue() { - $this->assertNull($this->type->convertToPHPValue(null, $this->platform->reveal())); + self::assertNull($this->type->convertToPHPValue(null, $this->platform->reveal())); } public function testConvertsTimeStringToPHPValue() @@ -83,8 +83,8 @@ public function testConvertsTimeStringToPHPValue() $date = $this->type->convertToPHPValue('15:58:59', $this->platform->reveal()); - $this->assertInstanceOf(\DateTimeImmutable::class, $date); - $this->assertSame('15:58:59', $date->format('H:i:s')); + self::assertInstanceOf(\DateTimeImmutable::class, $date); + self::assertSame('15:58:59', $date->format('H:i:s')); } public function testResetDateFractionsWhenConvertingToPHPValue() @@ -93,7 +93,7 @@ public function testResetDateFractionsWhenConvertingToPHPValue() $date = $this->type->convertToPHPValue('15:58:59', $this->platform->reveal()); - $this->assertSame('1970-01-01 15:58:59', $date->format('Y-m-d H:i:s')); + self::assertSame('1970-01-01 15:58:59', $date->format('Y-m-d H:i:s')); } public function testThrowsExceptionDuringConversionToPHPValueWithInvalidTimeString() @@ -105,6 +105,6 @@ public function testThrowsExceptionDuringConversionToPHPValueWithInvalidTimeStri public function testRequiresSQLCommentHint() { - $this->assertTrue($this->type->requiresSQLCommentHint($this->platform->reveal())); + self::assertTrue($this->type->requiresSQLCommentHint($this->platform->reveal())); } } diff --git a/tests/Doctrine/Tests/DBAL/Types/TimeTest.php b/tests/Doctrine/Tests/DBAL/Types/TimeTest.php index 6bc4c43982b..f55d50e7ad7 100644 --- a/tests/Doctrine/Tests/DBAL/Types/TimeTest.php +++ b/tests/Doctrine/Tests/DBAL/Types/TimeTest.php @@ -18,15 +18,15 @@ protected function setUp() public function testTimeConvertsToPHPValue() { - $this->assertInstanceOf('DateTime', $this->type->convertToPHPValue('5:30:55', $this->platform)); + self::assertInstanceOf('DateTime', $this->type->convertToPHPValue('5:30:55', $this->platform)); } public function testDateFieldResetInPHPValue() { $time = $this->type->convertToPHPValue('01:23:34', $this->platform); - $this->assertEquals('01:23:34', $time->format('H:i:s')); - $this->assertEquals('1970-01-01', $time->format('Y-m-d')); + self::assertEquals('01:23:34', $time->format('H:i:s')); + self::assertEquals('1970-01-01', $time->format('Y-m-d')); } public function testInvalidTimeFormatConversion() diff --git a/tests/Doctrine/Tests/DBAL/Types/VarDateTimeImmutableTypeTest.php b/tests/Doctrine/Tests/DBAL/Types/VarDateTimeImmutableTypeTest.php index 144d055d2fa..1ce9adfc029 100644 --- a/tests/Doctrine/Tests/DBAL/Types/VarDateTimeImmutableTypeTest.php +++ b/tests/Doctrine/Tests/DBAL/Types/VarDateTimeImmutableTypeTest.php @@ -31,12 +31,12 @@ protected function setUp() public function testReturnsName() { - $this->assertSame('datetime_immutable', $this->type->getName()); + self::assertSame('datetime_immutable', $this->type->getName()); } public function testReturnsBindingType() { - $this->assertSame(\PDO::PARAM_STR, $this->type->getBindingType()); + self::assertSame(\PDO::PARAM_STR, $this->type->getBindingType()); } public function testConvertsDateTimeImmutableInstanceToDatabaseValue() @@ -46,7 +46,7 @@ public function testConvertsDateTimeImmutableInstanceToDatabaseValue() $this->platform->getDateTimeFormatString()->willReturn('Y-m-d H:i:s')->shouldBeCalled(); $date->format('Y-m-d H:i:s')->willReturn('2016-01-01 15:58:59')->shouldBeCalled(); - $this->assertSame( + self::assertSame( '2016-01-01 15:58:59', $this->type->convertToDatabaseValue($date->reveal(), $this->platform->reveal()) ); @@ -54,7 +54,7 @@ public function testConvertsDateTimeImmutableInstanceToDatabaseValue() public function testConvertsNullToDatabaseValue() { - $this->assertNull($this->type->convertToDatabaseValue(null, $this->platform->reveal())); + self::assertNull($this->type->convertToDatabaseValue(null, $this->platform->reveal())); } public function testDoesNotSupportMutableDateTimeToDatabaseValueConversion() @@ -68,12 +68,12 @@ public function testConvertsDateTimeImmutableInstanceToPHPValue() { $date = new \DateTimeImmutable(); - $this->assertSame($date, $this->type->convertToPHPValue($date, $this->platform->reveal())); + self::assertSame($date, $this->type->convertToPHPValue($date, $this->platform->reveal())); } public function testConvertsNullToPHPValue() { - $this->assertNull($this->type->convertToPHPValue(null, $this->platform->reveal())); + self::assertNull($this->type->convertToPHPValue(null, $this->platform->reveal())); } public function testConvertsDateishStringToPHPValue() @@ -82,8 +82,8 @@ public function testConvertsDateishStringToPHPValue() $date = $this->type->convertToPHPValue('2016-01-01 15:58:59.123456 UTC', $this->platform->reveal()); - $this->assertInstanceOf(\DateTimeImmutable::class, $date); - $this->assertSame('2016-01-01 15:58:59.123456 UTC', $date->format('Y-m-d H:i:s.u T')); + self::assertInstanceOf(\DateTimeImmutable::class, $date); + self::assertSame('2016-01-01 15:58:59.123456 UTC', $date->format('Y-m-d H:i:s.u T')); } public function testThrowsExceptionDuringConversionToPHPValueWithInvalidDateishString() @@ -95,6 +95,6 @@ public function testThrowsExceptionDuringConversionToPHPValueWithInvalidDateishS public function testRequiresSQLCommentHint() { - $this->assertTrue($this->type->requiresSQLCommentHint($this->platform->reveal())); + self::assertTrue($this->type->requiresSQLCommentHint($this->platform->reveal())); } } diff --git a/tests/Doctrine/Tests/DBAL/Types/VarDateTimeTest.php b/tests/Doctrine/Tests/DBAL/Types/VarDateTimeTest.php index 8c185fe45d6..d9c47b02f86 100644 --- a/tests/Doctrine/Tests/DBAL/Types/VarDateTimeTest.php +++ b/tests/Doctrine/Tests/DBAL/Types/VarDateTimeTest.php @@ -27,16 +27,16 @@ public function testDateTimeConvertsToDatabaseValue() $expected = $date->format($this->_platform->getDateTimeTzFormatString()); $actual = $this->_type->convertToDatabaseValue($date, $this->_platform); - $this->assertEquals($expected, $actual); + self::assertEquals($expected, $actual); } public function testDateTimeConvertsToPHPValue() { // Birthday of jwage and also birthday of Doctrine. Send him a present ;) $date = $this->_type->convertToPHPValue('1985-09-01 00:00:00', $this->_platform); - $this->assertInstanceOf('DateTime', $date); - $this->assertEquals('1985-09-01 00:00:00', $date->format('Y-m-d H:i:s')); - $this->assertEquals('000000', $date->format('u')); + self::assertInstanceOf('DateTime', $date); + self::assertEquals('1985-09-01 00:00:00', $date->format('Y-m-d H:i:s')); + self::assertEquals('000000', $date->format('u')); } public function testInvalidDateTimeFormatConversion() @@ -48,19 +48,19 @@ public function testInvalidDateTimeFormatConversion() public function testConversionWithMicroseconds() { $date = $this->_type->convertToPHPValue('1985-09-01 00:00:00.123456', $this->_platform); - $this->assertInstanceOf('DateTime', $date); - $this->assertEquals('1985-09-01 00:00:00', $date->format('Y-m-d H:i:s')); - $this->assertEquals('123456', $date->format('u')); + self::assertInstanceOf('DateTime', $date); + self::assertEquals('1985-09-01 00:00:00', $date->format('Y-m-d H:i:s')); + self::assertEquals('123456', $date->format('u')); } public function testNullConversion() { - $this->assertNull($this->_type->convertToPHPValue(null, $this->_platform)); + self::assertNull($this->_type->convertToPHPValue(null, $this->_platform)); } public function testConvertDateTimeToPHPValue() { $date = new \DateTime("now"); - $this->assertSame($date, $this->_type->convertToPHPValue($date, $this->_platform)); + self::assertSame($date, $this->_type->convertToPHPValue($date, $this->_platform)); } } diff --git a/tests/Doctrine/Tests/DBAL/UtilTest.php b/tests/Doctrine/Tests/DBAL/UtilTest.php index 52b49207972..672668efeaf 100644 --- a/tests/Doctrine/Tests/DBAL/UtilTest.php +++ b/tests/Doctrine/Tests/DBAL/UtilTest.php @@ -70,7 +70,7 @@ public function testConvertPositionalToNamedParameters($inputSQL, $expectedOutpu { list($statement, $params) = \Doctrine\DBAL\Driver\OCI8\OCI8Statement::convertPositionalToNamedPlaceholders($inputSQL); - $this->assertEquals($expectedOutputSQL, $statement); - $this->assertEquals($expectedOutputParamsMap, $params); + self::assertEquals($expectedOutputSQL, $statement); + self::assertEquals($expectedOutputParamsMap, $params); } -} \ No newline at end of file +} diff --git a/tests/Doctrine/Tests/DbalPerformanceTestCase.php b/tests/Doctrine/Tests/DbalPerformanceTestCase.php index 236cdf5acec..86b14073005 100644 --- a/tests/Doctrine/Tests/DbalPerformanceTestCase.php +++ b/tests/Doctrine/Tests/DbalPerformanceTestCase.php @@ -34,8 +34,8 @@ class DbalPerformanceTestCase extends DbalFunctionalTestCase protected function assertPostConditions() { // If a perf test doesn't start or stop, it fails. - $this->assertNotNull($this->startTime, "Test timing was started"); - $this->assertNotNull($this->runTime, "Test timing was stopped"); + self::assertNotNull($this->startTime, "Test timing was started"); + self::assertNotNull($this->runTime, "Test timing was stopped"); } /** From a39ea6b169f5b3e976ace35906019a923a9500e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lu=C3=ADs=20Cobucci?= Date: Fri, 8 Sep 2017 13:58:45 -0300 Subject: [PATCH 5/5] Add PHPCS to the build Modifying Travis-CI configuration to use build stages and removing explicit MySQL 5.6 execution (it's default now). PHPCS is running with PHP nightly version so we can have it failing for now. --- .gitattributes | 1 + .gitignore | 4 +- .travis.yml | 208 +++++++++++++++++++++++++++++++++---------------- composer.json | 4 +- phpcs.xml.dist | 24 ++++++ 5 files changed, 170 insertions(+), 71 deletions(-) create mode 100644 phpcs.xml.dist diff --git a/.gitattributes b/.gitattributes index 56b4eaa34b5..a1cc1016a70 100644 --- a/.gitattributes +++ b/.gitattributes @@ -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 diff --git a/.gitignore b/.gitignore index aca37e11104..a9bb6669500 100644 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,6 @@ dist/ download/ vendor/ *.phpunit.xml -composer.lock \ No newline at end of file +composer.lock +/phpunit.xml +/.phpcs-cache diff --git a/.travis.yml b/.travis.yml index 18798c82603..4facbe8df8a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,6 +9,7 @@ cache: php: - 7.1 + - 7.2 - nightly env: @@ -16,146 +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" || "$MARIADB_VERSION" == "10.2" || "$MARIADB_VERSION" == "10.1" || "$MARIADB_VERSION" == "10.0" || "$DB" == "mysql" || "$DB" == "mysqli" ]]; then mysql < tests/travis/create-mysql-schema.sql; fi; + - if [[ "$DB" == "mysql" || "$DB" == "mysqli" || "$DB" == "mariadb" ]]; then mysql < tests/travis/create-mysql-schema.sql; 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 +install: + - travis_retry composer -n install + +script: ./vendor/bin/phpunit --configuration tests/travis/$DB.travis.xml - - php: 7.1 - env: DB=mysqli MYSQL_VERSION=5.6 - dist: trusty +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 + sudo: required + before_script: + - bash ./tests/travis/install-mysql-5.7.sh + - stage: Test + php: nightly env: DB=mysqli 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=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 diff --git a/composer.json b/composer.json index d36fc7b9348..1fc62cb617f 100644 --- a/composer.json +++ b/composer.json @@ -19,7 +19,9 @@ "require-dev": { "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." diff --git a/phpcs.xml.dist b/phpcs.xml.dist new file mode 100644 index 00000000000..0450e4f7fbd --- /dev/null +++ b/phpcs.xml.dist @@ -0,0 +1,24 @@ + + + + + + + + + + + + lib + tests + + + + + */tests/* + + + + lib/Doctrine/DBAL/Events.php + +