diff --git a/phpcs.xml.dist b/phpcs.xml.dist
index 6fdaaf512c4..6c4117a7c52 100644
--- a/phpcs.xml.dist
+++ b/phpcs.xml.dist
@@ -15,14 +15,20 @@
-
-
+
+ */lib/*
+
+
+
+ */lib/*
+
+
*/tests/*
@@ -43,6 +49,7 @@
lib/Doctrine/DBAL/Platforms/AbstractPlatform.php
lib/Doctrine/DBAL/Schema/AbstractSchemaManager.php
+ tests/Doctrine/Tests/DBAL/Platforms/AbstractPlatformTestCase.php
diff --git a/tests/Doctrine/Tests/DBAL/Cache/QueryCacheProfileTest.php b/tests/Doctrine/Tests/DBAL/Cache/QueryCacheProfileTest.php
index 2a8fe528c9d..217b27d1f2f 100644
--- a/tests/Doctrine/Tests/DBAL/Cache/QueryCacheProfileTest.php
+++ b/tests/Doctrine/Tests/DBAL/Cache/QueryCacheProfileTest.php
@@ -38,7 +38,7 @@ protected function setUp() : void
$this->queryCacheProfile = new QueryCacheProfile(self::LIFETIME, self::CACHE_KEY);
}
- public function testShouldUseTheGivenCacheKeyIfPresent()
+ public function testShouldUseTheGivenCacheKeyIfPresent() : void
{
[$cacheKey] = $this->queryCacheProfile->generateCacheKeys(
$this->query,
@@ -50,7 +50,7 @@ public function testShouldUseTheGivenCacheKeyIfPresent()
self::assertEquals(self::CACHE_KEY, $cacheKey, 'The returned cache key should match the given one');
}
- public function testShouldGenerateAnAutomaticKeyIfNoKeyHasBeenGiven()
+ public function testShouldGenerateAnAutomaticKeyIfNoKeyHasBeenGiven() : void
{
$this->queryCacheProfile = $this->queryCacheProfile->setCacheKey(null);
@@ -70,7 +70,7 @@ public function testShouldGenerateAnAutomaticKeyIfNoKeyHasBeenGiven()
self::assertNotEmpty($cacheKey, 'The generated cache key should not be empty');
}
- public function testShouldGenerateDifferentKeysForSameQueryAndParamsAndDifferentConnections()
+ public function testShouldGenerateDifferentKeysForSameQueryAndParamsAndDifferentConnections() : void
{
$this->queryCacheProfile = $this->queryCacheProfile->setCacheKey(null);
@@ -93,7 +93,7 @@ public function testShouldGenerateDifferentKeysForSameQueryAndParamsAndDifferent
self::assertNotEquals($firstCacheKey, $secondCacheKey, 'Cache keys should be different');
}
- public function testConnectionParamsShouldBeHashed()
+ public function testConnectionParamsShouldBeHashed() : void
{
$this->queryCacheProfile = $this->queryCacheProfile->setCacheKey(null);
@@ -114,7 +114,7 @@ public function testConnectionParamsShouldBeHashed()
}
}
- public function testShouldGenerateSameKeysIfNoneOfTheParamsChanges()
+ public function testShouldGenerateSameKeysIfNoneOfTheParamsChanges() : void
{
$this->queryCacheProfile = $this->queryCacheProfile->setCacheKey(null);
diff --git a/tests/Doctrine/Tests/DBAL/ConfigurationTest.php b/tests/Doctrine/Tests/DBAL/ConfigurationTest.php
index 87189bec852..6b478e82b5e 100644
--- a/tests/Doctrine/Tests/DBAL/ConfigurationTest.php
+++ b/tests/Doctrine/Tests/DBAL/ConfigurationTest.php
@@ -30,7 +30,7 @@ protected function setUp() : void
*
* @group DBAL-81
*/
- public function testReturnsDefaultConnectionAutoCommitMode()
+ public function testReturnsDefaultConnectionAutoCommitMode() : void
{
self::assertTrue($this->config->getAutoCommit());
}
@@ -40,7 +40,7 @@ public function testReturnsDefaultConnectionAutoCommitMode()
*
* @group DBAL-81
*/
- public function testSetsDefaultConnectionAutoCommitMode()
+ public function testSetsDefaultConnectionAutoCommitMode() : void
{
$this->config->setAutoCommit(false);
diff --git a/tests/Doctrine/Tests/DBAL/ConnectionTest.php b/tests/Doctrine/Tests/DBAL/ConnectionTest.php
index 2b18a203e05..dfd89f80dd6 100644
--- a/tests/Doctrine/Tests/DBAL/ConnectionTest.php
+++ b/tests/Doctrine/Tests/DBAL/ConnectionTest.php
@@ -72,78 +72,78 @@ private function getExecuteUpdateMockConnection()
->getMock();
}
- public function testIsConnected()
+ public function testIsConnected() : void
{
self::assertFalse($this->connection->isConnected());
}
- public function testNoTransactionActiveByDefault()
+ public function testNoTransactionActiveByDefault() : void
{
self::assertFalse($this->connection->isTransactionActive());
}
- public function testCommitWithNoActiveTransactionThrowsException()
+ public function testCommitWithNoActiveTransactionThrowsException() : void
{
$this->expectException(ConnectionException::class);
$this->connection->commit();
}
- public function testRollbackWithNoActiveTransactionThrowsException()
+ public function testRollbackWithNoActiveTransactionThrowsException() : void
{
$this->expectException(ConnectionException::class);
$this->connection->rollBack();
}
- public function testSetRollbackOnlyNoActiveTransactionThrowsException()
+ public function testSetRollbackOnlyNoActiveTransactionThrowsException() : void
{
$this->expectException(ConnectionException::class);
$this->connection->setRollbackOnly();
}
- public function testIsRollbackOnlyNoActiveTransactionThrowsException()
+ public function testIsRollbackOnlyNoActiveTransactionThrowsException() : void
{
$this->expectException(ConnectionException::class);
$this->connection->isRollbackOnly();
}
- public function testGetConfiguration()
+ public function testGetConfiguration() : void
{
$config = $this->connection->getConfiguration();
self::assertInstanceOf(Configuration::class, $config);
}
- public function testGetHost()
+ public function testGetHost() : void
{
self::assertEquals('localhost', $this->connection->getHost());
}
- public function testGetPort()
+ public function testGetPort() : void
{
self::assertEquals('1234', $this->connection->getPort());
}
- public function testGetUsername()
+ public function testGetUsername() : void
{
self::assertEquals('root', $this->connection->getUsername());
}
- public function testGetPassword()
+ public function testGetPassword() : void
{
self::assertEquals('password', $this->connection->getPassword());
}
- public function testGetDriver()
+ public function testGetDriver() : void
{
self::assertInstanceOf(\Doctrine\DBAL\Driver\PDOMySql\Driver::class, $this->connection->getDriver());
}
- public function testGetEventManager()
+ public function testGetEventManager() : void
{
self::assertInstanceOf(EventManager::class, $this->connection->getEventManager());
}
- public function testConnectDispatchEvent()
+ public function testConnectDispatchEvent() : void
{
$listenerMock = $this->getMockBuilder('ConnectDispatchEventListener')
->setMethods(['postConnect'])
@@ -161,7 +161,7 @@ public function testConnectDispatchEvent()
$conn->connect();
}
- public function testEventManagerPassedToPlatform()
+ public function testEventManagerPassedToPlatform() : void
{
$eventManager = new EventManager();
@@ -185,7 +185,7 @@ public function testEventManagerPassedToPlatform()
* @requires extension pdo_sqlite
* @dataProvider getQueryMethods
*/
- public function testDriverExceptionIsWrapped($method)
+ public function testDriverExceptionIsWrapped(string $method) : void
{
$this->expectException(DBALException::class);
$this->expectExceptionMessage("An exception occurred while executing 'MUUHAAAAHAAAA':\n\nSQLSTATE[HY000]: General error: 1 near \"MUUHAAAAHAAAA\"");
@@ -198,7 +198,10 @@ public function testDriverExceptionIsWrapped($method)
$connection->$method('MUUHAAAAHAAAA');
}
- public function getQueryMethods()
+ /**
+ * @return array>
+ */
+ public static function getQueryMethods() : iterable
{
return [
['exec'],
@@ -214,7 +217,7 @@ public function getQueryMethods()
*
* @group DBAL-11
*/
- public function testEchoSQLLogger()
+ public function testEchoSQLLogger() : void
{
$logger = new EchoSQLLogger();
$this->connection->getConfiguration()->setSQLLogger($logger);
@@ -226,7 +229,7 @@ public function testEchoSQLLogger()
*
* @group DBAL-11
*/
- public function testDebugSQLStack()
+ public function testDebugSQLStack() : void
{
$logger = new DebugStack();
$this->connection->getConfiguration()->setSQLLogger($logger);
@@ -236,7 +239,7 @@ public function testDebugSQLStack()
/**
* @group DBAL-81
*/
- public function testIsAutoCommit()
+ public function testIsAutoCommit() : void
{
self::assertTrue($this->connection->isAutoCommit());
}
@@ -244,7 +247,7 @@ public function testIsAutoCommit()
/**
* @group DBAL-81
*/
- public function testSetAutoCommit()
+ public function testSetAutoCommit() : void
{
$this->connection->setAutoCommit(false);
self::assertFalse($this->connection->isAutoCommit());
@@ -255,7 +258,7 @@ public function testSetAutoCommit()
/**
* @group DBAL-81
*/
- public function testConnectStartsTransactionInNoAutoCommitMode()
+ public function testConnectStartsTransactionInNoAutoCommitMode() : void
{
$driverMock = $this->createMock(Driver::class);
$driverMock->expects($this->any())
@@ -277,7 +280,7 @@ public function testConnectStartsTransactionInNoAutoCommitMode()
/**
* @group DBAL-81
*/
- public function testCommitStartsTransactionInNoAutoCommitMode()
+ public function testCommitStartsTransactionInNoAutoCommitMode() : void
{
$driverMock = $this->createMock(Driver::class);
$driverMock->expects($this->any())
@@ -297,7 +300,7 @@ public function testCommitStartsTransactionInNoAutoCommitMode()
/**
* @group DBAL-81
*/
- public function testRollBackStartsTransactionInNoAutoCommitMode()
+ public function testRollBackStartsTransactionInNoAutoCommitMode() : void
{
$driverMock = $this->createMock(Driver::class);
$driverMock->expects($this->any())
@@ -317,7 +320,7 @@ public function testRollBackStartsTransactionInNoAutoCommitMode()
/**
* @group DBAL-81
*/
- public function testSwitchingAutoCommitModeCommitsAllCurrentTransactions()
+ public function testSwitchingAutoCommitModeCommitsAllCurrentTransactions() : void
{
$driverMock = $this->createMock(Driver::class);
$driverMock->expects($this->any())
@@ -341,7 +344,7 @@ public function testSwitchingAutoCommitModeCommitsAllCurrentTransactions()
self::assertFalse($conn->isTransactionActive());
}
- public function testEmptyInsert()
+ public function testEmptyInsert() : void
{
$conn = $this->getExecuteUpdateMockConnection();
@@ -355,7 +358,7 @@ public function testEmptyInsert()
/**
* @group DBAL-2511
*/
- public function testUpdateWithDifferentColumnsInDataAndIdentifiers()
+ public function testUpdateWithDifferentColumnsInDataAndIdentifiers() : void
{
$conn = $this->getExecuteUpdateMockConnection();
@@ -399,7 +402,7 @@ public function testUpdateWithDifferentColumnsInDataAndIdentifiers()
/**
* @group DBAL-2511
*/
- public function testUpdateWithSameColumnInDataAndIdentifiers()
+ public function testUpdateWithSameColumnInDataAndIdentifiers() : void
{
$conn = $this->getExecuteUpdateMockConnection();
@@ -442,7 +445,7 @@ public function testUpdateWithSameColumnInDataAndIdentifiers()
/**
* @group DBAL-2688
*/
- public function testUpdateWithIsNull()
+ public function testUpdateWithIsNull() : void
{
$conn = $this->getExecuteUpdateMockConnection();
@@ -484,7 +487,7 @@ public function testUpdateWithIsNull()
/**
* @group DBAL-2688
*/
- public function testDeleteWithIsNull()
+ public function testDeleteWithIsNull() : void
{
$conn = $this->getExecuteUpdateMockConnection();
@@ -509,7 +512,7 @@ public function testDeleteWithIsNull()
);
}
- public function testFetchAssoc()
+ public function testFetchAssoc() : void
{
$statement = 'SELECT * FROM foo WHERE bar = ?';
$params = [666];
@@ -545,7 +548,7 @@ public function testFetchAssoc()
self::assertSame($result, $conn->fetchAssoc($statement, $params, $types));
}
- public function testFetchArray()
+ public function testFetchArray() : void
{
$statement = 'SELECT * FROM foo WHERE bar = ?';
$params = [666];
@@ -581,7 +584,7 @@ public function testFetchArray()
self::assertSame($result, $conn->fetchArray($statement, $params, $types));
}
- public function testFetchColumn()
+ public function testFetchColumn() : void
{
$statement = 'SELECT * FROM foo WHERE bar = ?';
$params = [666];
@@ -618,7 +621,7 @@ public function testFetchColumn()
self::assertSame($result, $conn->fetchColumn($statement, $params, $column, $types));
}
- public function testFetchAll()
+ public function testFetchAll() : void
{
$statement = 'SELECT * FROM foo WHERE bar = ?';
$params = [666];
@@ -653,7 +656,7 @@ public function testFetchAll()
self::assertSame($result, $conn->fetchAll($statement, $params, $types));
}
- public function testConnectionDoesNotMaintainTwoReferencesToExternalPDO()
+ public function testConnectionDoesNotMaintainTwoReferencesToExternalPDO() : void
{
$params['pdo'] = new stdClass();
@@ -664,7 +667,7 @@ public function testConnectionDoesNotMaintainTwoReferencesToExternalPDO()
self::assertArrayNotHasKey('pdo', $conn->getParams(), 'Connection is maintaining additional reference to the PDO connection');
}
- public function testPassingExternalPDOMeansConnectionIsConnected()
+ public function testPassingExternalPDOMeansConnectionIsConnected() : void
{
$params['pdo'] = new stdClass();
@@ -675,7 +678,7 @@ public function testPassingExternalPDOMeansConnectionIsConnected()
self::assertTrue($conn->isConnected(), 'Connection is not connected after passing external PDO');
}
- public function testCallingDeleteWithNoDeletionCriteriaResultsInInvalidArgumentException()
+ public function testCallingDeleteWithNoDeletionCriteriaResultsInInvalidArgumentException() : void
{
/** @var Driver $driver */
$driver = $this->createMock(Driver::class);
@@ -691,7 +694,10 @@ public function testCallingDeleteWithNoDeletionCriteriaResultsInInvalidArgumentE
$conn->delete('kittens', []);
}
- public function dataCallConnectOnce()
+ /**
+ * @return array>
+ */
+ public static function dataCallConnectOnce() : iterable
{
return [
['delete', ['tbl', ['id' => 12345]]],
@@ -703,9 +709,11 @@ public function dataCallConnectOnce()
}
/**
+ * @param array $params
+ *
* @dataProvider dataCallConnectOnce
*/
- public function testCallConnectOnce($method, $params)
+ public function testCallConnectOnce(string $method, array $params) : void
{
$driverMock = $this->createMock(Driver::class);
$pdoMock = $this->createMock(Connection::class);
@@ -729,7 +737,7 @@ public function testCallConnectOnce($method, $params)
/**
* @group DBAL-1127
*/
- public function testPlatformDetectionIsTriggerOnlyOnceOnRetrievingPlatform()
+ public function testPlatformDetectionIsTriggerOnlyOnceOnRetrievingPlatform() : void
{
/** @var Driver|VersionAwarePlatformDriver|MockObject $driverMock */
$driverMock = $this->createMock([Driver::class, VersionAwarePlatformDriver::class]);
@@ -762,7 +770,7 @@ public function testPlatformDetectionIsTriggerOnlyOnceOnRetrievingPlatform()
self::assertSame($platformMock, $connection->getDatabasePlatform());
}
- public function testConnectionParamsArePassedToTheQueryCacheProfileInExecuteCacheQuery()
+ public function testConnectionParamsArePassedToTheQueryCacheProfileInExecuteCacheQuery() : void
{
$resultCacheDriverMock = $this->createMock(Cache::class);
@@ -858,7 +866,7 @@ public function testThrowsExceptionWhenInValidPlatformSpecified() : void
/**
* @group DBAL-990
*/
- public function testRethrowsOriginalExceptionOnDeterminingPlatformWhenConnectingToNonExistentDatabase()
+ public function testRethrowsOriginalExceptionOnDeterminingPlatformWhenConnectingToNonExistentDatabase() : void
{
/** @var Driver|VersionAwarePlatformDriver|MockObject $driverMock */
$driverMock = $this->createMock([Driver::class, VersionAwarePlatformDriver::class]);
diff --git a/tests/Doctrine/Tests/DBAL/DBALExceptionTest.php b/tests/Doctrine/Tests/DBAL/DBALExceptionTest.php
index d827fdc3b7d..7db5921ba79 100644
--- a/tests/Doctrine/Tests/DBAL/DBALExceptionTest.php
+++ b/tests/Doctrine/Tests/DBAL/DBALExceptionTest.php
@@ -15,7 +15,7 @@
class DBALExceptionTest extends DbalTestCase
{
- public function testDriverExceptionDuringQueryAcceptsBinaryData()
+ public function testDriverExceptionDuringQueryAcceptsBinaryData() : void
{
/** @var Driver $driver */
$driver = $this->createMock(Driver::class);
@@ -23,7 +23,7 @@ public function testDriverExceptionDuringQueryAcceptsBinaryData()
self::assertStringContainsString('with params ["ABC", "\x80"]', $e->getMessage());
}
- public function testDriverExceptionDuringQueryAcceptsResource()
+ public function testDriverExceptionDuringQueryAcceptsResource() : void
{
/** @var Driver $driver */
$driver = $this->createMock(Driver::class);
@@ -31,7 +31,7 @@ public function testDriverExceptionDuringQueryAcceptsResource()
self::assertStringContainsString('Resource', $e->getMessage());
}
- public function testAvoidOverWrappingOnDriverException()
+ public function testAvoidOverWrappingOnDriverException() : void
{
/** @var Driver $driver */
$driver = $this->createMock(Driver::class);
@@ -44,7 +44,7 @@ public function testAvoidOverWrappingOnDriverException()
self::assertSame($ex, $e);
}
- public function testDriverRequiredWithUrl()
+ public function testDriverRequiredWithUrl() : void
{
$url = 'mysql://localhost';
$exception = DBALException::driverRequired($url);
diff --git a/tests/Doctrine/Tests/DBAL/Driver/AbstractDB2DriverTest.php b/tests/Doctrine/Tests/DBAL/Driver/AbstractDB2DriverTest.php
index e6a54060c71..7038f5f8340 100644
--- a/tests/Doctrine/Tests/DBAL/Driver/AbstractDB2DriverTest.php
+++ b/tests/Doctrine/Tests/DBAL/Driver/AbstractDB2DriverTest.php
@@ -3,23 +3,26 @@
namespace Doctrine\Tests\DBAL\Driver;
use Doctrine\DBAL\Connection;
+use Doctrine\DBAL\Driver;
use Doctrine\DBAL\Driver\AbstractDB2Driver;
+use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Platforms\DB2Platform;
+use Doctrine\DBAL\Schema\AbstractSchemaManager;
use Doctrine\DBAL\Schema\DB2SchemaManager;
class AbstractDB2DriverTest extends AbstractDriverTest
{
- protected function createDriver()
+ protected function createDriver() : Driver
{
return $this->getMockForAbstractClass(AbstractDB2Driver::class);
}
- protected function createPlatform()
+ protected function createPlatform() : AbstractPlatform
{
return new DB2Platform();
}
- protected function createSchemaManager(Connection $connection)
+ protected function createSchemaManager(Connection $connection) : AbstractSchemaManager
{
return new DB2SchemaManager($connection);
}
diff --git a/tests/Doctrine/Tests/DBAL/Driver/AbstractDriverTest.php b/tests/Doctrine/Tests/DBAL/Driver/AbstractDriverTest.php
index a9d1602a828..d2a5422a179 100644
--- a/tests/Doctrine/Tests/DBAL/Driver/AbstractDriverTest.php
+++ b/tests/Doctrine/Tests/DBAL/Driver/AbstractDriverTest.php
@@ -69,9 +69,11 @@ protected function setUp() : void
}
/**
+ * @param int|string $errorCode
+ *
* @dataProvider exceptionConversionProvider
*/
- public function testConvertsException($errorCode, $sqlState, $message, string $expectedClass) : void
+ public function testConvertsException($errorCode, ?string $sqlState, ?string $message, string $expectedClass) : void
{
if (! $this->driver instanceof ExceptionConverterDriver) {
$this->markTestSkipped('This test is only intended for exception converter drivers.');
@@ -97,7 +99,7 @@ public function testConvertsException($errorCode, $sqlState, $message, string $e
self::assertSame($dbalMessage, $dbalException->getMessage());
}
- public function testCreatesDatabasePlatformForVersion()
+ public function testCreatesDatabasePlatformForVersion() : void
{
if (! $this->driver instanceof VersionAwarePlatformDriver) {
$this->markTestSkipped('This test is only intended for version aware platform drivers.');
@@ -130,7 +132,7 @@ public function testCreatesDatabasePlatformForVersion()
}
}
- public function testThrowsExceptionOnCreatingDatabasePlatformsForInvalidVersion()
+ public function testThrowsExceptionOnCreatingDatabasePlatformsForInvalidVersion() : void
{
if (! $this->driver instanceof VersionAwarePlatformDriver) {
$this->markTestSkipped('This test is only intended for version aware platform drivers.');
@@ -140,7 +142,7 @@ public function testThrowsExceptionOnCreatingDatabasePlatformsForInvalidVersion(
$this->driver->createDatabasePlatformForVersion('foo');
}
- public function testReturnsDatabaseName()
+ public function testReturnsDatabaseName() : void
{
$params = [
'user' => 'foo',
@@ -157,12 +159,12 @@ public function testReturnsDatabaseName()
self::assertSame($params['dbname'], $this->driver->getDatabase($connection));
}
- public function testReturnsDatabasePlatform()
+ public function testReturnsDatabasePlatform() : void
{
self::assertEquals($this->createPlatform(), $this->driver->getDatabasePlatform());
}
- public function testReturnsSchemaManager()
+ public function testReturnsSchemaManager() : void
{
$connection = $this->getConnectionMock();
$schemaManager = $this->driver->getSchemaManager($connection);
@@ -177,20 +179,16 @@ public function testReturnsSchemaManager()
/**
* Factory method for creating the driver instance under test.
- *
- * @return Driver
*/
- abstract protected function createDriver();
+ abstract protected function createDriver() : Driver;
/**
* Factory method for creating the the platform instance return by the driver under test.
*
* The platform instance returned by this method must be the same as returned by
* the driver's getDatabasePlatform() method.
- *
- * @return AbstractPlatform
*/
- abstract protected function createPlatform();
+ abstract protected function createPlatform() : AbstractPlatform;
/**
* Factory method for creating the the schema manager instance return by the driver under test.
@@ -199,19 +197,20 @@ abstract protected function createPlatform();
* the driver's getSchemaManager() method.
*
* @param Connection $connection The underlying connection to use.
- *
- * @return AbstractSchemaManager
*/
- abstract protected function createSchemaManager(Connection $connection);
+ abstract protected function createSchemaManager(Connection $connection) : AbstractSchemaManager;
- protected function getConnectionMock()
+ protected function getConnectionMock() : Connection
{
return $this->getMockBuilder(Connection::class)
->disableOriginalConstructor()
->getMock();
}
- protected function getDatabasePlatformsForVersions()
+ /**
+ * @return array>
+ */
+ protected function getDatabasePlatformsForVersions() : array
{
return [];
}
diff --git a/tests/Doctrine/Tests/DBAL/Driver/AbstractMySQLDriverTest.php b/tests/Doctrine/Tests/DBAL/Driver/AbstractMySQLDriverTest.php
index fdb1668f5a1..4982a189e05 100644
--- a/tests/Doctrine/Tests/DBAL/Driver/AbstractMySQLDriverTest.php
+++ b/tests/Doctrine/Tests/DBAL/Driver/AbstractMySQLDriverTest.php
@@ -3,17 +3,20 @@
namespace Doctrine\Tests\DBAL\Driver;
use Doctrine\DBAL\Connection;
+use Doctrine\DBAL\Driver;
use Doctrine\DBAL\Driver\AbstractMySQLDriver;
use Doctrine\DBAL\Driver\ResultStatement;
+use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Platforms\MariaDb1027Platform;
use Doctrine\DBAL\Platforms\MySQL57Platform;
use Doctrine\DBAL\Platforms\MySQL80Platform;
use Doctrine\DBAL\Platforms\MySqlPlatform;
+use Doctrine\DBAL\Schema\AbstractSchemaManager;
use Doctrine\DBAL\Schema\MySqlSchemaManager;
class AbstractMySQLDriverTest extends AbstractDriverTest
{
- public function testReturnsDatabaseName()
+ public function testReturnsDatabaseName() : void
{
parent::testReturnsDatabaseName();
@@ -42,23 +45,23 @@ public function testReturnsDatabaseName()
self::assertSame($database, $this->driver->getDatabase($connection));
}
- protected function createDriver()
+ protected function createDriver() : Driver
{
return $this->getMockForAbstractClass(AbstractMySQLDriver::class);
}
- protected function createPlatform()
+ protected function createPlatform() : AbstractPlatform
{
return new MySqlPlatform();
}
- protected function createSchemaManager(Connection $connection)
+ protected function createSchemaManager(Connection $connection) : AbstractSchemaManager
{
return new MySqlSchemaManager($connection);
}
/**
- * @return mixed[][]
+ * {@inheritDoc}
*/
protected function getDatabasePlatformsForVersions() : array
{
diff --git a/tests/Doctrine/Tests/DBAL/Driver/AbstractOracleDriverTest.php b/tests/Doctrine/Tests/DBAL/Driver/AbstractOracleDriverTest.php
index 6d272571f49..f95705a8a88 100644
--- a/tests/Doctrine/Tests/DBAL/Driver/AbstractOracleDriverTest.php
+++ b/tests/Doctrine/Tests/DBAL/Driver/AbstractOracleDriverTest.php
@@ -3,13 +3,16 @@
namespace Doctrine\Tests\DBAL\Driver;
use Doctrine\DBAL\Connection;
+use Doctrine\DBAL\Driver;
use Doctrine\DBAL\Driver\AbstractOracleDriver;
+use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Platforms\OraclePlatform;
+use Doctrine\DBAL\Schema\AbstractSchemaManager;
use Doctrine\DBAL\Schema\OracleSchemaManager;
class AbstractOracleDriverTest extends AbstractDriverTest
{
- public function testReturnsDatabaseName()
+ public function testReturnsDatabaseName() : void
{
$params = [
'user' => 'foo',
@@ -26,7 +29,7 @@ public function testReturnsDatabaseName()
self::assertSame($params['user'], $this->driver->getDatabase($connection));
}
- public function testReturnsDatabaseNameWithConnectDescriptor()
+ public function testReturnsDatabaseNameWithConnectDescriptor() : void
{
$params = [
'user' => 'foo',
@@ -45,17 +48,17 @@ public function testReturnsDatabaseNameWithConnectDescriptor()
self::assertSame($params['user'], $this->driver->getDatabase($connection));
}
- protected function createDriver()
+ protected function createDriver() : Driver
{
return $this->getMockForAbstractClass(AbstractOracleDriver::class);
}
- protected function createPlatform()
+ protected function createPlatform() : AbstractPlatform
{
return new OraclePlatform();
}
- protected function createSchemaManager(Connection $connection)
+ protected function createSchemaManager(Connection $connection) : AbstractSchemaManager
{
return new OracleSchemaManager($connection);
}
diff --git a/tests/Doctrine/Tests/DBAL/Driver/AbstractPostgreSQLDriverTest.php b/tests/Doctrine/Tests/DBAL/Driver/AbstractPostgreSQLDriverTest.php
index 1f508882484..2ba6a732bd4 100644
--- a/tests/Doctrine/Tests/DBAL/Driver/AbstractPostgreSQLDriverTest.php
+++ b/tests/Doctrine/Tests/DBAL/Driver/AbstractPostgreSQLDriverTest.php
@@ -3,18 +3,21 @@
namespace Doctrine\Tests\DBAL\Driver;
use Doctrine\DBAL\Connection;
+use Doctrine\DBAL\Driver;
use Doctrine\DBAL\Driver\AbstractPostgreSQLDriver;
use Doctrine\DBAL\Driver\ResultStatement;
+use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Platforms\PostgreSQL100Platform;
use Doctrine\DBAL\Platforms\PostgreSQL91Platform;
use Doctrine\DBAL\Platforms\PostgreSQL92Platform;
use Doctrine\DBAL\Platforms\PostgreSQL94Platform;
use Doctrine\DBAL\Platforms\PostgreSqlPlatform;
+use Doctrine\DBAL\Schema\AbstractSchemaManager;
use Doctrine\DBAL\Schema\PostgreSqlSchemaManager;
class AbstractPostgreSQLDriverTest extends AbstractDriverTest
{
- public function testReturnsDatabaseName()
+ public function testReturnsDatabaseName() : void
{
parent::testReturnsDatabaseName();
@@ -43,22 +46,25 @@ public function testReturnsDatabaseName()
self::assertSame($database, $this->driver->getDatabase($connection));
}
- protected function createDriver()
+ protected function createDriver() : Driver
{
return $this->getMockForAbstractClass(AbstractPostgreSQLDriver::class);
}
- protected function createPlatform()
+ protected function createPlatform() : AbstractPlatform
{
return new PostgreSqlPlatform();
}
- protected function createSchemaManager(Connection $connection)
+ protected function createSchemaManager(Connection $connection) : AbstractSchemaManager
{
return new PostgreSqlSchemaManager($connection);
}
- protected function getDatabasePlatformsForVersions()
+ /**
+ * {@inheritDoc}
+ */
+ protected function getDatabasePlatformsForVersions() : array
{
return [
['9.0.9', PostgreSqlPlatform::class],
diff --git a/tests/Doctrine/Tests/DBAL/Driver/AbstractSQLAnywhereDriverTest.php b/tests/Doctrine/Tests/DBAL/Driver/AbstractSQLAnywhereDriverTest.php
index e541285a568..4c51e7cb35f 100644
--- a/tests/Doctrine/Tests/DBAL/Driver/AbstractSQLAnywhereDriverTest.php
+++ b/tests/Doctrine/Tests/DBAL/Driver/AbstractSQLAnywhereDriverTest.php
@@ -3,31 +3,37 @@
namespace Doctrine\Tests\DBAL\Driver;
use Doctrine\DBAL\Connection;
+use Doctrine\DBAL\Driver;
use Doctrine\DBAL\Driver\AbstractSQLAnywhereDriver;
+use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Platforms\SQLAnywhere11Platform;
use Doctrine\DBAL\Platforms\SQLAnywhere12Platform;
use Doctrine\DBAL\Platforms\SQLAnywhere16Platform;
use Doctrine\DBAL\Platforms\SQLAnywherePlatform;
+use Doctrine\DBAL\Schema\AbstractSchemaManager;
use Doctrine\DBAL\Schema\SQLAnywhereSchemaManager;
class AbstractSQLAnywhereDriverTest extends AbstractDriverTest
{
- protected function createDriver()
+ protected function createDriver() : Driver
{
return $this->getMockForAbstractClass(AbstractSQLAnywhereDriver::class);
}
- protected function createPlatform()
+ protected function createPlatform() : AbstractPlatform
{
return new SQLAnywhere12Platform();
}
- protected function createSchemaManager(Connection $connection)
+ protected function createSchemaManager(Connection $connection) : AbstractSchemaManager
{
return new SQLAnywhereSchemaManager($connection);
}
- protected function getDatabasePlatformsForVersions()
+ /**
+ * {@inheritDoc}
+ */
+ protected function getDatabasePlatformsForVersions() : array
{
return [
['10', SQLAnywherePlatform::class],
diff --git a/tests/Doctrine/Tests/DBAL/Driver/AbstractSQLServerDriverTest.php b/tests/Doctrine/Tests/DBAL/Driver/AbstractSQLServerDriverTest.php
index 48fb3b29f3e..0d34df8e81b 100644
--- a/tests/Doctrine/Tests/DBAL/Driver/AbstractSQLServerDriverTest.php
+++ b/tests/Doctrine/Tests/DBAL/Driver/AbstractSQLServerDriverTest.php
@@ -3,31 +3,37 @@
namespace Doctrine\Tests\DBAL\Driver;
use Doctrine\DBAL\Connection;
+use Doctrine\DBAL\Driver;
use Doctrine\DBAL\Driver\AbstractSQLServerDriver;
+use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Platforms\SQLServer2005Platform;
use Doctrine\DBAL\Platforms\SQLServer2008Platform;
use Doctrine\DBAL\Platforms\SQLServer2012Platform;
use Doctrine\DBAL\Platforms\SQLServerPlatform;
+use Doctrine\DBAL\Schema\AbstractSchemaManager;
use Doctrine\DBAL\Schema\SQLServerSchemaManager;
class AbstractSQLServerDriverTest extends AbstractDriverTest
{
- protected function createDriver()
+ protected function createDriver() : Driver
{
return $this->getMockForAbstractClass(AbstractSQLServerDriver::class);
}
- protected function createPlatform()
+ protected function createPlatform() : AbstractPlatform
{
return new SQLServer2008Platform();
}
- protected function createSchemaManager(Connection $connection)
+ protected function createSchemaManager(Connection $connection) : AbstractSchemaManager
{
return new SQLServerSchemaManager($connection);
}
- protected function getDatabasePlatformsForVersions()
+ /**
+ * {@inheritDoc}
+ */
+ protected function getDatabasePlatformsForVersions() : array
{
return [
['9', SQLServerPlatform::class],
diff --git a/tests/Doctrine/Tests/DBAL/Driver/AbstractSQLiteDriverTest.php b/tests/Doctrine/Tests/DBAL/Driver/AbstractSQLiteDriverTest.php
index 2e97496958b..338f9126077 100644
--- a/tests/Doctrine/Tests/DBAL/Driver/AbstractSQLiteDriverTest.php
+++ b/tests/Doctrine/Tests/DBAL/Driver/AbstractSQLiteDriverTest.php
@@ -3,13 +3,16 @@
namespace Doctrine\Tests\DBAL\Driver;
use Doctrine\DBAL\Connection;
+use Doctrine\DBAL\Driver;
use Doctrine\DBAL\Driver\AbstractSQLiteDriver;
+use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Platforms\SqlitePlatform;
+use Doctrine\DBAL\Schema\AbstractSchemaManager;
use Doctrine\DBAL\Schema\SqliteSchemaManager;
class AbstractSQLiteDriverTest extends AbstractDriverTest
{
- public function testReturnsDatabaseName()
+ public function testReturnsDatabaseName() : void
{
$params = [
'user' => 'foo',
@@ -27,17 +30,17 @@ public function testReturnsDatabaseName()
self::assertSame($params['path'], $this->driver->getDatabase($connection));
}
- protected function createDriver()
+ protected function createDriver() : Driver
{
return $this->getMockForAbstractClass(AbstractSQLiteDriver::class);
}
- protected function createPlatform()
+ protected function createPlatform() : AbstractPlatform
{
return new SqlitePlatform();
}
- protected function createSchemaManager(Connection $connection)
+ protected function createSchemaManager(Connection $connection) : AbstractSchemaManager
{
return new SqliteSchemaManager($connection);
}
diff --git a/tests/Doctrine/Tests/DBAL/Driver/DrizzlePDOMySql/DriverTest.php b/tests/Doctrine/Tests/DBAL/Driver/DrizzlePDOMySql/DriverTest.php
index 520a732a0c3..5af24b8454a 100644
--- a/tests/Doctrine/Tests/DBAL/Driver/DrizzlePDOMySql/DriverTest.php
+++ b/tests/Doctrine/Tests/DBAL/Driver/DrizzlePDOMySql/DriverTest.php
@@ -3,34 +3,37 @@
namespace Doctrine\Tests\DBAL\Driver\DrizzlePDOMySql;
use Doctrine\DBAL\Connection;
+use Doctrine\DBAL\Driver as DriverInterface;
use Doctrine\DBAL\Driver\DrizzlePDOMySql\Driver;
+use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Platforms\DrizzlePlatform;
+use Doctrine\DBAL\Schema\AbstractSchemaManager;
use Doctrine\DBAL\Schema\DrizzleSchemaManager;
use Doctrine\Tests\DBAL\Driver\PDOMySql\DriverTest as PDOMySQLDriverTest;
class DriverTest extends PDOMySQLDriverTest
{
- public function testReturnsName()
+ public function testReturnsName() : void
{
self::assertSame('drizzle_pdo_mysql', $this->driver->getName());
}
- public function testThrowsExceptionOnCreatingDatabasePlatformsForInvalidVersion()
+ public function testThrowsExceptionOnCreatingDatabasePlatformsForInvalidVersion() : void
{
$this->markTestSkipped('This test does not work on Drizzle as it is not version aware.');
}
- protected function createDriver()
+ protected function createDriver() : DriverInterface
{
return new Driver();
}
- protected function createPlatform()
+ protected function createPlatform() : AbstractPlatform
{
return new DrizzlePlatform();
}
- protected function createSchemaManager(Connection $connection)
+ protected function createSchemaManager(Connection $connection) : AbstractSchemaManager
{
return new DrizzleSchemaManager($connection);
}
diff --git a/tests/Doctrine/Tests/DBAL/Driver/IBMDB2/DB2ConnectionTest.php b/tests/Doctrine/Tests/DBAL/Driver/IBMDB2/DB2ConnectionTest.php
index b6b32751262..cf2db940b33 100644
--- a/tests/Doctrine/Tests/DBAL/Driver/IBMDB2/DB2ConnectionTest.php
+++ b/tests/Doctrine/Tests/DBAL/Driver/IBMDB2/DB2ConnectionTest.php
@@ -29,7 +29,7 @@ protected function setUp() : void
->getMockForAbstractClass();
}
- public function testDoesNotRequireQueryForServerVersion()
+ public function testDoesNotRequireQueryForServerVersion() : void
{
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 93f390b628a..dcf9f6083e3 100644
--- a/tests/Doctrine/Tests/DBAL/Driver/IBMDB2/DB2DriverTest.php
+++ b/tests/Doctrine/Tests/DBAL/Driver/IBMDB2/DB2DriverTest.php
@@ -2,17 +2,18 @@
namespace Doctrine\Tests\DBAL\Driver\IBMDB2;
+use Doctrine\DBAL\Driver as DriverInterface;
use Doctrine\DBAL\Driver\IBMDB2\DB2Driver;
use Doctrine\Tests\DBAL\Driver\AbstractDB2DriverTest;
class DB2DriverTest extends AbstractDB2DriverTest
{
- public function testReturnsName()
+ public function testReturnsName() : void
{
self::assertSame('ibm_db2', $this->driver->getName());
}
- protected function createDriver()
+ protected function createDriver() : DriverInterface
{
return new DB2Driver();
}
diff --git a/tests/Doctrine/Tests/DBAL/Driver/Mysqli/DriverTest.php b/tests/Doctrine/Tests/DBAL/Driver/Mysqli/DriverTest.php
index f38ff8a5529..bbe16b34717 100644
--- a/tests/Doctrine/Tests/DBAL/Driver/Mysqli/DriverTest.php
+++ b/tests/Doctrine/Tests/DBAL/Driver/Mysqli/DriverTest.php
@@ -2,17 +2,18 @@
namespace Doctrine\Tests\DBAL\Driver\Mysqli;
+use Doctrine\DBAL\Driver as DriverInterface;
use Doctrine\DBAL\Driver\Mysqli\Driver;
use Doctrine\Tests\DBAL\Driver\AbstractMySQLDriverTest;
class DriverTest extends AbstractMySQLDriverTest
{
- public function testReturnsName()
+ public function testReturnsName() : void
{
self::assertSame('mysqli', $this->driver->getName());
}
- protected function createDriver()
+ protected function createDriver() : DriverInterface
{
return new Driver();
}
diff --git a/tests/Doctrine/Tests/DBAL/Driver/Mysqli/MysqliConnectionTest.php b/tests/Doctrine/Tests/DBAL/Driver/Mysqli/MysqliConnectionTest.php
index a192edf6f52..dcfbe715608 100644
--- a/tests/Doctrine/Tests/DBAL/Driver/Mysqli/MysqliConnectionTest.php
+++ b/tests/Doctrine/Tests/DBAL/Driver/Mysqli/MysqliConnectionTest.php
@@ -37,14 +37,14 @@ protected function setUp() : void
->getMockForAbstractClass();
}
- public function testDoesNotRequireQueryForServerVersion()
+ public function testDoesNotRequireQueryForServerVersion() : void
{
self::assertFalse($this->connectionMock->requiresQueryForServerVersion());
}
- public function testRestoresErrorHandlerOnException()
+ public function testRestoresErrorHandlerOnException() : void
{
- $handler = static function () {
+ $handler = static function () : void {
self::fail('Never expected this to be called');
};
$default_handler = set_error_handler($handler);
diff --git a/tests/Doctrine/Tests/DBAL/Driver/OCI8/DriverTest.php b/tests/Doctrine/Tests/DBAL/Driver/OCI8/DriverTest.php
index 77e763a66bb..7b6ed1d5a55 100644
--- a/tests/Doctrine/Tests/DBAL/Driver/OCI8/DriverTest.php
+++ b/tests/Doctrine/Tests/DBAL/Driver/OCI8/DriverTest.php
@@ -2,17 +2,18 @@
namespace Doctrine\Tests\DBAL\Driver\OCI8;
+use Doctrine\DBAL\Driver as DriverInterface;
use Doctrine\DBAL\Driver\OCI8\Driver;
use Doctrine\Tests\DBAL\Driver\AbstractOracleDriverTest;
class DriverTest extends AbstractOracleDriverTest
{
- public function testReturnsName()
+ public function testReturnsName() : void
{
self::assertSame('oci8', $this->driver->getName());
}
- protected function createDriver()
+ protected function createDriver() : DriverInterface
{
return new Driver();
}
diff --git a/tests/Doctrine/Tests/DBAL/Driver/OCI8/OCI8ConnectionTest.php b/tests/Doctrine/Tests/DBAL/Driver/OCI8/OCI8ConnectionTest.php
index 81466a3a72e..4c3868f4a95 100644
--- a/tests/Doctrine/Tests/DBAL/Driver/OCI8/OCI8ConnectionTest.php
+++ b/tests/Doctrine/Tests/DBAL/Driver/OCI8/OCI8ConnectionTest.php
@@ -29,7 +29,7 @@ protected function setUp() : void
->getMockForAbstractClass();
}
- public function testDoesNotRequireQueryForServerVersion()
+ public function testDoesNotRequireQueryForServerVersion() : void
{
self::assertFalse($this->connectionMock->requiresQueryForServerVersion());
}
diff --git a/tests/Doctrine/Tests/DBAL/Driver/OCI8/OCI8StatementTest.php b/tests/Doctrine/Tests/DBAL/Driver/OCI8/OCI8StatementTest.php
index 86d57105cbb..b28b2d83887 100644
--- a/tests/Doctrine/Tests/DBAL/Driver/OCI8/OCI8StatementTest.php
+++ b/tests/Doctrine/Tests/DBAL/Driver/OCI8/OCI8StatementTest.php
@@ -33,7 +33,7 @@ protected function setUp() : void
*
* @dataProvider executeDataProvider
*/
- public function testExecute(array $params)
+ public function testExecute(array $params) : void
{
$statement = $this->getMockBuilder(OCI8Statement::class)
->setMethods(['bindValue', 'errorInfo'])
@@ -76,7 +76,10 @@ public function testExecute(array $params)
$statement->execute($params);
}
- public static function executeDataProvider()
+ /**
+ * @return array>
+ */
+ public static function executeDataProvider() : iterable
{
return [
// $hasZeroIndex = isset($params[0]); == true
@@ -93,14 +96,17 @@ public static function executeDataProvider()
/**
* @dataProvider nonTerminatedLiteralProvider
*/
- public function testConvertNonTerminatedLiteral($sql, $message)
+ public function testConvertNonTerminatedLiteral(string $sql, string $message) : void
{
$this->expectException(OCI8Exception::class);
$this->expectExceptionMessageRegExp($message);
OCI8Statement::convertPositionalToNamedPlaceholders($sql);
}
- public static function nonTerminatedLiteralProvider()
+ /**
+ * @return array>
+ */
+ public static function nonTerminatedLiteralProvider() : iterable
{
return [
'no-matching-quote' => [
diff --git a/tests/Doctrine/Tests/DBAL/Driver/PDOExceptionTest.php b/tests/Doctrine/Tests/DBAL/Driver/PDOExceptionTest.php
index c7564470252..9ed9a06aa5b 100644
--- a/tests/Doctrine/Tests/DBAL/Driver/PDOExceptionTest.php
+++ b/tests/Doctrine/Tests/DBAL/Driver/PDOExceptionTest.php
@@ -44,27 +44,27 @@ protected function setUp() : void
$this->exception = new PDOException($this->wrappedException);
}
- public function testReturnsCode()
+ public function testReturnsCode() : void
{
self::assertSame(self::SQLSTATE, $this->exception->getCode());
}
- public function testReturnsErrorCode()
+ public function testReturnsErrorCode() : void
{
self::assertSame(self::ERROR_CODE, $this->exception->getErrorCode());
}
- public function testReturnsMessage()
+ public function testReturnsMessage() : void
{
self::assertSame(self::MESSAGE, $this->exception->getMessage());
}
- public function testReturnsSQLState()
+ public function testReturnsSQLState() : void
{
self::assertSame(self::SQLSTATE, $this->exception->getSQLState());
}
- public function testOriginalExceptionIsInChain()
+ public function testOriginalExceptionIsInChain() : void
{
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 6361f05575c..9eeeafb78aa 100644
--- a/tests/Doctrine/Tests/DBAL/Driver/PDOIbm/DriverTest.php
+++ b/tests/Doctrine/Tests/DBAL/Driver/PDOIbm/DriverTest.php
@@ -2,17 +2,18 @@
namespace Doctrine\Tests\DBAL\Driver\PDOIbm;
+use Doctrine\DBAL\Driver as DriverInterface;
use Doctrine\DBAL\Driver\PDOIbm\Driver;
use Doctrine\Tests\DBAL\Driver\AbstractDB2DriverTest;
class DriverTest extends AbstractDB2DriverTest
{
- public function testReturnsName()
+ public function testReturnsName() : void
{
self::assertSame('pdo_ibm', $this->driver->getName());
}
- protected function createDriver()
+ protected function createDriver() : DriverInterface
{
return new Driver();
}
diff --git a/tests/Doctrine/Tests/DBAL/Driver/PDOMySql/DriverTest.php b/tests/Doctrine/Tests/DBAL/Driver/PDOMySql/DriverTest.php
index a965765780d..6e3ef7d5a03 100644
--- a/tests/Doctrine/Tests/DBAL/Driver/PDOMySql/DriverTest.php
+++ b/tests/Doctrine/Tests/DBAL/Driver/PDOMySql/DriverTest.php
@@ -2,17 +2,18 @@
namespace Doctrine\Tests\DBAL\Driver\PDOMySql;
+use Doctrine\DBAL\Driver as DriverInterface;
use Doctrine\DBAL\Driver\PDOMySql\Driver;
use Doctrine\Tests\DBAL\Driver\AbstractMySQLDriverTest;
class DriverTest extends AbstractMySQLDriverTest
{
- public function testReturnsName()
+ public function testReturnsName() : void
{
self::assertSame('pdo_mysql', $this->driver->getName());
}
- protected function createDriver()
+ protected function createDriver() : DriverInterface
{
return new Driver();
}
diff --git a/tests/Doctrine/Tests/DBAL/Driver/PDOOracle/DriverTest.php b/tests/Doctrine/Tests/DBAL/Driver/PDOOracle/DriverTest.php
index f9e0da70f1c..42353be376d 100644
--- a/tests/Doctrine/Tests/DBAL/Driver/PDOOracle/DriverTest.php
+++ b/tests/Doctrine/Tests/DBAL/Driver/PDOOracle/DriverTest.php
@@ -2,17 +2,18 @@
namespace Doctrine\Tests\DBAL\Driver\PDOOracle;
+use Doctrine\DBAL\Driver as DriverInterface;
use Doctrine\DBAL\Driver\PDOOracle\Driver;
use Doctrine\Tests\DBAL\Driver\AbstractOracleDriverTest;
class DriverTest extends AbstractOracleDriverTest
{
- public function testReturnsName()
+ public function testReturnsName() : void
{
self::assertSame('pdo_oracle', $this->driver->getName());
}
- protected function createDriver()
+ protected function createDriver() : DriverInterface
{
return new Driver();
}
diff --git a/tests/Doctrine/Tests/DBAL/Driver/PDOPgSql/DriverTest.php b/tests/Doctrine/Tests/DBAL/Driver/PDOPgSql/DriverTest.php
index a6ac2456b64..2b976233c27 100644
--- a/tests/Doctrine/Tests/DBAL/Driver/PDOPgSql/DriverTest.php
+++ b/tests/Doctrine/Tests/DBAL/Driver/PDOPgSql/DriverTest.php
@@ -2,17 +2,17 @@
namespace Doctrine\Tests\DBAL\Driver\PDOPgSql;
+use Doctrine\DBAL\Driver as DriverInterface;
use Doctrine\DBAL\Driver\PDOConnection;
use Doctrine\DBAL\Driver\PDOPgSql\Driver;
use Doctrine\Tests\DBAL\Driver\AbstractPostgreSQLDriverTest;
use PDO;
use PDOException;
-use PHPUnit_Framework_SkippedTestError;
use function defined;
class DriverTest extends AbstractPostgreSQLDriverTest
{
- public function testReturnsName()
+ public function testReturnsName() : void
{
self::assertSame('pdo_pgsql', $this->driver->getName());
}
@@ -20,7 +20,7 @@ public function testReturnsName()
/**
* @group DBAL-920
*/
- public function testConnectionDisablesPreparesOnPhp56()
+ public function testConnectionDisablesPreparesOnPhp56() : void
{
$this->skipWhenNotUsingPhp56AndPdoPgsql();
@@ -46,7 +46,7 @@ public function testConnectionDisablesPreparesOnPhp56()
/**
* @group DBAL-920
*/
- public function testConnectionDoesNotDisablePreparesOnPhp56WhenAttributeDefined()
+ public function testConnectionDoesNotDisablePreparesOnPhp56WhenAttributeDefined() : void
{
$this->skipWhenNotUsingPhp56AndPdoPgsql();
@@ -73,7 +73,7 @@ public function testConnectionDoesNotDisablePreparesOnPhp56WhenAttributeDefined(
/**
* @group DBAL-920
*/
- public function testConnectionDisablePreparesOnPhp56WhenDisablePreparesIsExplicitlyDefined()
+ public function testConnectionDisablePreparesOnPhp56WhenDisablePreparesIsExplicitlyDefined() : void
{
$this->skipWhenNotUsingPhp56AndPdoPgsql();
@@ -100,15 +100,12 @@ public function testConnectionDisablePreparesOnPhp56WhenDisablePreparesIsExplici
/**
* {@inheritDoc}
*/
- protected function createDriver()
+ protected function createDriver() : DriverInterface
{
return new Driver();
}
- /**
- * @throws PHPUnit_Framework_SkippedTestError
- */
- private function skipWhenNotUsingPhp56AndPdoPgsql()
+ private function skipWhenNotUsingPhp56AndPdoPgsql() : void
{
if (! defined('PDO::PGSQL_ATTR_DISABLE_PREPARES')) {
$this->markTestSkipped('Test requires PHP 5.6+');
diff --git a/tests/Doctrine/Tests/DBAL/Driver/PDOSqlite/DriverTest.php b/tests/Doctrine/Tests/DBAL/Driver/PDOSqlite/DriverTest.php
index 49a604ccd07..9092b091e3a 100644
--- a/tests/Doctrine/Tests/DBAL/Driver/PDOSqlite/DriverTest.php
+++ b/tests/Doctrine/Tests/DBAL/Driver/PDOSqlite/DriverTest.php
@@ -2,17 +2,18 @@
namespace Doctrine\Tests\DBAL\Driver\PDOSqlite;
+use Doctrine\DBAL\Driver as DriverInterface;
use Doctrine\DBAL\Driver\PDOSqlite\Driver;
use Doctrine\Tests\DBAL\Driver\AbstractSQLiteDriverTest;
class DriverTest extends AbstractSQLiteDriverTest
{
- public function testReturnsName()
+ public function testReturnsName() : void
{
self::assertSame('pdo_sqlite', $this->driver->getName());
}
- protected function createDriver()
+ protected function createDriver() : DriverInterface
{
return new Driver();
}
diff --git a/tests/Doctrine/Tests/DBAL/Driver/PDOSqlsrv/DriverTest.php b/tests/Doctrine/Tests/DBAL/Driver/PDOSqlsrv/DriverTest.php
index bf060365838..c92dc86d5ba 100644
--- a/tests/Doctrine/Tests/DBAL/Driver/PDOSqlsrv/DriverTest.php
+++ b/tests/Doctrine/Tests/DBAL/Driver/PDOSqlsrv/DriverTest.php
@@ -2,17 +2,18 @@
namespace Doctrine\Tests\DBAL\Driver\PDOSqlsrv;
+use Doctrine\DBAL\Driver as DriverInterface;
use Doctrine\DBAL\Driver\PDOSqlsrv\Driver;
use Doctrine\Tests\DBAL\Driver\AbstractSQLServerDriverTest;
class DriverTest extends AbstractSQLServerDriverTest
{
- public function testReturnsName()
+ public function testReturnsName() : void
{
self::assertSame('pdo_sqlsrv', $this->driver->getName());
}
- protected function createDriver()
+ protected function createDriver() : DriverInterface
{
return new Driver();
}
diff --git a/tests/Doctrine/Tests/DBAL/Driver/SQLAnywhere/DriverTest.php b/tests/Doctrine/Tests/DBAL/Driver/SQLAnywhere/DriverTest.php
index 54b1912a911..d6f1595a45e 100644
--- a/tests/Doctrine/Tests/DBAL/Driver/SQLAnywhere/DriverTest.php
+++ b/tests/Doctrine/Tests/DBAL/Driver/SQLAnywhere/DriverTest.php
@@ -2,17 +2,18 @@
namespace Doctrine\Tests\DBAL\Driver\SQLAnywhere;
+use Doctrine\DBAL\Driver as DriverInterface;
use Doctrine\DBAL\Driver\SQLAnywhere\Driver;
use Doctrine\Tests\DBAL\Driver\AbstractSQLAnywhereDriverTest;
class DriverTest extends AbstractSQLAnywhereDriverTest
{
- public function testReturnsName()
+ public function testReturnsName() : void
{
self::assertSame('sqlanywhere', $this->driver->getName());
}
- protected function createDriver()
+ protected function createDriver() : DriverInterface
{
return new Driver();
}
diff --git a/tests/Doctrine/Tests/DBAL/Driver/SQLAnywhere/SQLAnywhereConnectionTest.php b/tests/Doctrine/Tests/DBAL/Driver/SQLAnywhere/SQLAnywhereConnectionTest.php
index ccf6e3358f2..effeb483362 100644
--- a/tests/Doctrine/Tests/DBAL/Driver/SQLAnywhere/SQLAnywhereConnectionTest.php
+++ b/tests/Doctrine/Tests/DBAL/Driver/SQLAnywhere/SQLAnywhereConnectionTest.php
@@ -29,7 +29,7 @@ protected function setUp() : void
->getMockForAbstractClass();
}
- public function testRequiresQueryForServerVersion()
+ public function testRequiresQueryForServerVersion() : void
{
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 b99516f7048..9ab6635ecf4 100644
--- a/tests/Doctrine/Tests/DBAL/Driver/SQLSrv/DriverTest.php
+++ b/tests/Doctrine/Tests/DBAL/Driver/SQLSrv/DriverTest.php
@@ -2,17 +2,18 @@
namespace Doctrine\Tests\DBAL\Driver\SQLSrv;
+use Doctrine\DBAL\Driver as DriverInterface;
use Doctrine\DBAL\Driver\SQLSrv\Driver;
use Doctrine\Tests\DBAL\Driver\AbstractSQLServerDriverTest;
class DriverTest extends AbstractSQLServerDriverTest
{
- public function testReturnsName()
+ public function testReturnsName() : void
{
self::assertSame('sqlsrv', $this->driver->getName());
}
- protected function createDriver()
+ protected function createDriver() : DriverInterface
{
return new Driver();
}
diff --git a/tests/Doctrine/Tests/DBAL/Driver/SQLSrv/SQLSrvConnectionTest.php b/tests/Doctrine/Tests/DBAL/Driver/SQLSrv/SQLSrvConnectionTest.php
index 13ce72a942f..8d457d8eb23 100644
--- a/tests/Doctrine/Tests/DBAL/Driver/SQLSrv/SQLSrvConnectionTest.php
+++ b/tests/Doctrine/Tests/DBAL/Driver/SQLSrv/SQLSrvConnectionTest.php
@@ -29,7 +29,7 @@ protected function setUp() : void
->getMockForAbstractClass();
}
- public function testDoesNotRequireQueryForServerVersion()
+ public function testDoesNotRequireQueryForServerVersion() : void
{
self::assertFalse($this->connectionMock->requiresQueryForServerVersion());
}
diff --git a/tests/Doctrine/Tests/DBAL/DriverManagerTest.php b/tests/Doctrine/Tests/DBAL/DriverManagerTest.php
index 0346405cb82..ced3e5d993f 100644
--- a/tests/Doctrine/Tests/DBAL/DriverManagerTest.php
+++ b/tests/Doctrine/Tests/DBAL/DriverManagerTest.php
@@ -27,7 +27,7 @@ class DriverManagerTest extends DbalTestCase
/**
* @requires extension pdo_sqlite
*/
- public function testInvalidPdoInstance()
+ public function testInvalidPdoInstance() : void
{
$this->expectException(DBALException::class);
DriverManager::getConnection(['pdo' => 'test']);
@@ -36,7 +36,7 @@ public function testInvalidPdoInstance()
/**
* @requires extension pdo_sqlite
*/
- public function testValidPdoInstance()
+ public function testValidPdoInstance() : void
{
$conn = DriverManager::getConnection([
'pdo' => new PDO('sqlite::memory:'),
@@ -49,7 +49,7 @@ public function testValidPdoInstance()
* @group DBAL-32
* @requires extension pdo_sqlite
*/
- public function testPdoInstanceSetErrorMode()
+ public function testPdoInstanceSetErrorMode() : void
{
$pdo = new PDO('sqlite::memory:');
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_SILENT);
@@ -59,14 +59,14 @@ public function testPdoInstanceSetErrorMode()
self::assertEquals(PDO::ERRMODE_EXCEPTION, $pdo->getAttribute(PDO::ATTR_ERRMODE));
}
- public function testCheckParams()
+ public function testCheckParams() : void
{
$this->expectException(DBALException::class);
DriverManager::getConnection([]);
}
- public function testInvalidDriver()
+ public function testInvalidDriver() : void
{
$this->expectException(DBALException::class);
@@ -76,7 +76,7 @@ public function testInvalidDriver()
/**
* @requires extension pdo_sqlite
*/
- public function testCustomPlatform()
+ public function testCustomPlatform() : void
{
$platform = $this->createMock(AbstractPlatform::class);
$options = [
@@ -91,7 +91,7 @@ public function testCustomPlatform()
/**
* @requires extension pdo_sqlite
*/
- public function testCustomWrapper()
+ public function testCustomWrapper() : void
{
$wrapper = $this->createMock(Connection::class);
$wrapperClass = get_class($wrapper);
@@ -108,7 +108,7 @@ public function testCustomWrapper()
/**
* @requires extension pdo_sqlite
*/
- public function testInvalidWrapperClass()
+ public function testInvalidWrapperClass() : void
{
$this->expectException(DBALException::class);
@@ -120,7 +120,7 @@ public function testInvalidWrapperClass()
DriverManager::getConnection($options);
}
- public function testInvalidDriverClass()
+ public function testInvalidDriverClass() : void
{
$this->expectException(DBALException::class);
@@ -129,7 +129,7 @@ public function testInvalidDriverClass()
DriverManager::getConnection($options);
}
- public function testValidDriverClass()
+ public function testValidDriverClass() : void
{
$options = ['driverClass' => PDOMySQLDriver::class];
@@ -137,7 +137,7 @@ public function testValidDriverClass()
self::assertInstanceOf(PDOMySQLDriver::class, $conn->getDriver());
}
- public function testDatabaseUrlMasterSlave()
+ public function testDatabaseUrlMasterSlave() : void
{
$options = [
'driver' => 'pdo_mysql',
@@ -169,7 +169,7 @@ public function testDatabaseUrlMasterSlave()
self::assertEquals('baz_slave', $params['slaves']['slave1']['dbname']);
}
- public function testDatabaseUrlShard()
+ public function testDatabaseUrlShard() : void
{
$options = [
'driver' => 'pdo_mysql',
@@ -206,9 +206,12 @@ public function testDatabaseUrlShard()
}
/**
+ * @param mixed $url
+ * @param mixed $expected
+ *
* @dataProvider databaseUrls
*/
- public function testDatabaseUrl($url, $expected)
+ public function testDatabaseUrl($url, $expected) : void
{
$options = is_array($url) ? $url : ['url' => $url];
@@ -238,7 +241,10 @@ public function testDatabaseUrl($url, $expected)
}
}
- public function databaseUrls()
+ /**
+ * @return array>
+ */
+ public function databaseUrls() : iterable
{
$driver = $this->createMock(Driver::class);
$driverClass = get_class($driver);
diff --git a/tests/Doctrine/Tests/DBAL/Events/MysqlSessionInitTest.php b/tests/Doctrine/Tests/DBAL/Events/MysqlSessionInitTest.php
index 0f9be11edda..daea3a754c6 100644
--- a/tests/Doctrine/Tests/DBAL/Events/MysqlSessionInitTest.php
+++ b/tests/Doctrine/Tests/DBAL/Events/MysqlSessionInitTest.php
@@ -10,7 +10,7 @@
class MysqlSessionInitTest extends DbalTestCase
{
- public function testPostConnect()
+ public function testPostConnect() : void
{
$connectionMock = $this->createMock(Connection::class);
$connectionMock->expects($this->once())
@@ -23,7 +23,7 @@ public function testPostConnect()
$listener->postConnect($eventArgs);
}
- public function testGetSubscribedEvents()
+ public function testGetSubscribedEvents() : void
{
$listener = new MysqlSessionInit();
self::assertEquals([Events::postConnect], $listener->getSubscribedEvents());
diff --git a/tests/Doctrine/Tests/DBAL/Events/OracleSessionInitTest.php b/tests/Doctrine/Tests/DBAL/Events/OracleSessionInitTest.php
index 2ea510a0543..998b1dc916e 100644
--- a/tests/Doctrine/Tests/DBAL/Events/OracleSessionInitTest.php
+++ b/tests/Doctrine/Tests/DBAL/Events/OracleSessionInitTest.php
@@ -11,7 +11,7 @@
class OracleSessionInitTest extends DbalTestCase
{
- public function testPostConnect()
+ public function testPostConnect() : void
{
$connectionMock = $this->createMock(Connection::class);
$connectionMock->expects($this->once())
@@ -28,7 +28,7 @@ public function testPostConnect()
* @group DBAL-1824
* @dataProvider getPostConnectWithSessionParameterValuesData
*/
- public function testPostConnectQuotesSessionParameterValues($name, $value)
+ public function testPostConnectQuotesSessionParameterValues(string $name, string $value) : void
{
$connectionMock = $this->getMockBuilder(Connection::class)
->disableOriginalConstructor()
@@ -43,14 +43,17 @@ public function testPostConnectQuotesSessionParameterValues($name, $value)
$listener->postConnect($eventArgs);
}
- public function getPostConnectWithSessionParameterValuesData()
+ /**
+ * @return array>
+ */
+ public static function getPostConnectWithSessionParameterValuesData() : iterable
{
return [
['CURRENT_SCHEMA', 'foo'],
];
}
- public function testGetSubscribedEvents()
+ public function testGetSubscribedEvents() : void
{
$listener = new OracleSessionInit();
self::assertEquals([Events::postConnect], $listener->getSubscribedEvents());
diff --git a/tests/Doctrine/Tests/DBAL/Events/SQLSessionInitTest.php b/tests/Doctrine/Tests/DBAL/Events/SQLSessionInitTest.php
index f42458de74d..c69b2996827 100644
--- a/tests/Doctrine/Tests/DBAL/Events/SQLSessionInitTest.php
+++ b/tests/Doctrine/Tests/DBAL/Events/SQLSessionInitTest.php
@@ -13,7 +13,7 @@
*/
class SQLSessionInitTest extends DbalTestCase
{
- public function testPostConnect()
+ public function testPostConnect() : void
{
$connectionMock = $this->createMock(Connection::class);
$connectionMock->expects($this->once())
@@ -26,7 +26,7 @@ public function testPostConnect()
$listener->postConnect($eventArgs);
}
- public function testGetSubscribedEvents()
+ public function testGetSubscribedEvents() : void
{
$listener = new SQLSessionInit("SET SEARCH_PATH TO foo, public, TIMEZONE TO 'Europe/Berlin'");
self::assertEquals([Events::postConnect], $listener->getSubscribedEvents());
diff --git a/tests/Doctrine/Tests/DBAL/Exception/InvalidArgumentExceptionTest.php b/tests/Doctrine/Tests/DBAL/Exception/InvalidArgumentExceptionTest.php
index 54cfea89596..7718a6bc9d8 100644
--- a/tests/Doctrine/Tests/DBAL/Exception/InvalidArgumentExceptionTest.php
+++ b/tests/Doctrine/Tests/DBAL/Exception/InvalidArgumentExceptionTest.php
@@ -12,7 +12,7 @@
*/
class InvalidArgumentExceptionTest extends TestCase
{
- public function testFromEmptyCriteria()
+ public function testFromEmptyCriteria() : void
{
$exception = InvalidArgumentException::fromEmptyCriteria();
diff --git a/tests/Doctrine/Tests/DBAL/Functional/BlobTest.php b/tests/Doctrine/Tests/DBAL/Functional/BlobTest.php
index 69094c97838..a12d0600201 100644
--- a/tests/Doctrine/Tests/DBAL/Functional/BlobTest.php
+++ b/tests/Doctrine/Tests/DBAL/Functional/BlobTest.php
@@ -38,7 +38,7 @@ protected function setUp() : void
$sm->dropAndCreateTable($table);
}
- public function testInsert()
+ public function testInsert() : void
{
$ret = $this->connection->insert('blob_table', [
'id' => 1,
@@ -53,7 +53,7 @@ public function testInsert()
self::assertEquals(1, $ret);
}
- public function testInsertProcessesStream()
+ public function testInsertProcessesStream() : void
{
// https://github.com/doctrine/dbal/issues/3290
if ($this->connection->getDriver() instanceof OCI8Driver) {
@@ -74,7 +74,7 @@ public function testInsertProcessesStream()
$this->assertBlobContains($longBlob);
}
- public function testSelect()
+ public function testSelect() : void
{
$this->connection->insert('blob_table', [
'id' => 1,
@@ -89,7 +89,7 @@ public function testSelect()
$this->assertBlobContains('test');
}
- public function testUpdate()
+ public function testUpdate() : void
{
$this->connection->insert('blob_table', [
'id' => 1,
@@ -109,7 +109,7 @@ public function testUpdate()
$this->assertBlobContains('test2');
}
- public function testUpdateProcessesStream()
+ public function testUpdateProcessesStream() : void
{
// https://github.com/doctrine/dbal/issues/3290
if ($this->connection->getDriver() instanceof OCI8Driver) {
@@ -137,7 +137,7 @@ public function testUpdateProcessesStream()
$this->assertBlobContains('test2');
}
- public function testBindParamProcessesStream()
+ public function testBindParamProcessesStream() : void
{
if ($this->connection->getDriver() instanceof OCI8Driver) {
$this->markTestIncomplete('The oci8 driver does not support stream resources as parameters');
@@ -156,7 +156,7 @@ public function testBindParamProcessesStream()
$this->assertBlobContains('test');
}
- private function assertBlobContains($text)
+ private function assertBlobContains(string $text) : void
{
$rows = $this->connection->query('SELECT blobfield FROM blob_table')->fetchAll(FetchMode::COLUMN);
diff --git a/tests/Doctrine/Tests/DBAL/Functional/ConnectionTest.php b/tests/Doctrine/Tests/DBAL/Functional/ConnectionTest.php
index 8e6dc21222b..2c88a127e33 100644
--- a/tests/Doctrine/Tests/DBAL/Functional/ConnectionTest.php
+++ b/tests/Doctrine/Tests/DBAL/Functional/ConnectionTest.php
@@ -31,12 +31,12 @@ protected function tearDown() : void
$this->resetSharedConn();
}
- public function testGetWrappedConnection()
+ public function testGetWrappedConnection() : void
{
self::assertInstanceOf(DriverConnection::class, $this->connection->getWrappedConnection());
}
- public function testCommitWithRollbackOnlyThrowsException()
+ public function testCommitWithRollbackOnlyThrowsException() : void
{
$this->connection->beginTransaction();
$this->connection->setRollbackOnly();
@@ -45,7 +45,7 @@ public function testCommitWithRollbackOnlyThrowsException()
$this->connection->commit();
}
- public function testTransactionNestingBehavior()
+ public function testTransactionNestingBehavior() : void
{
try {
$this->connection->beginTransaction();
@@ -72,7 +72,7 @@ public function testTransactionNestingBehavior()
}
}
- public function testTransactionNestingBehaviorWithSavepoints()
+ public function testTransactionNestingBehaviorWithSavepoints() : void
{
if (! $this->connection->getDatabasePlatform()->supportsSavepoints()) {
$this->markTestSkipped('This test requires the platform to support savepoints.');
@@ -111,7 +111,7 @@ public function testTransactionNestingBehaviorWithSavepoints()
}
}
- public function testTransactionNestingBehaviorCantBeChangedInActiveTransaction()
+ public function testTransactionNestingBehaviorCantBeChangedInActiveTransaction() : void
{
if (! $this->connection->getDatabasePlatform()->supportsSavepoints()) {
$this->markTestSkipped('This test requires the platform to support savepoints.');
@@ -122,7 +122,7 @@ public function testTransactionNestingBehaviorCantBeChangedInActiveTransaction()
$this->connection->setNestTransactionsWithSavepoints(true);
}
- public function testSetNestedTransactionsThroughSavepointsNotSupportedThrowsException()
+ public function testSetNestedTransactionsThroughSavepointsNotSupportedThrowsException() : void
{
if ($this->connection->getDatabasePlatform()->supportsSavepoints()) {
$this->markTestSkipped('This test requires the platform not to support savepoints.');
@@ -134,7 +134,7 @@ public function testSetNestedTransactionsThroughSavepointsNotSupportedThrowsExce
$this->connection->setNestTransactionsWithSavepoints(true);
}
- public function testCreateSavepointsNotSupportedThrowsException()
+ public function testCreateSavepointsNotSupportedThrowsException() : void
{
if ($this->connection->getDatabasePlatform()->supportsSavepoints()) {
$this->markTestSkipped('This test requires the platform not to support savepoints.');
@@ -146,7 +146,7 @@ public function testCreateSavepointsNotSupportedThrowsException()
$this->connection->createSavepoint('foo');
}
- public function testReleaseSavepointsNotSupportedThrowsException()
+ public function testReleaseSavepointsNotSupportedThrowsException() : void
{
if ($this->connection->getDatabasePlatform()->supportsSavepoints()) {
$this->markTestSkipped('This test requires the platform not to support savepoints.');
@@ -158,7 +158,7 @@ public function testReleaseSavepointsNotSupportedThrowsException()
$this->connection->releaseSavepoint('foo');
}
- public function testRollbackSavepointsNotSupportedThrowsException()
+ public function testRollbackSavepointsNotSupportedThrowsException() : void
{
if ($this->connection->getDatabasePlatform()->supportsSavepoints()) {
$this->markTestSkipped('This test requires the platform not to support savepoints.');
@@ -170,7 +170,7 @@ public function testRollbackSavepointsNotSupportedThrowsException()
$this->connection->rollbackSavepoint('foo');
}
- public function testTransactionBehaviorWithRollback()
+ public function testTransactionBehaviorWithRollback() : void
{
try {
$this->connection->beginTransaction();
@@ -186,7 +186,7 @@ public function testTransactionBehaviorWithRollback()
}
}
- public function testTransactionBehaviour()
+ public function testTransactionBehaviour() : void
{
try {
$this->connection->beginTransaction();
@@ -200,10 +200,10 @@ public function testTransactionBehaviour()
self::assertEquals(0, $this->connection->getTransactionNestingLevel());
}
- public function testTransactionalWithException()
+ public function testTransactionalWithException() : void
{
try {
- $this->connection->transactional(static function ($conn) {
+ $this->connection->transactional(static function ($conn) : void {
/** @var Connection $conn */
$conn->executeQuery($conn->getDatabasePlatform()->getDummySelectSQL());
throw new RuntimeException('Ooops!');
@@ -214,10 +214,10 @@ public function testTransactionalWithException()
}
}
- public function testTransactionalWithThrowable()
+ public function testTransactionalWithThrowable() : void
{
try {
- $this->connection->transactional(static function ($conn) {
+ $this->connection->transactional(static function ($conn) : void {
/** @var Connection $conn */
$conn->executeQuery($conn->getDatabasePlatform()->getDummySelectSQL());
throw new Error('Ooops!');
@@ -228,9 +228,9 @@ public function testTransactionalWithThrowable()
}
}
- public function testTransactional()
+ public function testTransactional() : void
{
- $res = $this->connection->transactional(static function ($conn) {
+ $res = $this->connection->transactional(static function ($conn) : void {
/** @var Connection $conn */
$conn->executeQuery($conn->getDatabasePlatform()->getDummySelectSQL());
});
@@ -238,7 +238,7 @@ public function testTransactional()
self::assertNull($res);
}
- public function testTransactionalReturnValue()
+ public function testTransactionalReturnValue() : void
{
$res = $this->connection->transactional(static function () {
return 42;
@@ -250,7 +250,7 @@ public function testTransactionalReturnValue()
/**
* Tests that the quote function accepts DBAL and PDO types.
*/
- public function testQuote()
+ public function testQuote() : void
{
self::assertEquals(
$this->connection->quote('foo', Types::STRING),
@@ -258,7 +258,7 @@ public function testQuote()
);
}
- public function testPingDoesTriggersConnect()
+ public function testPingDoesTriggersConnect() : void
{
self::assertTrue($this->connection->ping());
self::assertTrue($this->connection->isConnected());
@@ -267,7 +267,7 @@ public function testPingDoesTriggersConnect()
/**
* @group DBAL-1025
*/
- public function testConnectWithoutExplicitDatabaseName()
+ public function testConnectWithoutExplicitDatabaseName() : void
{
if (in_array($this->connection->getDatabasePlatform()->getName(), ['oracle', 'db2'], true)) {
$this->markTestSkipped('Platform does not support connecting without database name.');
@@ -290,7 +290,7 @@ public function testConnectWithoutExplicitDatabaseName()
/**
* @group DBAL-990
*/
- public function testDeterminesDatabasePlatformWhenConnectingToNonExistentDatabase()
+ public function testDeterminesDatabasePlatformWhenConnectingToNonExistentDatabase() : void
{
if (in_array($this->connection->getDatabasePlatform()->getName(), ['oracle', 'db2'], true)) {
$this->markTestSkipped('Platform does not support connecting without database name.');
diff --git a/tests/Doctrine/Tests/DBAL/Functional/DataAccessTest.php b/tests/Doctrine/Tests/DBAL/Functional/DataAccessTest.php
index a0b8db003da..b7d625c8600 100644
--- a/tests/Doctrine/Tests/DBAL/Functional/DataAccessTest.php
+++ b/tests/Doctrine/Tests/DBAL/Functional/DataAccessTest.php
@@ -59,7 +59,7 @@ protected function setUp() : void
self::$generated = true;
}
- public function testPrepareWithBindValue()
+ public function testPrepareWithBindValue() : void
{
$sql = 'SELECT test_int, test_string FROM fetch_table WHERE test_int = ? AND test_string = ?';
$stmt = $this->connection->prepare($sql);
@@ -74,7 +74,7 @@ public function testPrepareWithBindValue()
self::assertEquals(['test_int' => 1, 'test_string' => 'foo'], $row);
}
- public function testPrepareWithBindParam()
+ public function testPrepareWithBindParam() : void
{
$paramInt = 1;
$paramStr = 'foo';
@@ -92,7 +92,7 @@ public function testPrepareWithBindParam()
self::assertEquals(['test_int' => 1, 'test_string' => 'foo'], $row);
}
- public function testPrepareWithFetchAll()
+ public function testPrepareWithFetchAll() : void
{
$paramInt = 1;
$paramStr = 'foo';
@@ -113,7 +113,7 @@ public function testPrepareWithFetchAll()
/**
* @group DBAL-228
*/
- public function testPrepareWithFetchAllBoth()
+ public function testPrepareWithFetchAllBoth() : void
{
$paramInt = 1;
$paramStr = 'foo';
@@ -131,7 +131,7 @@ public function testPrepareWithFetchAllBoth()
self::assertEquals(['test_int' => 1, 'test_string' => 'foo', 0 => 1, 1 => 'foo'], $rows[0]);
}
- public function testPrepareWithFetchColumn()
+ public function testPrepareWithFetchColumn() : void
{
$paramInt = 1;
$paramStr = 'foo';
@@ -148,7 +148,7 @@ public function testPrepareWithFetchColumn()
self::assertEquals(1, $column);
}
- public function testPrepareWithIterator()
+ public function testPrepareWithIterator() : void
{
$paramInt = 1;
$paramStr = 'foo';
@@ -170,7 +170,7 @@ public function testPrepareWithIterator()
self::assertEquals(['test_int' => 1, 'test_string' => 'foo'], $rows[0]);
}
- public function testPrepareWithQuoted()
+ public function testPrepareWithQuoted() : void
{
$table = 'fetch_table';
$paramInt = 1;
@@ -185,7 +185,7 @@ public function testPrepareWithQuoted()
self::assertInstanceOf(Statement::class, $stmt);
}
- public function testPrepareWithExecuteParams()
+ public function testPrepareWithExecuteParams() : void
{
$paramInt = 1;
$paramStr = 'foo';
@@ -201,7 +201,7 @@ public function testPrepareWithExecuteParams()
self::assertEquals(['test_int' => 1, 'test_string' => 'foo'], $row);
}
- public function testFetchAll()
+ public function testFetchAll() : void
{
$sql = 'SELECT test_int, test_string FROM fetch_table WHERE test_int = ? AND test_string = ?';
$data = $this->connection->fetchAll($sql, [1, 'foo']);
@@ -219,7 +219,7 @@ public function testFetchAll()
/**
* @group DBAL-209
*/
- public function testFetchAllWithTypes()
+ public function testFetchAllWithTypes() : void
{
$datetimeString = '2010-01-01 10:10:10';
$datetime = new DateTime($datetimeString);
@@ -244,7 +244,7 @@ public function testFetchAllWithTypes()
/**
* @group DBAL-209
*/
- public function testFetchAllWithMissingTypes()
+ public function testFetchAllWithMissingTypes() : void
{
if ($this->connection->getDriver() instanceof MySQLiDriver ||
$this->connection->getDriver() instanceof SQLSrvDriver) {
@@ -260,7 +260,7 @@ public function testFetchAllWithMissingTypes()
$this->connection->fetchAll($sql, [1, $datetime]);
}
- public function testFetchBoth()
+ public function testFetchBoth() : void
{
$sql = 'SELECT test_int, test_string FROM fetch_table WHERE test_int = ? AND test_string = ?';
$row = $this->connection->executeQuery($sql, [1, 'foo'])->fetch(FetchMode::MIXED);
@@ -275,14 +275,14 @@ public function testFetchBoth()
self::assertEquals('foo', $row[1]);
}
- public function testFetchNoResult()
+ public function testFetchNoResult() : void
{
self::assertFalse(
$this->connection->executeQuery('SELECT test_int FROM fetch_table WHERE test_int = ?', [-1])->fetch()
);
}
- public function testFetchAssoc()
+ public function testFetchAssoc() : void
{
$sql = 'SELECT test_int, test_string FROM fetch_table WHERE test_int = ? AND test_string = ?';
$row = $this->connection->fetchAssoc($sql, [1, 'foo']);
@@ -295,7 +295,7 @@ public function testFetchAssoc()
self::assertEquals('foo', $row['test_string']);
}
- public function testFetchAssocWithTypes()
+ public function testFetchAssocWithTypes() : void
{
$datetimeString = '2010-01-01 10:10:10';
$datetime = new DateTime($datetimeString);
@@ -315,7 +315,7 @@ public function testFetchAssocWithTypes()
self::assertStringStartsWith($datetimeString, $row['test_datetime']);
}
- public function testFetchAssocWithMissingTypes()
+ public function testFetchAssocWithMissingTypes() : void
{
if ($this->connection->getDriver() instanceof MySQLiDriver ||
$this->connection->getDriver() instanceof SQLSrvDriver) {
@@ -331,7 +331,7 @@ public function testFetchAssocWithMissingTypes()
$this->connection->fetchAssoc($sql, [1, $datetime]);
}
- public function testFetchArray()
+ public function testFetchArray() : void
{
$sql = 'SELECT test_int, test_string FROM fetch_table WHERE test_int = ? AND test_string = ?';
$row = $this->connection->fetchArray($sql, [1, 'foo']);
@@ -340,7 +340,7 @@ public function testFetchArray()
self::assertEquals('foo', $row[1]);
}
- public function testFetchArrayWithTypes()
+ public function testFetchArrayWithTypes() : void
{
$datetimeString = '2010-01-01 10:10:10';
$datetime = new DateTime($datetimeString);
@@ -360,7 +360,7 @@ public function testFetchArrayWithTypes()
self::assertStringStartsWith($datetimeString, $row[1]);
}
- public function testFetchArrayWithMissingTypes()
+ public function testFetchArrayWithMissingTypes() : void
{
if ($this->connection->getDriver() instanceof MySQLiDriver ||
$this->connection->getDriver() instanceof SQLSrvDriver) {
@@ -376,7 +376,7 @@ public function testFetchArrayWithMissingTypes()
$this->connection->fetchArray($sql, [1, $datetime]);
}
- public function testFetchColumn()
+ public function testFetchColumn() : void
{
$sql = 'SELECT test_int, test_string FROM fetch_table WHERE test_int = ? AND test_string = ?';
$testInt = $this->connection->fetchColumn($sql, [1, 'foo'], 0);
@@ -389,7 +389,7 @@ public function testFetchColumn()
self::assertEquals('foo', $testString);
}
- public function testFetchColumnWithTypes()
+ public function testFetchColumnWithTypes() : void
{
$datetimeString = '2010-01-01 10:10:10';
$datetime = new DateTime($datetimeString);
@@ -407,7 +407,7 @@ public function testFetchColumnWithTypes()
self::assertStringStartsWith($datetimeString, $column);
}
- public function testFetchColumnWithMissingTypes()
+ public function testFetchColumnWithMissingTypes() : void
{
if ($this->connection->getDriver() instanceof MySQLiDriver ||
$this->connection->getDriver() instanceof SQLSrvDriver) {
@@ -426,7 +426,7 @@ public function testFetchColumnWithMissingTypes()
/**
* @group DDC-697
*/
- public function testExecuteQueryBindDateTimeType()
+ public function testExecuteQueryBindDateTimeType() : void
{
$sql = 'SELECT count(*) AS c FROM fetch_table WHERE test_datetime = ?';
$stmt = $this->connection->executeQuery(
@@ -441,7 +441,7 @@ public function testExecuteQueryBindDateTimeType()
/**
* @group DDC-697
*/
- public function testExecuteUpdateBindDateTimeType()
+ public function testExecuteUpdateBindDateTimeType() : void
{
$datetime = new DateTime('2010-02-02 20:20:20');
@@ -467,7 +467,7 @@ public function testExecuteUpdateBindDateTimeType()
/**
* @group DDC-697
*/
- public function testPrepareQueryBindValueDateTimeType()
+ public function testPrepareQueryBindValueDateTimeType() : void
{
$sql = 'SELECT count(*) AS c FROM fetch_table WHERE test_datetime = ?';
$stmt = $this->connection->prepare($sql);
@@ -480,7 +480,7 @@ public function testPrepareQueryBindValueDateTimeType()
/**
* @group DBAL-78
*/
- public function testNativeArrayListSupport()
+ public function testNativeArrayListSupport() : void
{
for ($i = 100; $i < 110; $i++) {
$this->connection->insert('fetch_table', ['test_int' => $i, 'test_string' => 'foo' . $i, 'test_datetime' => '2010-01-01 10:10:10']);
@@ -508,9 +508,11 @@ public function testNativeArrayListSupport()
}
/**
+ * @param string|false $char
+ *
* @dataProvider getTrimExpressionData
*/
- public function testTrimExpression($value, $position, $char, $expectedResult)
+ public function testTrimExpression(string $value, int $position, $char, string $expectedResult) : void
{
$sql = 'SELECT ' .
$this->connection->getDatabasePlatform()->getTrimExpression($value, $position, $char) . ' AS trimmed ' .
@@ -522,7 +524,10 @@ public function testTrimExpression($value, $position, $char, $expectedResult)
self::assertEquals($expectedResult, $row['trimmed']);
}
- public function getTrimExpressionData()
+ /**
+ * @return array>
+ */
+ public static function getTrimExpressionData() : iterable
{
return [
['test_string', TrimMode::UNSPECIFIED, false, 'foo'],
@@ -567,7 +572,7 @@ public function getTrimExpressionData()
/**
* @group DDC-1014
*/
- public function testDateArithmetics()
+ public function testDateArithmetics() : void
{
$p = $this->connection->getDatabasePlatform();
$sql = 'SELECT ';
@@ -610,7 +615,7 @@ public function testDateArithmetics()
self::assertEquals('2004-01-01', date('Y-m-d', strtotime($row['sub_years'])), 'Subtracting years should end up on 2004-01-01');
}
- public function testSqliteDateArithmeticWithDynamicInterval()
+ public function testSqliteDateArithmeticWithDynamicInterval() : void
{
$platform = $this->connection->getDatabasePlatform();
@@ -637,7 +642,7 @@ public function testSqliteDateArithmeticWithDynamicInterval()
$this->assertEquals(1, $rowCount);
}
- public function testLocateExpression()
+ public function testLocateExpression() : void
{
$platform = $this->connection->getDatabasePlatform();
@@ -667,7 +672,7 @@ public function testLocateExpression()
self::assertEquals(0, $row['locate9']);
}
- public function testQuoteSQLInjection()
+ public function testQuoteSQLInjection() : void
{
$sql = 'SELECT * FROM fetch_table WHERE test_string = ' . $this->connection->quote("bar' OR '1'='1");
$rows = $this->connection->fetchAll($sql);
@@ -678,7 +683,7 @@ public function testQuoteSQLInjection()
/**
* @group DDC-1213
*/
- public function testBitComparisonExpressionSupport()
+ public function testBitComparisonExpressionSupport() : void
{
$this->connection->exec('DELETE FROM fetch_table');
$platform = $this->connection->getDatabasePlatform();
@@ -726,7 +731,7 @@ public function testBitComparisonExpressionSupport()
}
}
- public function testSetDefaultFetchMode()
+ public function testSetDefaultFetchMode() : void
{
$stmt = $this->connection->query('SELECT * FROM fetch_table');
$stmt->setFetchMode(FetchMode::NUMERIC);
@@ -740,7 +745,7 @@ public function testSetDefaultFetchMode()
/**
* @group DBAL-1091
*/
- public function testFetchAllStyleObject()
+ public function testFetchAllStyleObject() : void
{
$this->setupFixture();
@@ -771,7 +776,7 @@ public function testFetchAllStyleObject()
/**
* @group DBAL-196
*/
- public function testFetchAllSupportFetchClass()
+ public function testFetchAllSupportFetchClass() : void
{
$this->beforeFetchClassTest();
$this->setupFixture();
@@ -796,7 +801,7 @@ public function testFetchAllSupportFetchClass()
/**
* @group DBAL-241
*/
- public function testFetchAllStyleColumn()
+ public function testFetchAllStyleColumn() : void
{
$sql = 'DELETE FROM fetch_table';
$this->connection->executeUpdate($sql);
@@ -813,7 +818,7 @@ public function testFetchAllStyleColumn()
/**
* @group DBAL-214
*/
- public function testSetFetchModeClassFetchAll()
+ public function testSetFetchModeClassFetchAll() : void
{
$this->beforeFetchClassTest();
$this->setupFixture();
@@ -835,7 +840,7 @@ public function testSetFetchModeClassFetchAll()
/**
* @group DBAL-214
*/
- public function testSetFetchModeClassFetch()
+ public function testSetFetchModeClassFetch() : void
{
$this->beforeFetchClassTest();
$this->setupFixture();
@@ -860,7 +865,7 @@ public function testSetFetchModeClassFetch()
/**
* @group DBAL-257
*/
- public function testEmptyFetchColumnReturnsFalse()
+ public function testEmptyFetchColumnReturnsFalse() : void
{
$this->connection->beginTransaction();
$this->connection->exec('DELETE FROM fetch_table');
@@ -872,7 +877,7 @@ public function testEmptyFetchColumnReturnsFalse()
/**
* @group DBAL-339
*/
- public function testSetFetchModeOnDbalStatement()
+ public function testSetFetchModeOnDbalStatement() : void
{
$sql = 'SELECT test_int, test_string FROM fetch_table WHERE test_int = ? AND test_string = ?';
$stmt = $this->connection->executeQuery($sql, [1, 'foo']);
@@ -888,7 +893,7 @@ public function testSetFetchModeOnDbalStatement()
/**
* @group DBAL-435
*/
- public function testEmptyParameters()
+ public function testEmptyParameters() : void
{
$sql = 'SELECT * FROM fetch_table WHERE test_int IN (?)';
$stmt = $this->connection->executeQuery($sql, [[]], [Connection::PARAM_INT_ARRAY]);
@@ -900,7 +905,7 @@ public function testEmptyParameters()
/**
* @group DBAL-1028
*/
- public function testFetchColumnNullValue()
+ public function testFetchColumnNullValue() : void
{
$this->connection->executeUpdate(
'INSERT INTO fetch_table (test_int, test_string) VALUES (?, ?)',
@@ -915,14 +920,14 @@ public function testFetchColumnNullValue()
/**
* @group DBAL-1028
*/
- public function testFetchColumnNoResult()
+ public function testFetchColumnNoResult() : void
{
self::assertFalse(
$this->connection->fetchColumn('SELECT test_int FROM fetch_table WHERE test_int = ?', [-1])
);
}
- private function setupFixture()
+ private function setupFixture() : void
{
$this->connection->exec('DELETE FROM fetch_table');
$this->connection->insert('fetch_table', [
@@ -932,7 +937,7 @@ private function setupFixture()
]);
}
- private function beforeFetchClassTest()
+ private function beforeFetchClassTest() : void
{
$driver = $this->connection->getDriver();
diff --git a/tests/Doctrine/Tests/DBAL/Functional/Driver/AbstractDriverTest.php b/tests/Doctrine/Tests/DBAL/Functional/Driver/AbstractDriverTest.php
index 2e145ca6c04..3adf3c2bb89 100644
--- a/tests/Doctrine/Tests/DBAL/Functional/Driver/AbstractDriverTest.php
+++ b/tests/Doctrine/Tests/DBAL/Functional/Driver/AbstractDriverTest.php
@@ -26,7 +26,7 @@ protected function setUp() : void
/**
* @group DBAL-1215
*/
- public function testConnectsWithoutDatabaseNameParameter()
+ public function testConnectsWithoutDatabaseNameParameter() : void
{
$params = $this->connection->getParams();
unset($params['dbname']);
@@ -42,7 +42,7 @@ public function testConnectsWithoutDatabaseNameParameter()
/**
* @group DBAL-1215
*/
- public function testReturnsDatabaseNameWithoutDatabaseNameParameter()
+ public function testReturnsDatabaseNameWithoutDatabaseNameParameter() : void
{
$params = $this->connection->getParams();
unset($params['dbname']);
@@ -60,10 +60,7 @@ public function testReturnsDatabaseNameWithoutDatabaseNameParameter()
);
}
- /**
- * @return Driver
- */
- abstract protected function createDriver();
+ abstract protected function createDriver() : Driver;
protected static function getDatabaseNameForConnectionWithoutDatabaseNameParameter() : ?string
{
diff --git a/tests/Doctrine/Tests/DBAL/Functional/Driver/IBMDB2/DB2DriverTest.php b/tests/Doctrine/Tests/DBAL/Functional/Driver/IBMDB2/DB2DriverTest.php
index 144365e0d4d..4021bb2fff7 100644
--- a/tests/Doctrine/Tests/DBAL/Functional/Driver/IBMDB2/DB2DriverTest.php
+++ b/tests/Doctrine/Tests/DBAL/Functional/Driver/IBMDB2/DB2DriverTest.php
@@ -2,6 +2,7 @@
namespace Doctrine\Tests\DBAL\Functional\Driver\IBMDB2;
+use Doctrine\DBAL\Driver;
use Doctrine\DBAL\Driver\IBMDB2\DB2Driver;
use Doctrine\Tests\DBAL\Functional\Driver\AbstractDriverTest;
use function extension_loaded;
@@ -26,7 +27,7 @@ protected function setUp() : void
/**
* {@inheritdoc}
*/
- public function testConnectsWithoutDatabaseNameParameter()
+ public function testConnectsWithoutDatabaseNameParameter() : void
{
$this->markTestSkipped('IBM DB2 does not support connecting without database name.');
}
@@ -34,7 +35,7 @@ public function testConnectsWithoutDatabaseNameParameter()
/**
* {@inheritdoc}
*/
- public function testReturnsDatabaseNameWithoutDatabaseNameParameter()
+ public function testReturnsDatabaseNameWithoutDatabaseNameParameter() : void
{
$this->markTestSkipped('IBM DB2 does not support connecting without database name.');
}
@@ -42,7 +43,7 @@ public function testReturnsDatabaseNameWithoutDatabaseNameParameter()
/**
* {@inheritdoc}
*/
- protected function createDriver()
+ protected function createDriver() : Driver
{
return new DB2Driver();
}
diff --git a/tests/Doctrine/Tests/DBAL/Functional/Driver/IBMDB2/DB2StatementTest.php b/tests/Doctrine/Tests/DBAL/Functional/Driver/IBMDB2/DB2StatementTest.php
index 536c1093073..c839d20d916 100644
--- a/tests/Doctrine/Tests/DBAL/Functional/Driver/IBMDB2/DB2StatementTest.php
+++ b/tests/Doctrine/Tests/DBAL/Functional/Driver/IBMDB2/DB2StatementTest.php
@@ -26,7 +26,7 @@ protected function setUp() : void
$this->markTestSkipped('ibm_db2 only test.');
}
- public function testExecutionErrorsAreNotSuppressed()
+ public function testExecutionErrorsAreNotSuppressed() : void
{
$stmt = $this->connection->prepare('SELECT * FROM SYSIBM.SYSDUMMY1 WHERE \'foo\' = ?');
diff --git a/tests/Doctrine/Tests/DBAL/Functional/Driver/Mysqli/ConnectionTest.php b/tests/Doctrine/Tests/DBAL/Functional/Driver/Mysqli/ConnectionTest.php
index d2ced1912c4..4a3a315f296 100644
--- a/tests/Doctrine/Tests/DBAL/Functional/Driver/Mysqli/ConnectionTest.php
+++ b/tests/Doctrine/Tests/DBAL/Functional/Driver/Mysqli/ConnectionTest.php
@@ -31,7 +31,7 @@ protected function tearDown() : void
parent::tearDown();
}
- public function testDriverOptions()
+ public function testDriverOptions() : void
{
$driverOptions = [MYSQLI_OPT_CONNECT_TIMEOUT => 1];
@@ -39,14 +39,14 @@ public function testDriverOptions()
self::assertInstanceOf(MysqliConnection::class, $connection);
}
- public function testUnsupportedDriverOption()
+ public function testUnsupportedDriverOption() : void
{
$this->expectException(MysqliException::class);
$this->getConnection(['hello' => 'world']); // use local infile
}
- public function testPing()
+ public function testPing() : void
{
$conn = $this->getConnection([]);
self::assertTrue($conn->ping());
@@ -55,7 +55,7 @@ public function testPing()
/**
* @param mixed[] $driverOptions
*/
- private function getConnection(array $driverOptions)
+ private function getConnection(array $driverOptions) : MysqliConnection
{
return new MysqliConnection(
[
diff --git a/tests/Doctrine/Tests/DBAL/Functional/Driver/Mysqli/DriverTest.php b/tests/Doctrine/Tests/DBAL/Functional/Driver/Mysqli/DriverTest.php
index a7b7338beed..d4bbf9a1df7 100644
--- a/tests/Doctrine/Tests/DBAL/Functional/Driver/Mysqli/DriverTest.php
+++ b/tests/Doctrine/Tests/DBAL/Functional/Driver/Mysqli/DriverTest.php
@@ -2,6 +2,7 @@
namespace Doctrine\Tests\DBAL\Functional\Driver\Mysqli;
+use Doctrine\DBAL\Driver as DriverInterface;
use Doctrine\DBAL\Driver\Mysqli\Driver;
use Doctrine\Tests\DBAL\Functional\Driver\AbstractDriverTest;
use function extension_loaded;
@@ -26,7 +27,7 @@ protected function setUp() : void
/**
* {@inheritdoc}
*/
- protected function createDriver()
+ protected function createDriver() : DriverInterface
{
return new Driver();
}
diff --git a/tests/Doctrine/Tests/DBAL/Functional/Driver/OCI8/DriverTest.php b/tests/Doctrine/Tests/DBAL/Functional/Driver/OCI8/DriverTest.php
index b617b2bb0d3..861ce650e76 100644
--- a/tests/Doctrine/Tests/DBAL/Functional/Driver/OCI8/DriverTest.php
+++ b/tests/Doctrine/Tests/DBAL/Functional/Driver/OCI8/DriverTest.php
@@ -2,6 +2,7 @@
namespace Doctrine\Tests\DBAL\Functional\Driver\OCI8;
+use Doctrine\DBAL\Driver as DriverInterface;
use Doctrine\DBAL\Driver\OCI8\Driver;
use Doctrine\Tests\DBAL\Functional\Driver\AbstractDriverTest;
use function extension_loaded;
@@ -26,7 +27,7 @@ protected function setUp() : void
/**
* {@inheritdoc}
*/
- public function testConnectsWithoutDatabaseNameParameter()
+ public function testConnectsWithoutDatabaseNameParameter() : void
{
$this->markTestSkipped('Oracle does not support connecting without database name.');
}
@@ -34,7 +35,7 @@ public function testConnectsWithoutDatabaseNameParameter()
/**
* {@inheritdoc}
*/
- public function testReturnsDatabaseNameWithoutDatabaseNameParameter()
+ public function testReturnsDatabaseNameWithoutDatabaseNameParameter() : void
{
$this->markTestSkipped('Oracle does not support connecting without database name.');
}
@@ -42,7 +43,7 @@ public function testReturnsDatabaseNameWithoutDatabaseNameParameter()
/**
* {@inheritdoc}
*/
- protected function createDriver()
+ protected function createDriver() : DriverInterface
{
return new Driver();
}
diff --git a/tests/Doctrine/Tests/DBAL/Functional/Driver/OCI8/OCI8ConnectionTest.php b/tests/Doctrine/Tests/DBAL/Functional/Driver/OCI8/OCI8ConnectionTest.php
index 4e23a2a059a..d6184316fac 100644
--- a/tests/Doctrine/Tests/DBAL/Functional/Driver/OCI8/OCI8ConnectionTest.php
+++ b/tests/Doctrine/Tests/DBAL/Functional/Driver/OCI8/OCI8ConnectionTest.php
@@ -31,7 +31,7 @@ protected function setUp() : void
/**
* @group DBAL-2595
*/
- public function testLastInsertIdAcceptsFqn()
+ public function testLastInsertIdAcceptsFqn() : void
{
$platform = $this->connection->getDatabasePlatform();
$schemaManager = $this->connection->getSchemaManager();
diff --git a/tests/Doctrine/Tests/DBAL/Functional/Driver/OCI8/StatementTest.php b/tests/Doctrine/Tests/DBAL/Functional/Driver/OCI8/StatementTest.php
index fce2820bde8..8ecbed68082 100644
--- a/tests/Doctrine/Tests/DBAL/Functional/Driver/OCI8/StatementTest.php
+++ b/tests/Doctrine/Tests/DBAL/Functional/Driver/OCI8/StatementTest.php
@@ -29,7 +29,7 @@ protected function setUp() : void
*
* @dataProvider queryConversionProvider
*/
- public function testQueryConversion($query, array $params, array $expected)
+ public function testQueryConversion(string $query, array $params, array $expected) : void
{
self::assertEquals(
$expected,
@@ -37,7 +37,10 @@ public function testQueryConversion($query, array $params, array $expected)
);
}
- public static function queryConversionProvider()
+ /**
+ * @return array>
+ */
+ public static function queryConversionProvider() : iterable
{
return [
'simple' => [
diff --git a/tests/Doctrine/Tests/DBAL/Functional/Driver/PDOConnectionTest.php b/tests/Doctrine/Tests/DBAL/Functional/Driver/PDOConnectionTest.php
index 94c8bf00223..6dfb1b85c3d 100644
--- a/tests/Doctrine/Tests/DBAL/Functional/Driver/PDOConnectionTest.php
+++ b/tests/Doctrine/Tests/DBAL/Functional/Driver/PDOConnectionTest.php
@@ -46,12 +46,12 @@ protected function tearDown() : void
parent::tearDown();
}
- public function testDoesNotRequireQueryForServerVersion()
+ public function testDoesNotRequireQueryForServerVersion() : void
{
self::assertFalse($this->driverConnection->requiresQueryForServerVersion());
}
- public function testThrowsWrappedExceptionOnConstruct()
+ public function testThrowsWrappedExceptionOnConstruct() : void
{
$this->expectException(PDOException::class);
@@ -61,14 +61,14 @@ public function testThrowsWrappedExceptionOnConstruct()
/**
* @group DBAL-1022
*/
- public function testThrowsWrappedExceptionOnExec()
+ public function testThrowsWrappedExceptionOnExec() : void
{
$this->expectException(PDOException::class);
$this->driverConnection->exec('foo');
}
- public function testThrowsWrappedExceptionOnPrepare()
+ public function testThrowsWrappedExceptionOnPrepare() : void
{
$driver = $this->connection->getDriver();
@@ -97,7 +97,7 @@ public function testThrowsWrappedExceptionOnPrepare()
$this->driverConnection->prepare('foo');
}
- public function testThrowsWrappedExceptionOnQuery()
+ public function testThrowsWrappedExceptionOnQuery() : void
{
$this->expectException(PDOException::class);
diff --git a/tests/Doctrine/Tests/DBAL/Functional/Driver/PDOMySql/DriverTest.php b/tests/Doctrine/Tests/DBAL/Functional/Driver/PDOMySql/DriverTest.php
index 9fe297278f6..7f77ea542f9 100644
--- a/tests/Doctrine/Tests/DBAL/Functional/Driver/PDOMySql/DriverTest.php
+++ b/tests/Doctrine/Tests/DBAL/Functional/Driver/PDOMySql/DriverTest.php
@@ -2,6 +2,7 @@
namespace Doctrine\Tests\DBAL\Functional\Driver\PDOMySql;
+use Doctrine\DBAL\Driver as DriverInterface;
use Doctrine\DBAL\Driver\PDOMySql\Driver;
use Doctrine\Tests\DBAL\Functional\Driver\AbstractDriverTest;
use function extension_loaded;
@@ -26,7 +27,7 @@ protected function setUp() : void
/**
* {@inheritdoc}
*/
- protected function createDriver()
+ protected function createDriver() : DriverInterface
{
return new Driver();
}
diff --git a/tests/Doctrine/Tests/DBAL/Functional/Driver/PDOOracle/DriverTest.php b/tests/Doctrine/Tests/DBAL/Functional/Driver/PDOOracle/DriverTest.php
index 3a5b44c22fa..b096fa47e94 100644
--- a/tests/Doctrine/Tests/DBAL/Functional/Driver/PDOOracle/DriverTest.php
+++ b/tests/Doctrine/Tests/DBAL/Functional/Driver/PDOOracle/DriverTest.php
@@ -2,6 +2,7 @@
namespace Doctrine\Tests\DBAL\Functional\Driver\PDOOracle;
+use Doctrine\DBAL\Driver as DriverInterface;
use Doctrine\DBAL\Driver\PDOOracle\Driver;
use Doctrine\Tests\DBAL\Functional\Driver\AbstractDriverTest;
use function extension_loaded;
@@ -26,7 +27,7 @@ protected function setUp() : void
/**
* {@inheritdoc}
*/
- public function testConnectsWithoutDatabaseNameParameter()
+ public function testConnectsWithoutDatabaseNameParameter() : void
{
$this->markTestSkipped('Oracle does not support connecting without database name.');
}
@@ -34,7 +35,7 @@ public function testConnectsWithoutDatabaseNameParameter()
/**
* {@inheritdoc}
*/
- public function testReturnsDatabaseNameWithoutDatabaseNameParameter()
+ public function testReturnsDatabaseNameWithoutDatabaseNameParameter() : void
{
$this->markTestSkipped('Oracle does not support connecting without database name.');
}
@@ -42,7 +43,7 @@ public function testReturnsDatabaseNameWithoutDatabaseNameParameter()
/**
* {@inheritdoc}
*/
- protected function createDriver()
+ protected function createDriver() : DriverInterface
{
return new Driver();
}
diff --git a/tests/Doctrine/Tests/DBAL/Functional/Driver/PDOPgSql/DriverTest.php b/tests/Doctrine/Tests/DBAL/Functional/Driver/PDOPgSql/DriverTest.php
index 347982b24e5..b5f9d3eda9d 100644
--- a/tests/Doctrine/Tests/DBAL/Functional/Driver/PDOPgSql/DriverTest.php
+++ b/tests/Doctrine/Tests/DBAL/Functional/Driver/PDOPgSql/DriverTest.php
@@ -3,6 +3,7 @@
namespace Doctrine\Tests\DBAL\Functional\Driver\PDOPgSql;
use Doctrine\DBAL\Connection;
+use Doctrine\DBAL\Driver as DriverInterface;
use Doctrine\DBAL\Driver\PDOPgSql\Driver;
use Doctrine\Tests\DBAL\Functional\Driver\AbstractDriverTest;
use Doctrine\Tests\TestUtil;
@@ -31,7 +32,7 @@ protected function setUp() : void
/**
* @dataProvider getDatabaseParameter
*/
- public function testDatabaseParameters($databaseName, $defaultDatabaseName, $expectedDatabaseName)
+ public function testDatabaseParameters(?string $databaseName, ?string $defaultDatabaseName, ?string $expectedDatabaseName) : void
{
$params = $this->connection->getParams();
$params['dbname'] = $databaseName;
@@ -71,7 +72,7 @@ public static function getDatabaseParameter() : iterable
/**
* @group DBAL-1146
*/
- public function testConnectsWithApplicationNameParameter()
+ public function testConnectsWithApplicationNameParameter() : void
{
$parameters = $this->connection->getParams();
$parameters['application_name'] = 'doctrine';
@@ -103,7 +104,7 @@ public function testConnectsWithApplicationNameParameter()
/**
* {@inheritdoc}
*/
- protected function createDriver()
+ protected function createDriver() : DriverInterface
{
return new Driver();
}
diff --git a/tests/Doctrine/Tests/DBAL/Functional/Driver/PDOPgsqlConnectionTest.php b/tests/Doctrine/Tests/DBAL/Functional/Driver/PDOPgsqlConnectionTest.php
index 7bfde54a6f3..8336a3900d1 100644
--- a/tests/Doctrine/Tests/DBAL/Functional/Driver/PDOPgsqlConnectionTest.php
+++ b/tests/Doctrine/Tests/DBAL/Functional/Driver/PDOPgsqlConnectionTest.php
@@ -26,13 +26,11 @@ protected function setUp() : void
}
/**
- * @param string $charset
- *
* @group DBAL-1183
* @group DBAL-1189
* @dataProvider getValidCharsets
*/
- public function testConnectsWithValidCharsetOption($charset)
+ public function testConnectsWithValidCharsetOption(string $charset) : void
{
$params = $this->connection->getParams();
$params['charset'] = $charset;
@@ -53,7 +51,7 @@ public function testConnectsWithValidCharsetOption($charset)
/**
* @return mixed[][]
*/
- public function getValidCharsets()
+ public static function getValidCharsets() : iterable
{
return [
['UTF8'],
diff --git a/tests/Doctrine/Tests/DBAL/Functional/Driver/PDOSqlite/DriverTest.php b/tests/Doctrine/Tests/DBAL/Functional/Driver/PDOSqlite/DriverTest.php
index 3df6d7a6540..efc0382d85f 100644
--- a/tests/Doctrine/Tests/DBAL/Functional/Driver/PDOSqlite/DriverTest.php
+++ b/tests/Doctrine/Tests/DBAL/Functional/Driver/PDOSqlite/DriverTest.php
@@ -2,6 +2,7 @@
namespace Doctrine\Tests\DBAL\Functional\Driver\PDOSqlite;
+use Doctrine\DBAL\Driver as DriverInterface;
use Doctrine\DBAL\Driver\PDOSqlite\Driver;
use Doctrine\Tests\DBAL\Functional\Driver\AbstractDriverTest;
use function extension_loaded;
@@ -26,7 +27,7 @@ protected function setUp() : void
/**
* {@inheritdoc}
*/
- protected function createDriver()
+ protected function createDriver() : DriverInterface
{
return new Driver();
}
diff --git a/tests/Doctrine/Tests/DBAL/Functional/Driver/PDOSqlsrv/DriverTest.php b/tests/Doctrine/Tests/DBAL/Functional/Driver/PDOSqlsrv/DriverTest.php
index 955a90cdaf1..d2dfd5925f5 100644
--- a/tests/Doctrine/Tests/DBAL/Functional/Driver/PDOSqlsrv/DriverTest.php
+++ b/tests/Doctrine/Tests/DBAL/Functional/Driver/PDOSqlsrv/DriverTest.php
@@ -2,6 +2,7 @@
namespace Doctrine\Tests\DBAL\Functional\Driver\PDOSqlsrv;
+use Doctrine\DBAL\Driver as DriverInterface;
use Doctrine\DBAL\Driver\Connection;
use Doctrine\DBAL\Driver\PDOSqlsrv\Driver;
use Doctrine\Tests\DBAL\Functional\Driver\AbstractDriverTest;
@@ -28,7 +29,7 @@ protected function setUp() : void
/**
* {@inheritdoc}
*/
- protected function createDriver()
+ protected function createDriver() : DriverInterface
{
return new Driver();
}
diff --git a/tests/Doctrine/Tests/DBAL/Functional/Driver/SQLAnywhere/ConnectionTest.php b/tests/Doctrine/Tests/DBAL/Functional/Driver/SQLAnywhere/ConnectionTest.php
index e1df07bbac2..4de7b7cde03 100644
--- a/tests/Doctrine/Tests/DBAL/Functional/Driver/SQLAnywhere/ConnectionTest.php
+++ b/tests/Doctrine/Tests/DBAL/Functional/Driver/SQLAnywhere/ConnectionTest.php
@@ -24,7 +24,7 @@ protected function setUp() : void
$this->markTestSkipped('sqlanywhere only test.');
}
- public function testNonPersistentConnection()
+ public function testNonPersistentConnection() : void
{
$params = $this->connection->getParams();
$params['persistent'] = false;
@@ -36,7 +36,7 @@ public function testNonPersistentConnection()
self::assertTrue($conn->isConnected(), 'No SQLAnywhere-nonpersistent connection established');
}
- public function testPersistentConnection()
+ public function testPersistentConnection() : void
{
$params = $this->connection->getParams();
$params['persistent'] = true;
diff --git a/tests/Doctrine/Tests/DBAL/Functional/Driver/SQLAnywhere/DriverTest.php b/tests/Doctrine/Tests/DBAL/Functional/Driver/SQLAnywhere/DriverTest.php
index 4e42e863a46..f2d54c62845 100644
--- a/tests/Doctrine/Tests/DBAL/Functional/Driver/SQLAnywhere/DriverTest.php
+++ b/tests/Doctrine/Tests/DBAL/Functional/Driver/SQLAnywhere/DriverTest.php
@@ -3,6 +3,7 @@
namespace Doctrine\Tests\DBAL\Functional\Driver\SQLAnywhere;
use Doctrine\DBAL\Connection;
+use Doctrine\DBAL\Driver as DriverInterface;
use Doctrine\DBAL\Driver\SQLAnywhere\Driver;
use Doctrine\Tests\DBAL\Functional\Driver\AbstractDriverTest;
use function extension_loaded;
@@ -24,7 +25,7 @@ protected function setUp() : void
$this->markTestSkipped('sqlanywhere only test.');
}
- public function testReturnsDatabaseNameWithoutDatabaseNameParameter()
+ public function testReturnsDatabaseNameWithoutDatabaseNameParameter() : void
{
$params = $this->connection->getParams();
unset($params['dbname']);
@@ -44,7 +45,7 @@ public function testReturnsDatabaseNameWithoutDatabaseNameParameter()
/**
* {@inheritdoc}
*/
- protected function createDriver()
+ protected function createDriver() : DriverInterface
{
return new Driver();
}
diff --git a/tests/Doctrine/Tests/DBAL/Functional/Driver/SQLAnywhere/StatementTest.php b/tests/Doctrine/Tests/DBAL/Functional/Driver/SQLAnywhere/StatementTest.php
index b67c8e571b4..c09eb0a5d56 100644
--- a/tests/Doctrine/Tests/DBAL/Functional/Driver/SQLAnywhere/StatementTest.php
+++ b/tests/Doctrine/Tests/DBAL/Functional/Driver/SQLAnywhere/StatementTest.php
@@ -24,7 +24,7 @@ protected function setUp() : void
$this->markTestSkipped('sqlanywhere only test.');
}
- public function testNonPersistentStatement()
+ public function testNonPersistentStatement() : void
{
$params = $this->connection->getParams();
$params['persistent'] = false;
@@ -39,7 +39,7 @@ public function testNonPersistentStatement()
self::assertTrue($prepStmt->execute(), ' Statement non-persistent failed');
}
- public function testPersistentStatement()
+ public function testPersistentStatement() : void
{
$params = $this->connection->getParams();
$params['persistent'] = true;
diff --git a/tests/Doctrine/Tests/DBAL/Functional/Driver/SQLSrv/DriverTest.php b/tests/Doctrine/Tests/DBAL/Functional/Driver/SQLSrv/DriverTest.php
index 21413acec2f..eb9931a43dc 100644
--- a/tests/Doctrine/Tests/DBAL/Functional/Driver/SQLSrv/DriverTest.php
+++ b/tests/Doctrine/Tests/DBAL/Functional/Driver/SQLSrv/DriverTest.php
@@ -2,6 +2,7 @@
namespace Doctrine\Tests\DBAL\Functional\Driver\SQLSrv;
+use Doctrine\DBAL\Driver as DriverInterface;
use Doctrine\DBAL\Driver\SQLSrv\Driver;
use Doctrine\Tests\DBAL\Functional\Driver\AbstractDriverTest;
use function extension_loaded;
@@ -26,7 +27,7 @@ protected function setUp() : void
/**
* {@inheritdoc}
*/
- protected function createDriver()
+ protected function createDriver() : DriverInterface
{
return new Driver();
}
diff --git a/tests/Doctrine/Tests/DBAL/Functional/Driver/SQLSrv/StatementTest.php b/tests/Doctrine/Tests/DBAL/Functional/Driver/SQLSrv/StatementTest.php
index 2d52b5c0cd3..4e34f693c0c 100644
--- a/tests/Doctrine/Tests/DBAL/Functional/Driver/SQLSrv/StatementTest.php
+++ b/tests/Doctrine/Tests/DBAL/Functional/Driver/SQLSrv/StatementTest.php
@@ -24,7 +24,7 @@ protected function setUp() : void
self::markTestSkipped('sqlsrv only test');
}
- public function testFailureToPrepareResultsInException()
+ public function testFailureToPrepareResultsInException() : void
{
// use the driver connection directly to avoid having exception wrapped
$stmt = $this->connection->getWrappedConnection()->prepare(null);
diff --git a/tests/Doctrine/Tests/DBAL/Functional/ExceptionTest.php b/tests/Doctrine/Tests/DBAL/Functional/ExceptionTest.php
index b43f7371f43..7f4a8145cfe 100644
--- a/tests/Doctrine/Tests/DBAL/Functional/ExceptionTest.php
+++ b/tests/Doctrine/Tests/DBAL/Functional/ExceptionTest.php
@@ -34,7 +34,7 @@ protected function setUp() : void
$this->markTestSkipped('Driver does not support special exception handling.');
}
- public function testPrimaryConstraintViolationException()
+ public function testPrimaryConstraintViolationException() : void
{
$table = new Table('duplicatekey_table');
$table->addColumn('id', 'integer', []);
@@ -48,7 +48,7 @@ public function testPrimaryConstraintViolationException()
$this->connection->insert('duplicatekey_table', ['id' => 1]);
}
- public function testTableNotFoundException()
+ public function testTableNotFoundException() : void
{
$sql = 'SELECT * FROM unknown_table';
@@ -56,7 +56,7 @@ public function testTableNotFoundException()
$this->connection->executeQuery($sql);
}
- public function testTableExistsException()
+ public function testTableExistsException() : void
{
$schemaManager = $this->connection->getSchemaManager();
$table = new Table('alreadyexist_table');
@@ -68,7 +68,7 @@ public function testTableExistsException()
$schemaManager->createTable($table);
}
- public function testForeignKeyConstraintViolationExceptionOnInsert()
+ public function testForeignKeyConstraintViolationExceptionOnInsert() : void
{
if (! $this->connection->getDatabasePlatform()->supportsForeignKeyConstraints()) {
$this->markTestSkipped('Only fails on platforms with foreign key constraints.');
@@ -102,7 +102,7 @@ public function testForeignKeyConstraintViolationExceptionOnInsert()
$this->tearDownForeignKeyConstraintViolationExceptionTest();
}
- public function testForeignKeyConstraintViolationExceptionOnUpdate()
+ public function testForeignKeyConstraintViolationExceptionOnUpdate() : void
{
if (! $this->connection->getDatabasePlatform()->supportsForeignKeyConstraints()) {
$this->markTestSkipped('Only fails on platforms with foreign key constraints.');
@@ -136,7 +136,7 @@ public function testForeignKeyConstraintViolationExceptionOnUpdate()
$this->tearDownForeignKeyConstraintViolationExceptionTest();
}
- public function testForeignKeyConstraintViolationExceptionOnDelete()
+ public function testForeignKeyConstraintViolationExceptionOnDelete() : void
{
if (! $this->connection->getDatabasePlatform()->supportsForeignKeyConstraints()) {
$this->markTestSkipped('Only fails on platforms with foreign key constraints.');
@@ -170,7 +170,7 @@ public function testForeignKeyConstraintViolationExceptionOnDelete()
$this->tearDownForeignKeyConstraintViolationExceptionTest();
}
- public function testForeignKeyConstraintViolationExceptionOnTruncate()
+ public function testForeignKeyConstraintViolationExceptionOnTruncate() : void
{
$platform = $this->connection->getDatabasePlatform();
@@ -206,7 +206,7 @@ public function testForeignKeyConstraintViolationExceptionOnTruncate()
$this->tearDownForeignKeyConstraintViolationExceptionTest();
}
- public function testNotNullConstraintViolationException()
+ public function testNotNullConstraintViolationException() : void
{
$schema = new Schema();
@@ -223,7 +223,7 @@ public function testNotNullConstraintViolationException()
$this->connection->insert('notnull_table', ['id' => 1, 'value' => null]);
}
- public function testInvalidFieldNameException()
+ public function testInvalidFieldNameException() : void
{
$schema = new Schema();
@@ -238,7 +238,7 @@ public function testInvalidFieldNameException()
$this->connection->insert('bad_fieldname_table', ['name' => 5]);
}
- public function testNonUniqueFieldNameException()
+ public function testNonUniqueFieldNameException() : void
{
$schema = new Schema();
@@ -257,7 +257,7 @@ public function testNonUniqueFieldNameException()
$this->connection->executeQuery($sql);
}
- public function testUniqueConstraintViolationException()
+ public function testUniqueConstraintViolationException() : void
{
$schema = new Schema();
@@ -274,7 +274,7 @@ public function testUniqueConstraintViolationException()
$this->connection->insert('unique_field_table', ['id' => 5]);
}
- public function testSyntaxErrorException()
+ public function testSyntaxErrorException() : void
{
$table = new Table('syntax_error_table');
$table->addColumn('id', 'integer', []);
@@ -287,7 +287,7 @@ public function testSyntaxErrorException()
$this->connection->executeQuery($sql);
}
- public function testConnectionExceptionSqLite()
+ public function testConnectionExceptionSqLite() : void
{
if ($this->connection->getDatabasePlatform()->getName() !== 'sqlite') {
$this->markTestSkipped('Only fails this way on sqlite');
@@ -337,9 +337,11 @@ public function testConnectionExceptionSqLite()
}
/**
+ * @param array $params
+ *
* @dataProvider getConnectionParams
*/
- public function testConnectionException($params)
+ public function testConnectionException(array $params) : void
{
if ($this->connection->getDatabasePlatform()->getName() === 'sqlite') {
$this->markTestSkipped('Only skipped if platform is not sqlite');
@@ -369,7 +371,10 @@ public function testConnectionException($params)
}
}
- public function getConnectionParams()
+ /**
+ * @return array>
+ */
+ public static function getConnectionParams() : iterable
{
return [
[['user' => 'not_existing']],
@@ -378,7 +383,7 @@ public function getConnectionParams()
];
}
- private function setUpForeignKeyConstraintViolationExceptionTest()
+ private function setUpForeignKeyConstraintViolationExceptionTest() : void
{
$schemaManager = $this->connection->getSchemaManager();
@@ -396,7 +401,7 @@ private function setUpForeignKeyConstraintViolationExceptionTest()
$schemaManager->createTable($owningTable);
}
- private function tearDownForeignKeyConstraintViolationExceptionTest()
+ private function tearDownForeignKeyConstraintViolationExceptionTest() : void
{
$schemaManager = $this->connection->getSchemaManager();
diff --git a/tests/Doctrine/Tests/DBAL/Functional/LoggingTest.php b/tests/Doctrine/Tests/DBAL/Functional/LoggingTest.php
index 99ca533e742..aa63af708df 100644
--- a/tests/Doctrine/Tests/DBAL/Functional/LoggingTest.php
+++ b/tests/Doctrine/Tests/DBAL/Functional/LoggingTest.php
@@ -7,7 +7,7 @@
class LoggingTest extends DbalFunctionalTestCase
{
- public function testLogExecuteQuery()
+ public function testLogExecuteQuery() : void
{
$sql = $this->connection->getDatabasePlatform()->getDummySelectSQL();
@@ -21,7 +21,7 @@ public function testLogExecuteQuery()
$this->connection->executeQuery($sql, []);
}
- public function testLogExecuteUpdate()
+ public function testLogExecuteUpdate() : void
{
$this->markTestSkipped('Test breaks MySQL but works on all other platforms (Unbuffered Queries stuff).');
@@ -37,7 +37,7 @@ public function testLogExecuteUpdate()
$this->connection->executeUpdate($sql, []);
}
- public function testLogPrepareExecute()
+ public function testLogPrepareExecute() : void
{
$sql = $this->connection->getDatabasePlatform()->getDummySelectSQL();
diff --git a/tests/Doctrine/Tests/DBAL/Functional/MasterSlaveConnectionTest.php b/tests/Doctrine/Tests/DBAL/Functional/MasterSlaveConnectionTest.php
index d927285e2a3..2731ac995b8 100644
--- a/tests/Doctrine/Tests/DBAL/Functional/MasterSlaveConnectionTest.php
+++ b/tests/Doctrine/Tests/DBAL/Functional/MasterSlaveConnectionTest.php
@@ -98,7 +98,7 @@ public function testInheritCharsetFromMaster() : void
}
}
- public function testMasterOnConnect()
+ public function testMasterOnConnect() : void
{
$conn = $this->createMasterSlaveConnection();
@@ -109,7 +109,7 @@ public function testMasterOnConnect()
self::assertTrue($conn->isConnectedToMaster());
}
- public function testNoMasterOnExecuteQuery()
+ public function testNoMasterOnExecuteQuery() : void
{
$conn = $this->createMasterSlaveConnection();
@@ -121,7 +121,7 @@ public function testNoMasterOnExecuteQuery()
self::assertFalse($conn->isConnectedToMaster());
}
- public function testMasterOnWriteOperation()
+ public function testMasterOnWriteOperation() : void
{
$conn = $this->createMasterSlaveConnection();
$conn->insert('master_slave_table', ['test_int' => 30]);
@@ -139,7 +139,7 @@ public function testMasterOnWriteOperation()
/**
* @group DBAL-335
*/
- public function testKeepSlaveBeginTransactionStaysOnMaster()
+ public function testKeepSlaveBeginTransactionStaysOnMaster() : void
{
$conn = $this->createMasterSlaveConnection($keepSlave = true);
$conn->connect('slave');
@@ -160,7 +160,7 @@ public function testKeepSlaveBeginTransactionStaysOnMaster()
/**
* @group DBAL-335
*/
- public function testKeepSlaveInsertStaysOnMaster()
+ public function testKeepSlaveInsertStaysOnMaster() : void
{
$conn = $this->createMasterSlaveConnection($keepSlave = true);
$conn->connect('slave');
@@ -176,7 +176,7 @@ public function testKeepSlaveInsertStaysOnMaster()
self::assertFalse($conn->isConnectedToMaster());
}
- public function testMasterSlaveConnectionCloseAndReconnect()
+ public function testMasterSlaveConnectionCloseAndReconnect() : void
{
$conn = $this->createMasterSlaveConnection();
$conn->connect('master');
@@ -189,7 +189,7 @@ public function testMasterSlaveConnectionCloseAndReconnect()
self::assertTrue($conn->isConnectedToMaster());
}
- public function testQueryOnMaster()
+ public function testQueryOnMaster() : void
{
$conn = $this->createMasterSlaveConnection();
@@ -213,7 +213,7 @@ public function testQueryOnMaster()
self::assertEquals(1, $data[0]['num']);
}
- public function testQueryOnSlave()
+ public function testQueryOnSlave() : void
{
$conn = $this->createMasterSlaveConnection();
$conn->connect('slave');
diff --git a/tests/Doctrine/Tests/DBAL/Functional/ModifyLimitQueryTest.php b/tests/Doctrine/Tests/DBAL/Functional/ModifyLimitQueryTest.php
index 88c28661634..a14f9b17582 100644
--- a/tests/Doctrine/Tests/DBAL/Functional/ModifyLimitQueryTest.php
+++ b/tests/Doctrine/Tests/DBAL/Functional/ModifyLimitQueryTest.php
@@ -36,7 +36,7 @@ protected function setUp() : void
$this->connection->exec($this->connection->getDatabasePlatform()->getTruncateTableSQL('modify_limit_table2'));
}
- public function testModifyLimitQuerySimpleQuery()
+ public function testModifyLimitQuerySimpleQuery() : void
{
$this->connection->insert('modify_limit_table', ['test_int' => 1]);
$this->connection->insert('modify_limit_table', ['test_int' => 2]);
@@ -51,7 +51,7 @@ public function testModifyLimitQuerySimpleQuery()
$this->assertLimitResult([2, 3, 4], $sql, null, 1);
}
- public function testModifyLimitQueryJoinQuery()
+ public function testModifyLimitQueryJoinQuery() : void
{
$this->connection->insert('modify_limit_table', ['test_int' => 1]);
$this->connection->insert('modify_limit_table', ['test_int' => 2]);
@@ -69,7 +69,7 @@ public function testModifyLimitQueryJoinQuery()
$this->assertLimitResult([2, 2], $sql, 2, 0);
}
- public function testModifyLimitQueryNonDeterministic()
+ public function testModifyLimitQueryNonDeterministic() : void
{
$this->connection->insert('modify_limit_table', ['test_int' => 1]);
$this->connection->insert('modify_limit_table', ['test_int' => 2]);
@@ -83,7 +83,7 @@ public function testModifyLimitQueryNonDeterministic()
$this->assertLimitResult([2, 1], $sql, 2, 2, false);
}
- public function testModifyLimitQueryGroupBy()
+ public function testModifyLimitQueryGroupBy() : void
{
$this->connection->insert('modify_limit_table', ['test_int' => 1]);
$this->connection->insert('modify_limit_table', ['test_int' => 2]);
@@ -103,7 +103,7 @@ public function testModifyLimitQueryGroupBy()
$this->assertLimitResult([2], $sql, 1, 1);
}
- public function testModifyLimitQuerySubSelect()
+ public function testModifyLimitQuerySubSelect() : void
{
$this->connection->insert('modify_limit_table', ['test_int' => 1]);
$this->connection->insert('modify_limit_table', ['test_int' => 2]);
@@ -117,7 +117,7 @@ public function testModifyLimitQuerySubSelect()
$this->assertLimitResult([2, 1], $sql, 2, 2);
}
- public function testModifyLimitQueryFromSubSelect()
+ public function testModifyLimitQueryFromSubSelect() : void
{
$this->connection->insert('modify_limit_table', ['test_int' => 1]);
$this->connection->insert('modify_limit_table', ['test_int' => 2]);
@@ -131,7 +131,7 @@ public function testModifyLimitQueryFromSubSelect()
$this->assertLimitResult([2, 1], $sql, 2, 2);
}
- public function testModifyLimitQueryLineBreaks()
+ public function testModifyLimitQueryLineBreaks() : void
{
$this->connection->insert('modify_limit_table', ['test_int' => 1]);
$this->connection->insert('modify_limit_table', ['test_int' => 2]);
@@ -151,7 +151,7 @@ public function testModifyLimitQueryLineBreaks()
$this->assertLimitResult([2], $sql, 1, 1);
}
- public function testModifyLimitQueryZeroOffsetNoLimit()
+ public function testModifyLimitQueryZeroOffsetNoLimit() : void
{
$this->connection->insert('modify_limit_table', ['test_int' => 1]);
$this->connection->insert('modify_limit_table', ['test_int' => 2]);
@@ -161,7 +161,10 @@ public function testModifyLimitQueryZeroOffsetNoLimit()
$this->assertLimitResult([1, 2], $sql, null, 0);
}
- public function assertLimitResult($expectedResults, $sql, $limit, $offset, $deterministic = true)
+ /**
+ * @param array $expectedResults
+ */
+ private function assertLimitResult(array $expectedResults, string $sql, ?int $limit, int $offset, bool $deterministic = true) : void
{
$p = $this->connection->getDatabasePlatform();
$data = [];
diff --git a/tests/Doctrine/Tests/DBAL/Functional/NamedParametersTest.php b/tests/Doctrine/Tests/DBAL/Functional/NamedParametersTest.php
index 4dec0809fb4..33e116ec368 100644
--- a/tests/Doctrine/Tests/DBAL/Functional/NamedParametersTest.php
+++ b/tests/Doctrine/Tests/DBAL/Functional/NamedParametersTest.php
@@ -16,7 +16,10 @@
*/
class NamedParametersTest extends DbalFunctionalTestCase
{
- public function ticketProvider()
+ /**
+ * @return iterable>
+ */
+ public static function ticketProvider() : iterable
{
return [
[
@@ -201,14 +204,13 @@ protected function setUp() : void
}
/**
- * @param string $query
* @param mixed[] $params
* @param int[] $types
* @param int[] $expected
*
* @dataProvider ticketProvider
*/
- public function testTicket($query, $params, $types, $expected)
+ public function testTicket(string $query, array $params, array $types, array $expected) : void
{
$stmt = $this->connection->executeQuery($query, $params, $types);
$result = $stmt->fetchAll(FetchMode::ASSOCIATIVE);
diff --git a/tests/Doctrine/Tests/DBAL/Functional/PDOStatementTest.php b/tests/Doctrine/Tests/DBAL/Functional/PDOStatementTest.php
index 1ba37b61394..42b8104a9e7 100644
--- a/tests/Doctrine/Tests/DBAL/Functional/PDOStatementTest.php
+++ b/tests/Doctrine/Tests/DBAL/Functional/PDOStatementTest.php
@@ -32,7 +32,7 @@ protected function setUp() : void
* @group legacy
* @expectedDeprecation Using a PDO fetch mode or their combination (%d given) is deprecated and will cause an error in Doctrine 3.0
*/
- public function testPDOSpecificModeIsAccepted()
+ public function testPDOSpecificModeIsAccepted() : void
{
$this->connection->insert('stmt_test', [
'id' => 1,
diff --git a/tests/Doctrine/Tests/DBAL/Functional/Platform/NewPrimaryKeyWithNewAutoIncrementColumnTest.php b/tests/Doctrine/Tests/DBAL/Functional/Platform/NewPrimaryKeyWithNewAutoIncrementColumnTest.php
index 64efb1aad6a..42e08f3f6d7 100644
--- a/tests/Doctrine/Tests/DBAL/Functional/Platform/NewPrimaryKeyWithNewAutoIncrementColumnTest.php
+++ b/tests/Doctrine/Tests/DBAL/Functional/Platform/NewPrimaryKeyWithNewAutoIncrementColumnTest.php
@@ -2,6 +2,7 @@
namespace Doctrine\Tests\DBAL\Functional\Platform;
+use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Schema\Comparator;
use Doctrine\Tests\DbalFunctionalTestCase;
use function in_array;
@@ -30,7 +31,7 @@ protected function setUp() : void
* SQLSTATE[42000]: Syntax error or access violation: 1075 Incorrect table definition; there can be only one auto
* column and it must be defined as a key
*/
- public function testAlterPrimaryKeyToAutoIncrementColumn()
+ public function testAlterPrimaryKeyToAutoIncrementColumn() : void
{
$schemaManager = $this->connection->getSchemaManager();
$schema = $schemaManager->createSchema();
@@ -62,7 +63,7 @@ public function testAlterPrimaryKeyToAutoIncrementColumn()
$this->assertSame(['new_id'], $validationTable->getPrimaryKeyColumns());
}
- private function getPlatform()
+ private function getPlatform() : AbstractPlatform
{
return $this->connection->getDatabasePlatform();
}
diff --git a/tests/Doctrine/Tests/DBAL/Functional/PortabilityTest.php b/tests/Doctrine/Tests/DBAL/Functional/PortabilityTest.php
index 73308f8e7b3..72fb9dd2213 100644
--- a/tests/Doctrine/Tests/DBAL/Functional/PortabilityTest.php
+++ b/tests/Doctrine/Tests/DBAL/Functional/PortabilityTest.php
@@ -29,16 +29,10 @@ protected function tearDown() : void
parent::tearDown();
}
- /**
- * @param int $portabilityMode
- * @param int $case
- *
- * @return Connection
- */
private function getPortableConnection(
- $portabilityMode = ConnectionPortability::PORTABILITY_ALL,
- $case = ColumnCase::LOWER
- ) {
+ int $portabilityMode = ConnectionPortability::PORTABILITY_ALL,
+ int $case = ColumnCase::LOWER
+ ) : Connection {
if (! $this->portableConnection) {
$params = $this->connection->getParams();
@@ -67,7 +61,7 @@ private function getPortableConnection(
return $this->portableConnection;
}
- public function testFullFetchMode()
+ public function testFullFetchMode() : void
{
$rows = $this->getPortableConnection()->fetchAll('SELECT * FROM portability_table');
$this->assertFetchResultRows($rows);
@@ -93,7 +87,7 @@ public function testFullFetchMode()
}
}
- public function testConnFetchMode()
+ public function testConnFetchMode() : void
{
$conn = $this->getPortableConnection();
$conn->setFetchMode(FetchMode::ASSOCIATIVE);
@@ -118,7 +112,10 @@ public function testConnFetchMode()
}
}
- public function assertFetchResultRows($rows)
+ /**
+ * @param array> $rows
+ */
+ private function assertFetchResultRows(array $rows) : void
{
self::assertCount(2, $rows);
foreach ($rows as $row) {
@@ -126,7 +123,10 @@ public function assertFetchResultRows($rows)
}
}
- public function assertFetchResultRow($row)
+ /**
+ * @param array $row
+ */
+ public function assertFetchResultRow(array $row) : void
{
self::assertContains($row['test_int'], [1, 2], 'Primary key test_int should either be 1 or 2.');
self::assertArrayHasKey('test_string', $row, 'Case should be lowered.');
@@ -136,12 +136,11 @@ public function assertFetchResultRow($row)
}
/**
- * @param string $field
* @param mixed[] $expected
*
* @dataProvider fetchAllColumnProvider
*/
- public function testFetchAllColumn($field, array $expected)
+ public function testFetchAllColumn(string $field, array $expected) : void
{
$conn = $this->getPortableConnection();
$stmt = $conn->query('SELECT ' . $field . ' FROM portability_table');
@@ -150,7 +149,10 @@ public function testFetchAllColumn($field, array $expected)
self::assertEquals($expected, $column);
}
- public static function fetchAllColumnProvider()
+ /**
+ * @return iterable>
+ */
+ public static function fetchAllColumnProvider() : iterable
{
return [
'int' => [
@@ -164,7 +166,7 @@ public static function fetchAllColumnProvider()
];
}
- public function testFetchAllNullColumn()
+ public function testFetchAllNullColumn() : void
{
$conn = $this->getPortableConnection();
$stmt = $conn->query('SELECT Test_Null FROM portability_table');
diff --git a/tests/Doctrine/Tests/DBAL/Functional/ResultCacheTest.php b/tests/Doctrine/Tests/DBAL/Functional/ResultCacheTest.php
index 06f6c18bbe3..35ce061b5b9 100644
--- a/tests/Doctrine/Tests/DBAL/Functional/ResultCacheTest.php
+++ b/tests/Doctrine/Tests/DBAL/Functional/ResultCacheTest.php
@@ -4,6 +4,7 @@
use Doctrine\Common\Cache\ArrayCache;
use Doctrine\DBAL\Cache\QueryCacheProfile;
+use Doctrine\DBAL\Driver\ResultStatement;
use Doctrine\DBAL\FetchMode;
use Doctrine\DBAL\Logging\DebugStack;
use Doctrine\DBAL\Schema\Table;
@@ -20,7 +21,7 @@
*/
class ResultCacheTest extends DbalFunctionalTestCase
{
- /** @var int[][]|string[][] */
+ /** @var array> */
private $expectedResult = [['test_int' => 100, 'test_string' => 'foo'], ['test_int' => 200, 'test_string' => 'bar'], ['test_int' => 300, 'test_string' => 'baz']];
/** @var DebugStack */
@@ -56,45 +57,45 @@ protected function tearDown() : void
parent::tearDown();
}
- public function testCacheFetchAssoc()
+ public function testCacheFetchAssoc() : void
{
- self::assertCacheNonCacheSelectSameFetchModeAreEqual(
+ $this->assertCacheNonCacheSelectSameFetchModeAreEqual(
$this->expectedResult,
FetchMode::ASSOCIATIVE
);
}
- public function testFetchNum()
+ public function testFetchNum() : void
{
$expectedResult = [];
foreach ($this->expectedResult as $v) {
$expectedResult[] = array_values($v);
}
- self::assertCacheNonCacheSelectSameFetchModeAreEqual($expectedResult, FetchMode::NUMERIC);
+ $this->assertCacheNonCacheSelectSameFetchModeAreEqual($expectedResult, FetchMode::NUMERIC);
}
- public function testFetchBoth()
+ public function testFetchBoth() : void
{
$expectedResult = [];
foreach ($this->expectedResult as $v) {
$expectedResult[] = array_merge($v, array_values($v));
}
- self::assertCacheNonCacheSelectSameFetchModeAreEqual($expectedResult, FetchMode::MIXED);
+ $this->assertCacheNonCacheSelectSameFetchModeAreEqual($expectedResult, FetchMode::MIXED);
}
- public function testFetchColumn()
+ public function testFetchColumn() : void
{
$expectedResult = [];
foreach ($this->expectedResult as $v) {
$expectedResult[] = array_shift($v);
}
- self::assertCacheNonCacheSelectSameFetchModeAreEqual($expectedResult, FetchMode::COLUMN);
+ $this->assertCacheNonCacheSelectSameFetchModeAreEqual($expectedResult, FetchMode::COLUMN);
}
- public function testMixingFetch()
+ public function testMixingFetch() : void
{
$numExpectedResult = [];
foreach ($this->expectedResult as $v) {
@@ -113,14 +114,14 @@ public function testMixingFetch()
self::assertEquals($numExpectedResult, $data);
}
- public function testIteratorFetch()
+ public function testIteratorFetch() : void
{
self::assertStandardAndIteratorFetchAreEqual(FetchMode::MIXED);
self::assertStandardAndIteratorFetchAreEqual(FetchMode::ASSOCIATIVE);
self::assertStandardAndIteratorFetchAreEqual(FetchMode::NUMERIC);
}
- public function assertStandardAndIteratorFetchAreEqual($fetchMode)
+ private function assertStandardAndIteratorFetchAreEqual(int $fetchMode) : void
{
$stmt = $this->connection->executeQuery('SELECT * FROM caching ORDER BY test_int ASC', [], [], new QueryCacheProfile(10, 'testcachekey'));
$data = $this->hydrateStmt($stmt, $fetchMode);
@@ -131,7 +132,7 @@ public function assertStandardAndIteratorFetchAreEqual($fetchMode)
self::assertEquals($data, $data_iterator);
}
- public function testDontCloseNoCache()
+ public function testDontCloseNoCache() : void
{
$stmt = $this->connection->executeQuery('SELECT * FROM caching ORDER BY test_int ASC', [], [], new QueryCacheProfile(10, 'testcachekey'));
@@ -152,7 +153,7 @@ public function testDontCloseNoCache()
self::assertCount(2, $this->sqlLogger->queries);
}
- public function testDontFinishNoCache()
+ public function testDontFinishNoCache() : void
{
$stmt = $this->connection->executeQuery('SELECT * FROM caching ORDER BY test_int ASC', [], [], new QueryCacheProfile(10, 'testcachekey'));
@@ -166,7 +167,7 @@ public function testDontFinishNoCache()
self::assertCount(2, $this->sqlLogger->queries);
}
- public function testFetchAllAndFinishSavesCache()
+ public function testFetchAllAndFinishSavesCache() : void
{
$layerCache = new ArrayCache();
$stmt = $this->connection->executeQuery('SELECT * FROM caching WHERE test_int > 500', [], [], new QueryCacheProfile(10, 'testcachekey', $layerCache));
@@ -176,7 +177,10 @@ public function testFetchAllAndFinishSavesCache()
self::assertCount(1, $layerCache->fetch('testcachekey'));
}
- public function assertCacheNonCacheSelectSameFetchModeAreEqual($expectedResult, $fetchMode)
+ /**
+ * @param array> $expectedResult
+ */
+ private function assertCacheNonCacheSelectSameFetchModeAreEqual(array $expectedResult, int $fetchMode) : void
{
$stmt = $this->connection->executeQuery('SELECT * FROM caching ORDER BY test_int ASC', [], [], new QueryCacheProfile(10, 'testcachekey'));
@@ -192,7 +196,7 @@ public function assertCacheNonCacheSelectSameFetchModeAreEqual($expectedResult,
self::assertCount(1, $this->sqlLogger->queries, 'just one dbal hit');
}
- public function testEmptyResultCache()
+ public function testEmptyResultCache() : void
{
$stmt = $this->connection->executeQuery('SELECT * FROM caching WHERE test_int > 500', [], [], new QueryCacheProfile(10, 'emptycachekey'));
$data = $this->hydrateStmt($stmt);
@@ -203,7 +207,7 @@ public function testEmptyResultCache()
self::assertCount(1, $this->sqlLogger->queries, 'just one dbal hit');
}
- public function testChangeCacheImpl()
+ public function testChangeCacheImpl() : void
{
$stmt = $this->connection->executeQuery('SELECT * FROM caching WHERE test_int > 500', [], [], new QueryCacheProfile(10, 'emptycachekey'));
$data = $this->hydrateStmt($stmt);
@@ -216,7 +220,10 @@ public function testChangeCacheImpl()
self::assertCount(1, $secondCache->fetch('emptycachekey'));
}
- private function hydrateStmt($stmt, $fetchMode = FetchMode::ASSOCIATIVE)
+ /**
+ * @return array
+ */
+ private function hydrateStmt(ResultStatement $stmt, int $fetchMode = FetchMode::ASSOCIATIVE) : array
{
$data = [];
while ($row = $stmt->fetch($fetchMode)) {
@@ -227,7 +234,10 @@ private function hydrateStmt($stmt, $fetchMode = FetchMode::ASSOCIATIVE)
return $data;
}
- private function hydrateStmtIterator($stmt, $fetchMode = FetchMode::ASSOCIATIVE)
+ /**
+ * @return array
+ */
+ private function hydrateStmtIterator(ResultStatement $stmt, int $fetchMode = FetchMode::ASSOCIATIVE) : array
{
$data = [];
$stmt->setFetchMode($fetchMode);
diff --git a/tests/Doctrine/Tests/DBAL/Functional/Schema/Db2SchemaManagerTest.php b/tests/Doctrine/Tests/DBAL/Functional/Schema/Db2SchemaManagerTest.php
index 102fd1bb495..330198e9ca9 100644
--- a/tests/Doctrine/Tests/DBAL/Functional/Schema/Db2SchemaManagerTest.php
+++ b/tests/Doctrine/Tests/DBAL/Functional/Schema/Db2SchemaManagerTest.php
@@ -10,7 +10,7 @@ class Db2SchemaManagerTest extends SchemaManagerFunctionalTestCase
/**
* @group DBAL-939
*/
- public function testGetBooleanColumn()
+ public function testGetBooleanColumn() : void
{
$table = new Table('boolean_column_test');
$table->addColumn('bool', 'boolean');
@@ -27,7 +27,7 @@ public function testGetBooleanColumn()
self::assertSame("That's a comment", $columns['bool_commented']->getComment());
}
- public function testListTableWithBinary()
+ public function testListTableWithBinary() : void
{
self::markTestSkipped('Binary data type is currently not supported on DB2 LUW');
}
diff --git a/tests/Doctrine/Tests/DBAL/Functional/Schema/DefaultValueTest.php b/tests/Doctrine/Tests/DBAL/Functional/Schema/DefaultValueTest.php
index a65305a2e13..3dd362e2263 100644
--- a/tests/Doctrine/Tests/DBAL/Functional/Schema/DefaultValueTest.php
+++ b/tests/Doctrine/Tests/DBAL/Functional/Schema/DefaultValueTest.php
@@ -40,9 +40,11 @@ protected function setUp() : void
}
/**
+ * @param mixed $expectedDefault
+ *
* @dataProvider columnProvider
*/
- public function testEscapedDefaultValueCanBeIntrospected(string $name, $expectedDefault) : void
+ public function testEscapedDefaultValueCanBeIntrospected(string $name, ?string $expectedDefault) : void
{
self::assertSame(
$expectedDefault,
@@ -55,9 +57,11 @@ public function testEscapedDefaultValueCanBeIntrospected(string $name, $expected
}
/**
+ * @param mixed $expectedDefault
+ *
* @dataProvider columnProvider
*/
- public function testEscapedDefaultValueCanBeInserted(string $name, $expectedDefault) : void
+ public function testEscapedDefaultValueCanBeInserted(string $name, ?string $expectedDefault) : void
{
$value = $this->connection->fetchColumn(
sprintf('SELECT %s FROM default_value', $name)
diff --git a/tests/Doctrine/Tests/DBAL/Functional/Schema/DrizzleSchemaManagerTest.php b/tests/Doctrine/Tests/DBAL/Functional/Schema/DrizzleSchemaManagerTest.php
index 070e2173d63..422740476da 100644
--- a/tests/Doctrine/Tests/DBAL/Functional/Schema/DrizzleSchemaManagerTest.php
+++ b/tests/Doctrine/Tests/DBAL/Functional/Schema/DrizzleSchemaManagerTest.php
@@ -7,7 +7,7 @@
class DrizzleSchemaManagerTest extends SchemaManagerFunctionalTestCase
{
- public function testListTableWithBinary()
+ public function testListTableWithBinary() : void
{
$tableName = 'test_binary_table';
@@ -28,7 +28,7 @@ public function testListTableWithBinary()
self::assertFalse($table->getColumn('column_binary')->getFixed());
}
- public function testColumnCollation()
+ public function testColumnCollation() : void
{
$table = new Table('test_collation');
$table->addOption('collate', $collation = 'utf8_unicode_ci');
diff --git a/tests/Doctrine/Tests/DBAL/Functional/Schema/MySqlSchemaManagerTest.php b/tests/Doctrine/Tests/DBAL/Functional/Schema/MySqlSchemaManagerTest.php
index 558159b7fa4..e9a88e52096 100644
--- a/tests/Doctrine/Tests/DBAL/Functional/Schema/MySqlSchemaManagerTest.php
+++ b/tests/Doctrine/Tests/DBAL/Functional/Schema/MySqlSchemaManagerTest.php
@@ -27,7 +27,7 @@ protected function setUp() : void
Type::addType('point', MySqlPointType::class);
}
- public function testSwitchPrimaryKeyColumns()
+ public function testSwitchPrimaryKeyColumns() : void
{
$tableOld = new Table('switch_primary_key_columns');
$tableOld->addColumn('foo_id', 'integer');
@@ -49,7 +49,7 @@ public function testSwitchPrimaryKeyColumns()
self::assertContains('foo_id', $primaryKey);
}
- public function testDiffTableBug()
+ public function testDiffTableBug() : void
{
$schema = new Schema();
$table = $schema->createTable('diffbug_routing_translations');
@@ -72,7 +72,7 @@ public function testDiffTableBug()
self::assertFalse($diff, 'no changes expected.');
}
- public function testFulltextIndex()
+ public function testFulltextIndex() : void
{
$table = new Table('fulltext_index');
$table->addColumn('text', 'text');
@@ -89,7 +89,7 @@ public function testFulltextIndex()
self::assertTrue($indexes['f_index']->hasFlag('fulltext'));
}
- public function testSpatialIndex()
+ public function testSpatialIndex() : void
{
$table = new Table('spatial_index');
$table->addColumn('point', 'point');
@@ -122,7 +122,7 @@ public function testIndexWithLength() : void
/**
* @group DBAL-400
*/
- public function testAlterTableAddPrimaryKey()
+ public function testAlterTableAddPrimaryKey() : void
{
$table = new Table('alter_table_add_pk');
$table->addColumn('id', 'integer');
@@ -148,7 +148,7 @@ public function testAlterTableAddPrimaryKey()
/**
* @group DBAL-464
*/
- public function testDropPrimaryKeyWithAutoincrementColumn()
+ public function testDropPrimaryKeyWithAutoincrementColumn() : void
{
$table = new Table('drop_primary_key');
$table->addColumn('id', 'integer', ['autoincrement' => true]);
@@ -174,7 +174,7 @@ public function testDropPrimaryKeyWithAutoincrementColumn()
/**
* @group DBAL-789
*/
- public function testDoesNotPropagateDefaultValuesForUnsupportedColumnTypes()
+ public function testDoesNotPropagateDefaultValuesForUnsupportedColumnTypes() : void
{
if ($this->schemaManager->getDatabasePlatform() instanceof MariaDb1027Platform) {
$this->markTestSkipped(
@@ -213,7 +213,7 @@ public function testDoesNotPropagateDefaultValuesForUnsupportedColumnTypes()
self::assertFalse($onlineTable->getColumn('def_blob_null')->getNotnull());
}
- public function testColumnCharset()
+ public function testColumnCharset() : void
{
$table = new Table('test_column_charset');
$table->addColumn('id', 'integer');
@@ -230,7 +230,7 @@ public function testColumnCharset()
self::assertEquals('latin1', $columns['bar']->getPlatformOption('charset'));
}
- public function testAlterColumnCharset()
+ public function testAlterColumnCharset() : void
{
$tableName = 'test_alter_column_charset';
@@ -251,7 +251,7 @@ public function testAlterColumnCharset()
self::assertEquals('ascii', $table->getColumn('col_text')->getPlatformOption('charset'));
}
- public function testColumnCharsetChange()
+ public function testColumnCharsetChange() : void
{
$table = new Table('test_column_charset_change');
$table->addColumn('col_string', 'string')->setLength(100)->setNotnull(true)->setPlatformOption('charset', 'utf8');
@@ -266,7 +266,7 @@ public function testColumnCharsetChange()
self::assertContains('ALTER TABLE test_column_charset_change CHANGE col_string col_string VARCHAR(100) CHARACTER SET ascii NOT NULL', $diff);
}
- public function testColumnCollation()
+ public function testColumnCollation() : void
{
$table = new Table('test_collation');
$table->addOption('collate', $collation = 'latin1_swedish_ci');
@@ -288,7 +288,7 @@ public function testColumnCollation()
/**
* @group DBAL-843
*/
- public function testListLobTypeColumns()
+ public function testListLobTypeColumns() : void
{
$tableName = 'lob_type_columns';
$table = new Table($tableName);
@@ -347,7 +347,7 @@ public function testListLobTypeColumns()
/**
* @group DBAL-423
*/
- public function testDiffListGuidTableColumn()
+ public function testDiffListGuidTableColumn() : void
{
$offlineTable = new Table('list_guid_table_column');
$offlineTable->addColumn('col_guid', 'guid');
@@ -367,7 +367,7 @@ public function testDiffListGuidTableColumn()
/**
* @group DBAL-1082
*/
- public function testListDecimalTypeColumns()
+ public function testListDecimalTypeColumns() : void
{
$tableName = 'test_list_decimal_columns';
$table = new Table($tableName);
@@ -388,7 +388,7 @@ public function testListDecimalTypeColumns()
/**
* @group DBAL-1082
*/
- public function testListFloatTypeColumns()
+ public function testListFloatTypeColumns() : void
{
$tableName = 'test_list_float_columns';
$table = new Table($tableName);
@@ -440,7 +440,7 @@ public function testColumnDefaultCurrentTimestamp() : void
self::assertFalse($diff, 'Tables should be identical with column defaults.');
}
- public function testColumnDefaultsAreValid()
+ public function testColumnDefaultsAreValid() : void
{
$table = new Table('test_column_defaults_are_valid');
diff --git a/tests/Doctrine/Tests/DBAL/Functional/Schema/OracleSchemaManagerTest.php b/tests/Doctrine/Tests/DBAL/Functional/Schema/OracleSchemaManagerTest.php
index 3fc8bee811b..b2363b639f0 100644
--- a/tests/Doctrine/Tests/DBAL/Functional/Schema/OracleSchemaManagerTest.php
+++ b/tests/Doctrine/Tests/DBAL/Functional/Schema/OracleSchemaManagerTest.php
@@ -32,7 +32,7 @@ protected function setUp() : void
self::$privilegesGranted = true;
}
- public function testRenameTable()
+ public function testRenameTable() : void
{
$this->schemaManager->tryMethod('DropTable', 'list_tables_test');
$this->schemaManager->tryMethod('DropTable', 'list_tables_test_new_name');
@@ -45,7 +45,7 @@ public function testRenameTable()
self::assertHasTable($tables, 'list_tables_test_new_name');
}
- public function testListTableWithBinary()
+ public function testListTableWithBinary() : void
{
$tableName = 'test_binary_table';
@@ -70,7 +70,7 @@ public function testListTableWithBinary()
* @group DBAL-472
* @group DBAL-1001
*/
- public function testAlterTableColumnNotNull()
+ public function testAlterTableColumnNotNull() : void
{
$comparator = new Schema\Comparator();
$tableName = 'list_table_column_notnull';
@@ -102,7 +102,7 @@ public function testAlterTableColumnNotNull()
self::assertTrue($columns['bar']->getNotnull());
}
- public function testListDatabases()
+ public function testListDatabases() : void
{
// We need the temp connection that has privileges to create a database.
$sm = TestUtil::getTempConnection()->getSchemaManager();
@@ -118,7 +118,7 @@ public function testListDatabases()
/**
* @group DBAL-831
*/
- public function testListTableDetailsWithDifferentIdentifierQuotingRequirements()
+ public function testListTableDetailsWithDifferentIdentifierQuotingRequirements() : void
{
$primaryTableName = '"Primary_Table"';
$offlinePrimaryTable = new Schema\Table($primaryTableName);
@@ -226,7 +226,7 @@ public function testListTableDetailsWithDifferentIdentifierQuotingRequirements()
);
}
- public function testListTableColumnsSameTableNamesInDifferentSchemas()
+ public function testListTableColumnsSameTableNamesInDifferentSchemas() : void
{
$table = $this->createListTableColumns();
$this->schemaManager->dropAndCreateTable($table);
@@ -242,7 +242,7 @@ public function testListTableColumnsSameTableNamesInDifferentSchemas()
/**
* @group DBAL-1234
*/
- public function testListTableIndexesPrimaryKeyConstraintNameDiffersFromIndexName()
+ public function testListTableIndexesPrimaryKeyConstraintNameDiffersFromIndexName() : void
{
$table = new Table('list_table_indexes_pk_id_test');
$table->setSchemaConfig($this->schemaManager->createSchemaConfig());
@@ -265,7 +265,7 @@ public function testListTableIndexesPrimaryKeyConstraintNameDiffersFromIndexName
/**
* @group DBAL-2555
*/
- public function testListTableDateTypeColumns()
+ public function testListTableDateTypeColumns() : void
{
$table = new Table('tbl_date');
$table->addColumn('col_date', 'date');
diff --git a/tests/Doctrine/Tests/DBAL/Functional/Schema/PostgreSqlSchemaManagerTest.php b/tests/Doctrine/Tests/DBAL/Functional/Schema/PostgreSqlSchemaManagerTest.php
index e388bf607da..35326968798 100644
--- a/tests/Doctrine/Tests/DBAL/Functional/Schema/PostgreSqlSchemaManagerTest.php
+++ b/tests/Doctrine/Tests/DBAL/Functional/Schema/PostgreSqlSchemaManagerTest.php
@@ -34,7 +34,7 @@ protected function tearDown() : void
/**
* @group DBAL-177
*/
- public function testGetSearchPath()
+ public function testGetSearchPath() : void
{
$params = $this->connection->getParams();
@@ -45,7 +45,7 @@ public function testGetSearchPath()
/**
* @group DBAL-244
*/
- public function testGetSchemaNames()
+ public function testGetSchemaNames() : void
{
$names = $this->schemaManager->getSchemaNames();
@@ -57,7 +57,7 @@ public function testGetSchemaNames()
/**
* @group DBAL-21
*/
- public function testSupportDomainTypeFallback()
+ public function testSupportDomainTypeFallback() : void
{
$createDomainTypeSQL = 'CREATE DOMAIN MyMoney AS DECIMAL(18,2)';
$this->connection->exec($createDomainTypeSQL);
@@ -78,7 +78,7 @@ public function testSupportDomainTypeFallback()
/**
* @group DBAL-37
*/
- public function testDetectsAutoIncrement()
+ public function testDetectsAutoIncrement() : void
{
$autoincTable = new Table('autoinc_table');
$column = $autoincTable->addColumn('id', 'integer');
@@ -92,7 +92,7 @@ public function testDetectsAutoIncrement()
/**
* @group DBAL-37
*/
- public function testAlterTableAutoIncrementAdd()
+ public function testAlterTableAutoIncrementAdd() : void
{
$tableFrom = new Table('autoinc_table_add');
$column = $tableFrom->addColumn('id', 'integer');
@@ -121,7 +121,7 @@ public function testAlterTableAutoIncrementAdd()
/**
* @group DBAL-37
*/
- public function testAlterTableAutoIncrementDrop()
+ public function testAlterTableAutoIncrementDrop() : void
{
$tableFrom = new Table('autoinc_table_drop');
$column = $tableFrom->addColumn('id', 'integer');
@@ -146,7 +146,7 @@ public function testAlterTableAutoIncrementDrop()
/**
* @group DBAL-75
*/
- public function testTableWithSchema()
+ public function testTableWithSchema() : void
{
$this->connection->exec('CREATE SCHEMA nested');
@@ -181,7 +181,7 @@ public function testTableWithSchema()
* @group DBAL-91
* @group DBAL-88
*/
- public function testReturnQuotedAssets()
+ public function testReturnQuotedAssets() : void
{
$sql = 'create table dbal91_something ( id integer CONSTRAINT id_something PRIMARY KEY NOT NULL ,"table" integer );';
$this->connection->exec($sql);
@@ -203,7 +203,7 @@ public function testReturnQuotedAssets()
/**
* @group DBAL-204
*/
- public function testFilterSchemaExpression()
+ public function testFilterSchemaExpression() : void
{
$testTable = new Table('dbal204_test_prefix');
$column = $testTable->addColumn('id', 'integer');
@@ -221,7 +221,7 @@ public function testFilterSchemaExpression()
self::assertCount(1, $names);
}
- public function testListForeignKeys()
+ public function testListForeignKeys() : void
{
if (! $this->connection->getDatabasePlatform()->supportsForeignKeyConstraints()) {
$this->markTestSkipped('Does not support foreign key constraints.');
@@ -263,7 +263,7 @@ public function testListForeignKeys()
/**
* @group DBAL-511
*/
- public function testDefaultValueCharacterVarying()
+ public function testDefaultValueCharacterVarying() : void
{
$testTable = new Table('dbal511_default');
$testTable->addColumn('id', 'integer');
@@ -280,7 +280,7 @@ public function testDefaultValueCharacterVarying()
/**
* @group DDC-2843
*/
- public function testBooleanDefault()
+ public function testBooleanDefault() : void
{
$table = new Table('ddc2843_bools');
$table->addColumn('id', 'integer');
@@ -296,7 +296,7 @@ public function testBooleanDefault()
self::assertFalse($diff);
}
- public function testListTableWithBinary()
+ public function testListTableWithBinary() : void
{
$tableName = 'test_binary_table';
@@ -317,7 +317,7 @@ public function testListTableWithBinary()
self::assertFalse($table->getColumn('column_binary')->getFixed());
}
- public function testListQuotedTable()
+ public function testListQuotedTable() : void
{
$offlineTable = new Schema\Table('user');
$offlineTable->addColumn('id', 'integer');
@@ -335,7 +335,7 @@ public function testListQuotedTable()
self::assertFalse($comparator->diffTable($offlineTable, $onlineTable));
}
- public function testListTablesExcludesViews()
+ public function testListTablesExcludesViews() : void
{
$this->createTestTable('list_tables_excludes_views');
@@ -364,7 +364,7 @@ public function testListTablesExcludesViews()
/**
* @group DBAL-1033
*/
- public function testPartialIndexes()
+ public function testPartialIndexes() : void
{
$offlineTable = new Schema\Table('person');
$offlineTable->addColumn('id', 'integer');
@@ -419,7 +419,7 @@ public function jsonbColumnTypeProvider() : array
/**
* @group DBAL-2427
*/
- public function testListNegativeColumnDefaultValue()
+ public function testListNegativeColumnDefaultValue() : void
{
$table = new Schema\Table('test_default_negative');
$table->addColumn('col_smallint', 'smallint', ['default' => -1]);
@@ -444,7 +444,7 @@ public function testListNegativeColumnDefaultValue()
/**
* @return mixed[][]
*/
- public static function serialTypes() : array
+ public static function serialTypes() : iterable
{
return [
['integer'],
@@ -518,7 +518,7 @@ public function testAlterTableAutoIncrementIntToBigInt(string $from, string $to,
/**
* @return mixed[][]
*/
- public function autoIncrementTypeMigrations() : array
+ public static function autoIncrementTypeMigrations() : iterable
{
return [
'int->bigint' => ['integer', 'bigint', 'BIGINT'],
@@ -529,6 +529,9 @@ public function autoIncrementTypeMigrations() : array
class MoneyType extends Type
{
+ /**
+ * {@inheritDoc}
+ */
public function getName()
{
return 'MyMoney';
diff --git a/tests/Doctrine/Tests/DBAL/Functional/Schema/SQLAnywhereSchemaManagerTest.php b/tests/Doctrine/Tests/DBAL/Functional/Schema/SQLAnywhereSchemaManagerTest.php
index 73eb07ea178..ffb5d6cf5ec 100644
--- a/tests/Doctrine/Tests/DBAL/Functional/Schema/SQLAnywhereSchemaManagerTest.php
+++ b/tests/Doctrine/Tests/DBAL/Functional/Schema/SQLAnywhereSchemaManagerTest.php
@@ -8,7 +8,7 @@
class SQLAnywhereSchemaManagerTest extends SchemaManagerFunctionalTestCase
{
- public function testCreateAndListViews()
+ public function testCreateAndListViews() : void
{
$this->createTestTable('view_test_table');
@@ -27,7 +27,7 @@ public function testCreateAndListViews()
self::assertRegExp('/^SELECT \* from "?DBA"?\."?view_test_table"?$/', $views[$name]->getSql());
}
- public function testDropAndCreateAdvancedIndex()
+ public function testDropAndCreateAdvancedIndex() : void
{
$table = $this->getTestTable('test_create_advanced_index');
$this->schemaManager->dropAndCreateTable($table);
@@ -47,7 +47,7 @@ public function testDropAndCreateAdvancedIndex()
self::assertTrue($tableIndexes['test']->hasFlag('for_olap_workload'));
}
- public function testListTableColumnsWithFixedStringTypeColumn()
+ public function testListTableColumnsWithFixedStringTypeColumn() : void
{
$table = new Table('list_table_columns_char');
$table->addColumn('id', 'integer', ['notnull' => true]);
diff --git a/tests/Doctrine/Tests/DBAL/Functional/Schema/SQLServerSchemaManagerTest.php b/tests/Doctrine/Tests/DBAL/Functional/Schema/SQLServerSchemaManagerTest.php
index d4598bccdb8..f8b3b66c15c 100644
--- a/tests/Doctrine/Tests/DBAL/Functional/Schema/SQLServerSchemaManagerTest.php
+++ b/tests/Doctrine/Tests/DBAL/Functional/Schema/SQLServerSchemaManagerTest.php
@@ -11,7 +11,7 @@
class SQLServerSchemaManagerTest extends SchemaManagerFunctionalTestCase
{
- protected function getPlatformName()
+ protected function getPlatformName() : string
{
return 'mssql';
}
@@ -19,7 +19,7 @@ protected function getPlatformName()
/**
* @group DBAL-255
*/
- public function testDropColumnConstraints()
+ public function testDropColumnConstraints() : void
{
$table = new Table('sqlsrv_drop_column');
$table->addColumn('id', 'integer');
@@ -34,7 +34,7 @@ public function testDropColumnConstraints()
self::assertCount(1, $columns);
}
- public function testColumnCollation()
+ public function testColumnCollation() : void
{
$table = new Table($tableName = 'test_collation');
$column = $table->addColumn($columnName = 'test', 'string');
@@ -52,7 +52,7 @@ public function testColumnCollation()
self::assertEquals($collation, $columns[$columnName]->getPlatformOption('collation'));
}
- public function testDefaultConstraints()
+ public function testDefaultConstraints() : void
{
$table = new Table('sqlsrv_default_constraints');
$table->addColumn('no_default', 'string');
@@ -157,7 +157,7 @@ public function testDefaultConstraints()
/**
* @group DBAL-543
*/
- public function testColumnComments()
+ public function testColumnComments() : void
{
$table = new Table('sqlsrv_column_comment');
$table->addColumn('id', 'integer', ['autoincrement' => true]);
@@ -319,7 +319,7 @@ public function testColumnComments()
self::assertEquals('666', $columns['added_commented_type_with_comment']->getComment());
}
- public function testPkOrdering()
+ public function testPkOrdering() : void
{
// SQL Server stores index column information in a system table with two
// columns that almost always have the same value: index_column_id and key_ordinal.
diff --git a/tests/Doctrine/Tests/DBAL/Functional/Schema/SchemaManagerFunctionalTestCase.php b/tests/Doctrine/Tests/DBAL/Functional/Schema/SchemaManagerFunctionalTestCase.php
index c9b95066010..241662b56d3 100644
--- a/tests/Doctrine/Tests/DBAL/Functional/Schema/SchemaManagerFunctionalTestCase.php
+++ b/tests/Doctrine/Tests/DBAL/Functional/Schema/SchemaManagerFunctionalTestCase.php
@@ -52,7 +52,7 @@ abstract class SchemaManagerFunctionalTestCase extends DbalFunctionalTestCase
/** @var AbstractSchemaManager */
protected $schemaManager;
- protected function getPlatformName()
+ protected function getPlatformName() : string
{
$class = static::class;
$e = explode('\\', $class);
@@ -92,7 +92,7 @@ protected function tearDown() : void
/**
* @group DBAL-1220
*/
- public function testDropsDatabaseWithActiveConnections()
+ public function testDropsDatabaseWithActiveConnections() : void
{
if (! $this->schemaManager->getDatabasePlatform()->supportsCreateDropDatabase()) {
$this->markTestSkipped('Cannot drop Database client side with this Driver.');
@@ -129,7 +129,7 @@ public function testDropsDatabaseWithActiveConnections()
/**
* @group DBAL-195
*/
- public function testDropAndCreateSequence()
+ public function testDropAndCreateSequence() : void
{
$platform = $this->connection->getDatabasePlatform();
@@ -161,7 +161,7 @@ static function (AbstractAsset $item) use ($name) : bool {
return count($filteredList) === 1;
}
- public function testListSequences()
+ public function testListSequences() : void
{
$platform = $this->connection->getDatabasePlatform();
@@ -193,7 +193,7 @@ public function testListSequences()
self::assertSame(10, $foundSequence->getInitialValue(), 'Initial Value is expected to be 10.');
}
- public function testListDatabases()
+ public function testListDatabases() : void
{
if (! $this->schemaManager->getDatabasePlatform()->supportsCreateDropDatabase()) {
$this->markTestSkipped('Cannot drop Database client side with this Driver.');
@@ -210,7 +210,7 @@ public function testListDatabases()
/**
* @group DBAL-1058
*/
- public function testListNamespaceNames()
+ public function testListNamespaceNames() : void
{
if (! $this->schemaManager->getDatabasePlatform()->supportsSchemas()) {
$this->markTestSkipped('Platform does not support schemas.');
@@ -230,7 +230,7 @@ public function testListNamespaceNames()
self::assertContains('test_create_schema', $namespaces);
}
- public function testListTables()
+ public function testListTables() : void
{
$this->createTestTable('list_tables_test');
$tables = $this->schemaManager->listTables();
@@ -255,7 +255,7 @@ public function testListTables()
self::assertTrue($foundTable, "The 'list_tables_test' table has to be found.");
}
- public function createListTableColumns()
+ public function createListTableColumns() : Table
{
$table = new Table('list_table_columns');
$table->addColumn('id', 'integer', ['notnull' => true]);
@@ -270,7 +270,7 @@ public function createListTableColumns()
return $table;
}
- public function testListTableColumns()
+ public function testListTableColumns() : void
{
$table = $this->createListTableColumns();
@@ -344,7 +344,7 @@ public function testListTableColumns()
/**
* @group DBAL-1078
*/
- public function testListTableColumnsWithFixedStringColumn()
+ public function testListTableColumnsWithFixedStringColumn() : void
{
$tableName = 'test_list_table_fixed_string';
@@ -361,7 +361,7 @@ public function testListTableColumnsWithFixedStringColumn()
self::assertSame(2, $columns['column_char']->getLength());
}
- public function testListTableColumnsDispatchEvent()
+ public function testListTableColumnsDispatchEvent() : void
{
$table = $this->createListTableColumns();
@@ -387,7 +387,7 @@ public function testListTableColumnsDispatchEvent()
$this->schemaManager->getDatabasePlatform()->setEventManager($oldEventManager);
}
- public function testListTableIndexesDispatchEvent()
+ public function testListTableIndexesDispatchEvent() : void
{
$table = $this->getTestTable('list_table_indexes_test');
$table->addUniqueIndex(['test'], 'test_index_name');
@@ -415,7 +415,7 @@ public function testListTableIndexesDispatchEvent()
$this->schemaManager->getDatabasePlatform()->setEventManager($oldEventManager);
}
- public function testDiffListTableColumns()
+ public function testDiffListTableColumns() : void
{
if ($this->schemaManager->getDatabasePlatform()->getName() === 'oracle') {
$this->markTestSkipped('Does not work with Oracle, since it cannot detect DateTime, Date and Time differenecs (at the moment).');
@@ -431,7 +431,7 @@ public function testDiffListTableColumns()
self::assertFalse($diff, 'No differences should be detected with the offline vs online schema.');
}
- public function testListTableIndexes()
+ public function testListTableIndexes() : void
{
$table = $this->getTestCompositeTable('list_table_indexes_test');
$table->addUniqueIndex(['test'], 'test_index_name');
@@ -459,7 +459,7 @@ public function testListTableIndexes()
self::assertFalse($tableIndexes['test_composite_idx']->isPrimary());
}
- public function testDropAndCreateIndex()
+ public function testDropAndCreateIndex() : void
{
$table = $this->getTestTable('test_create_index');
$table->addUniqueIndex(['test'], 'test');
@@ -475,7 +475,7 @@ public function testDropAndCreateIndex()
self::assertFalse($tableIndexes['test']->isPrimary());
}
- public function testCreateTableWithForeignKeys()
+ public function testCreateTableWithForeignKeys() : void
{
if (! $this->schemaManager->getDatabasePlatform()->supportsForeignKeyConstraints()) {
$this->markTestSkipped('Platform does not support foreign keys.');
@@ -503,7 +503,7 @@ public function testCreateTableWithForeignKeys()
self::assertTrue($fkTable->columnsAreIndexed($fkConstraint->getColumns()), 'The columns of a foreign key constraint should always be indexed.');
}
- public function testListForeignKeys()
+ public function testListForeignKeys() : void
{
if (! $this->connection->getDatabasePlatform()->supportsForeignKeyConstraints()) {
$this->markTestSkipped('Does not support foreign key constraints.');
@@ -538,12 +538,12 @@ public function testListForeignKeys()
self::assertEquals('CASCADE', $fkeys[0]->getOption('onDelete'));
}
- protected function getCreateExampleViewSql()
+ protected function getCreateExampleViewSql() : void
{
$this->markTestSkipped('No Create Example View SQL was defined for this SchemaManager');
}
- public function testCreateSchema()
+ public function testCreateSchema() : void
{
$this->createTestTable('test_table');
@@ -551,7 +551,7 @@ public function testCreateSchema()
self::assertTrue($schema->hasTable('test_table'));
}
- public function testAlterTableScenario()
+ public function testAlterTableScenario() : void
{
if (! $this->schemaManager->getDatabasePlatform()->supportsAlterTable()) {
$this->markTestSkipped('Alter Table is not supported by this platform.');
@@ -640,7 +640,7 @@ public function testAlterTableScenario()
self::assertEquals(['id'], array_map('strtolower', $foreignKey->getForeignColumns()));
}
- public function testTableInNamespace()
+ public function testTableInNamespace() : void
{
if (! $this->schemaManager->getDatabasePlatform()->supportsSchemas()) {
$this->markTestSkipped('Schema definition is not supported by this platform.');
@@ -664,7 +664,7 @@ public function testTableInNamespace()
self::assertContains('my_table_not_in_namespace', $this->schemaManager->listTableNames());
}
- public function testCreateAndListViews()
+ public function testCreateAndListViews() : void
{
if (! $this->schemaManager->getDatabasePlatform()->supportsViews()) {
$this->markTestSkipped('Views is not supported by this platform.');
@@ -682,7 +682,7 @@ public function testCreateAndListViews()
self::assertTrue($this->hasElementWithName($this->schemaManager->listViews(), $name));
}
- public function testAutoincrementDetection()
+ public function testAutoincrementDetection() : void
{
if (! $this->schemaManager->getDatabasePlatform()->supportsIdentityColumns()) {
$this->markTestSkipped('This test is only supported on platforms that have autoincrement');
@@ -703,7 +703,7 @@ public function testAutoincrementDetection()
/**
* @group DBAL-792
*/
- public function testAutoincrementDetectionMulticolumns()
+ public function testAutoincrementDetectionMulticolumns() : void
{
if (! $this->schemaManager->getDatabasePlatform()->supportsIdentityColumns()) {
$this->markTestSkipped('This test is only supported on platforms that have autoincrement');
@@ -725,7 +725,7 @@ public function testAutoincrementDetectionMulticolumns()
/**
* @group DDC-887
*/
- public function testUpdateSchemaWithForeignKeyRenaming()
+ public function testUpdateSchemaWithForeignKeyRenaming() : void
{
if (! $this->schemaManager->getDatabasePlatform()->supportsForeignKeyConstraints()) {
$this->markTestSkipped('This test is only supported on platforms that have foreign keys.');
@@ -770,7 +770,7 @@ public function testUpdateSchemaWithForeignKeyRenaming()
/**
* @group DBAL-1062
*/
- public function testRenameIndexUsedInForeignKeyConstraint()
+ public function testRenameIndexUsedInForeignKeyConstraint() : void
{
if (! $this->schemaManager->getDatabasePlatform()->supportsForeignKeyConstraints()) {
$this->markTestSkipped('This test is only supported on platforms that have foreign keys.');
@@ -811,7 +811,7 @@ public function testRenameIndexUsedInForeignKeyConstraint()
/**
* @group DBAL-42
*/
- public function testGetColumnComment()
+ public function testGetColumnComment() : void
{
if (! $this->connection->getDatabasePlatform()->supportsInlineColumnComments() &&
! $this->connection->getDatabasePlatform()->supportsCommentOnStatement() &&
@@ -855,7 +855,7 @@ public function testGetColumnComment()
/**
* @group DBAL-42
*/
- public function testAutomaticallyAppendCommentOnMarkedColumns()
+ public function testAutomaticallyAppendCommentOnMarkedColumns() : void
{
if (! $this->connection->getDatabasePlatform()->supportsInlineColumnComments() &&
! $this->connection->getDatabasePlatform()->supportsCommentOnStatement() &&
@@ -883,7 +883,7 @@ public function testAutomaticallyAppendCommentOnMarkedColumns()
/**
* @group DBAL-1228
*/
- public function testCommentHintOnDateIntervalTypeColumn()
+ public function testCommentHintOnDateIntervalTypeColumn() : void
{
if (! $this->connection->getDatabasePlatform()->supportsInlineColumnComments() &&
! $this->connection->getDatabasePlatform()->supportsCommentOnStatement() &&
@@ -908,7 +908,7 @@ public function testCommentHintOnDateIntervalTypeColumn()
/**
* @group DBAL-825
*/
- public function testChangeColumnsTypeWithDefaultValue()
+ public function testChangeColumnsTypeWithDefaultValue() : void
{
$tableName = 'column_def_change_type';
$table = new Table($tableName);
@@ -948,7 +948,7 @@ public function testChangeColumnsTypeWithDefaultValue()
/**
* @group DBAL-197
*/
- public function testListTableWithBlob()
+ public function testListTableWithBlob() : void
{
$table = new Table('test_blob_table');
$table->addColumn('id', 'integer', ['comment' => 'This is a comment']);
@@ -965,12 +965,9 @@ public function testListTableWithBlob()
}
/**
- * @param string $name
* @param mixed[] $data
- *
- * @return Table
*/
- protected function createTestTable($name = 'test_table', array $data = [])
+ protected function createTestTable(string $name = 'test_table', array $data = []) : Table
{
$options = $data['options'] ?? [];
@@ -981,7 +978,10 @@ protected function createTestTable($name = 'test_table', array $data = [])
return $table;
}
- protected function getTestTable($name, $options = [])
+ /**
+ * @param mixed[] $options
+ */
+ protected function getTestTable(string $name, array $options = []) : Table
{
$table = new Table($name, [], [], [], false, $options);
$table->setSchemaConfig($this->schemaManager->createSchemaConfig());
@@ -993,7 +993,7 @@ protected function getTestTable($name, $options = [])
return $table;
}
- protected function getTestCompositeTable($name)
+ protected function getTestCompositeTable(string $name) : Table
{
$table = new Table($name, [], [], [], false, []);
$table->setSchemaConfig($this->schemaManager->createSchemaConfig());
@@ -1005,7 +1005,10 @@ protected function getTestCompositeTable($name)
return $table;
}
- protected function assertHasTable($tables, $tableName)
+ /**
+ * @param Table[] $tables
+ */
+ protected function assertHasTable(array $tables) : void
{
$foundTable = false;
foreach ($tables as $table) {
@@ -1019,7 +1022,7 @@ protected function assertHasTable($tables, $tableName)
self::assertTrue($foundTable, 'Could not find new table');
}
- public function testListForeignKeysComposite()
+ public function testListForeignKeysComposite() : void
{
if (! $this->connection->getDatabasePlatform()->supportsForeignKeyConstraints()) {
$this->markTestSkipped('Does not support foreign key constraints.');
@@ -1049,7 +1052,7 @@ public function testListForeignKeysComposite()
/**
* @group DBAL-44
*/
- public function testColumnDefaultLifecycle()
+ public function testColumnDefaultLifecycle() : void
{
$table = new Table('col_def_lifecycle');
$table->addColumn('id', 'integer', ['autoincrement' => true]);
@@ -1100,7 +1103,7 @@ public function testColumnDefaultLifecycle()
self::assertNull($columns['column7']->getDefault());
}
- public function testListTableWithBinary()
+ public function testListTableWithBinary() : void
{
$tableName = 'test_binary_table';
@@ -1121,7 +1124,7 @@ public function testListTableWithBinary()
self::assertTrue($table->getColumn('column_binary')->getFixed());
}
- public function testListTableDetailsWithFullQualifiedTableName()
+ public function testListTableDetailsWithFullQualifiedTableName() : void
{
if (! $this->schemaManager->getDatabasePlatform()->supportsSchemas()) {
$this->markTestSkipped('Test only works on platforms that support schemas.');
@@ -1161,7 +1164,7 @@ public function testListTableDetailsWithFullQualifiedTableName()
);
}
- public function testCommentStringsAreQuoted()
+ public function testCommentStringsAreQuoted() : void
{
if (! $this->connection->getDatabasePlatform()->supportsInlineColumnComments() &&
! $this->connection->getDatabasePlatform()->supportsCommentOnStatement() &&
@@ -1179,7 +1182,7 @@ public function testCommentStringsAreQuoted()
self::assertEquals("It's a comment with a quote", $columns['id']->getComment());
}
- public function testCommentNotDuplicated()
+ public function testCommentNotDuplicated() : void
{
if (! $this->connection->getDatabasePlatform()->supportsInlineColumnComments()) {
$this->markTestSkipped('Database does not support column comments.');
@@ -1205,8 +1208,12 @@ public function testCommentNotDuplicated()
* @group DBAL-1009
* @dataProvider getAlterColumnComment
*/
- public function testAlterColumnComment($comment1, $expectedComment1, $comment2, $expectedComment2)
- {
+ public function testAlterColumnComment(
+ ?string $comment1,
+ ?string $expectedComment1,
+ ?string $comment2,
+ ?string $expectedComment2
+ ) : void {
if (! $this->connection->getDatabasePlatform()->supportsInlineColumnComments() &&
! $this->connection->getDatabasePlatform()->supportsCommentOnStatement() &&
$this->connection->getDatabasePlatform()->getName() !== 'mssql') {
@@ -1248,7 +1255,10 @@ public function testAlterColumnComment($comment1, $expectedComment1, $comment2,
self::assertSame($expectedComment2, $onlineTable->getColumn('no_comment2')->getComment());
}
- public function getAlterColumnComment()
+ /**
+ * @return mixed[][]
+ */
+ public static function getAlterColumnComment() : iterable
{
return [
[null, null, ' ', ' '],
@@ -1269,7 +1279,7 @@ public function getAlterColumnComment()
/**
* @group DBAL-1095
*/
- public function testDoesNotListIndexesImplicitlyCreatedByForeignKeys()
+ public function testDoesNotListIndexesImplicitlyCreatedByForeignKeys() : void
{
if (! $this->schemaManager->getDatabasePlatform()->supportsForeignKeyConstraints()) {
$this->markTestSkipped('This test is only supported on platforms that have foreign keys.');
@@ -1540,7 +1550,7 @@ static function (Sequence $sequence) use ($sequenceName) : bool {
/**
* @group DBAL-2921
*/
- public function testPrimaryKeyAutoIncrement()
+ public function testPrimaryKeyAutoIncrement() : void
{
$table = new Table('test_pk_auto_increment');
$table->addColumn('id', 'integer', ['autoincrement' => true]);
diff --git a/tests/Doctrine/Tests/DBAL/Functional/Schema/SqliteSchemaManagerTest.php b/tests/Doctrine/Tests/DBAL/Functional/Schema/SqliteSchemaManagerTest.php
index dc4e01c5ade..cce8f92f72d 100644
--- a/tests/Doctrine/Tests/DBAL/Functional/Schema/SqliteSchemaManagerTest.php
+++ b/tests/Doctrine/Tests/DBAL/Functional/Schema/SqliteSchemaManagerTest.php
@@ -20,14 +20,14 @@ class SqliteSchemaManagerTest extends SchemaManagerFunctionalTestCase
/**
* SQLITE does not support databases.
*/
- public function testListDatabases()
+ public function testListDatabases() : void
{
$this->expectException(DBALException::class);
$this->schemaManager->listDatabases();
}
- public function testCreateAndDropDatabase()
+ public function testCreateAndDropDatabase() : void
{
$path = dirname(__FILE__) . '/test_create_and_drop_sqlite_database.sqlite';
@@ -40,7 +40,7 @@ public function testCreateAndDropDatabase()
/**
* @group DBAL-1220
*/
- public function testDropsDatabaseWithActiveConnections()
+ public function testDropsDatabaseWithActiveConnections() : void
{
$this->schemaManager->dropAndCreateDatabase('test_drop_database');
@@ -63,7 +63,7 @@ public function testDropsDatabaseWithActiveConnections()
unset($connection);
}
- public function testRenameTable()
+ public function testRenameTable() : void
{
$this->createTestTable('oldname');
$this->schemaManager->renameTable('oldname', 'newname');
@@ -73,7 +73,7 @@ public function testRenameTable()
self::assertNotContains('oldname', $tables);
}
- public function createListTableColumns()
+ public function createListTableColumns() : Table
{
$table = parent::createListTableColumns();
$table->getColumn('id')->setAutoincrement(true);
@@ -81,7 +81,7 @@ public function createListTableColumns()
return $table;
}
- public function testListForeignKeysFromExistingDatabase()
+ public function testListForeignKeysFromExistingDatabase() : void
{
$this->connection->exec(<<schemaManager->listTableForeignKeys('user'));
}
- public function testColumnCollation()
+ public function testColumnCollation() : void
{
$table = new Schema\Table('test_collation');
$table->addColumn('id', 'integer');
@@ -138,7 +138,7 @@ public function testColumnCollation()
self::assertEquals('NOCASE', $columns['bar']->getPlatformOption('collation'));
}
- public function testListTableWithBinary()
+ public function testListTableWithBinary() : void
{
$tableName = 'test_binary_table';
@@ -159,7 +159,7 @@ public function testListTableWithBinary()
self::assertFalse($table->getColumn('column_binary')->getFixed());
}
- public function testNonDefaultPKOrder()
+ public function testNonDefaultPKOrder() : void
{
if (! extension_loaded('sqlite3')) {
$this->markTestSkipped('This test requires the SQLite3 extension.');
@@ -189,7 +189,7 @@ public function testNonDefaultPKOrder()
/**
* @group DBAL-1779
*/
- public function testListTableColumnsWithWhitespacesInTypeDeclarations()
+ public function testListTableColumnsWithWhitespacesInTypeDeclarations() : void
{
$sql = <<addColumn('id', 'integer');
diff --git a/tests/Doctrine/Tests/DBAL/Functional/StatementTest.php b/tests/Doctrine/Tests/DBAL/Functional/StatementTest.php
index 66b4a93a207..392e6d756bc 100644
--- a/tests/Doctrine/Tests/DBAL/Functional/StatementTest.php
+++ b/tests/Doctrine/Tests/DBAL/Functional/StatementTest.php
@@ -24,7 +24,7 @@ protected function setUp() : void
$this->connection->getSchemaManager()->dropAndCreateTable($table);
}
- public function testStatementIsReusableAfterClosingCursor()
+ public function testStatementIsReusableAfterClosingCursor() : void
{
if ($this->connection->getDriver() instanceof PDOOracleDriver) {
$this->markTestIncomplete('See https://bugs.php.net/bug.php?id=77181');
@@ -49,7 +49,7 @@ public function testStatementIsReusableAfterClosingCursor()
self::assertEquals(2, $id);
}
- public function testReuseStatementWithLongerResults()
+ public function testReuseStatementWithLongerResults() : void
{
if ($this->connection->getDriver() instanceof PDOOracleDriver) {
$this->markTestIncomplete('PDO_OCI doesn\'t support fetching blobs via PDOStatement::fetchAll()');
@@ -86,7 +86,7 @@ public function testReuseStatementWithLongerResults()
], $stmt->fetchAll(FetchMode::NUMERIC));
}
- public function testFetchLongBlob()
+ public function testFetchLongBlob() : void
{
if ($this->connection->getDriver() instanceof PDOOracleDriver) {
// inserting BLOBs as streams on Oracle requires Oracle-specific SQL syntax which is currently not supported
@@ -134,7 +134,7 @@ public function testFetchLongBlob()
self::assertSame($contents, stream_get_contents($stream));
}
- public function testIncompletelyFetchedStatementDoesNotBlockConnection()
+ public function testIncompletelyFetchedStatementDoesNotBlockConnection() : void
{
$this->connection->insert('stmt_test', ['id' => 1]);
$this->connection->insert('stmt_test', ['id' => 2]);
@@ -151,7 +151,7 @@ public function testIncompletelyFetchedStatementDoesNotBlockConnection()
self::assertEquals(1, $stmt2->fetchColumn());
}
- public function testReuseStatementAfterClosingCursor()
+ public function testReuseStatementAfterClosingCursor() : void
{
if ($this->connection->getDriver() instanceof PDOOracleDriver) {
$this->markTestIncomplete('See https://bugs.php.net/bug.php?id=77181');
@@ -173,7 +173,7 @@ public function testReuseStatementAfterClosingCursor()
self::assertEquals(2, $id);
}
- public function testReuseStatementWithParameterBoundByReference()
+ public function testReuseStatementWithParameterBoundByReference() : void
{
$this->connection->insert('stmt_test', ['id' => 1]);
$this->connection->insert('stmt_test', ['id' => 2]);
@@ -190,7 +190,7 @@ public function testReuseStatementWithParameterBoundByReference()
self::assertEquals(2, $stmt->fetchColumn());
}
- public function testReuseStatementWithReboundValue()
+ public function testReuseStatementWithReboundValue() : void
{
$this->connection->insert('stmt_test', ['id' => 1]);
$this->connection->insert('stmt_test', ['id' => 2]);
@@ -206,7 +206,7 @@ public function testReuseStatementWithReboundValue()
self::assertEquals(2, $stmt->fetchColumn());
}
- public function testReuseStatementWithReboundParam()
+ public function testReuseStatementWithReboundParam() : void
{
$this->connection->insert('stmt_test', ['id' => 1]);
$this->connection->insert('stmt_test', ['id' => 2]);
@@ -225,26 +225,27 @@ public function testReuseStatementWithReboundParam()
}
/**
+ * @param mixed $expected
+ *
* @dataProvider emptyFetchProvider
*/
- public function testFetchFromNonExecutedStatement(callable $fetch, $expected)
+ public function testFetchFromNonExecutedStatement(callable $fetch, $expected) : void
{
$stmt = $this->connection->prepare('SELECT id FROM stmt_test');
self::assertSame($expected, $fetch($stmt));
}
- public function testCloseCursorOnNonExecutedStatement()
+ public function testCloseCursorOnNonExecutedStatement() : void
{
$stmt = $this->connection->prepare('SELECT id FROM stmt_test');
-
self::assertTrue($stmt->closeCursor());
}
/**
* @group DBAL-2637
*/
- public function testCloseCursorAfterCursorEnd()
+ public function testCloseCursorAfterCursorEnd() : void
{
$stmt = $this->connection->prepare('SELECT name FROM stmt_test');
@@ -255,9 +256,11 @@ public function testCloseCursorAfterCursorEnd()
}
/**
+ * @param mixed $expected
+ *
* @dataProvider emptyFetchProvider
*/
- public function testFetchFromNonExecutedStatementWithClosedCursor(callable $fetch, $expected)
+ public function testFetchFromNonExecutedStatementWithClosedCursor(callable $fetch, $expected) : void
{
$stmt = $this->connection->prepare('SELECT id FROM stmt_test');
$stmt->closeCursor();
@@ -266,9 +269,11 @@ public function testFetchFromNonExecutedStatementWithClosedCursor(callable $fetc
}
/**
+ * @param mixed $expected
+ *
* @dataProvider emptyFetchProvider
*/
- public function testFetchFromExecutedStatementWithClosedCursor(callable $fetch, $expected)
+ public function testFetchFromExecutedStatementWithClosedCursor(callable $fetch, $expected) : void
{
$this->connection->insert('stmt_test', ['id' => 1]);
@@ -279,7 +284,10 @@ public function testFetchFromExecutedStatementWithClosedCursor(callable $fetch,
self::assertSame($expected, $fetch($stmt));
}
- public static function emptyFetchProvider()
+ /**
+ * @return mixed[][]
+ */
+ public static function emptyFetchProvider() : iterable
{
return [
'fetch' => [
diff --git a/tests/Doctrine/Tests/DBAL/Functional/TableGeneratorTest.php b/tests/Doctrine/Tests/DBAL/Functional/TableGeneratorTest.php
index a6721b88f8d..9846bf70fa1 100644
--- a/tests/Doctrine/Tests/DBAL/Functional/TableGeneratorTest.php
+++ b/tests/Doctrine/Tests/DBAL/Functional/TableGeneratorTest.php
@@ -38,7 +38,7 @@ protected function setUp() : void
$this->generator = new TableGenerator($this->connection);
}
- public function testNextVal()
+ public function testNextVal() : void
{
$id1 = $this->generator->nextValue('tbl1');
$id2 = $this->generator->nextValue('tbl1');
@@ -49,7 +49,7 @@ public function testNextVal()
self::assertEquals($id1, $id3, 'First ids from different tables are equal.');
}
- public function testNextValNotAffectedByOuterTransactions()
+ public function testNextValNotAffectedByOuterTransactions() : void
{
$this->connection->beginTransaction();
$id1 = $this->generator->nextValue('tbl1');
diff --git a/tests/Doctrine/Tests/DBAL/Functional/TemporaryTableTest.php b/tests/Doctrine/Tests/DBAL/Functional/TemporaryTableTest.php
index 8dae876dc0c..e96fd426b3a 100644
--- a/tests/Doctrine/Tests/DBAL/Functional/TemporaryTableTest.php
+++ b/tests/Doctrine/Tests/DBAL/Functional/TemporaryTableTest.php
@@ -32,11 +32,9 @@ protected function tearDown() : void
}
/**
- * @return void
- *
* @group DDC-1337
*/
- public function testDropTemporaryTableNotAutoCommitTransaction()
+ public function testDropTemporaryTableNotAutoCommitTransaction() : void
{
if ($this->connection->getDatabasePlatform()->getName() === 'sqlanywhere' ||
$this->connection->getDatabasePlatform()->getName() === 'oracle') {
@@ -69,11 +67,9 @@ public function testDropTemporaryTableNotAutoCommitTransaction()
}
/**
- * @return void
- *
* @group DDC-1337
*/
- public function testCreateTemporaryTableNotAutoCommitTransaction()
+ public function testCreateTemporaryTableNotAutoCommitTransaction() : void
{
if ($this->connection->getDatabasePlatform()->getName() === 'sqlanywhere' ||
$this->connection->getDatabasePlatform()->getName() === 'oracle') {
diff --git a/tests/Doctrine/Tests/DBAL/Functional/Ticket/DBAL168Test.php b/tests/Doctrine/Tests/DBAL/Functional/Ticket/DBAL168Test.php
index b18b6cbdaf5..a3133635c0d 100644
--- a/tests/Doctrine/Tests/DBAL/Functional/Ticket/DBAL168Test.php
+++ b/tests/Doctrine/Tests/DBAL/Functional/Ticket/DBAL168Test.php
@@ -10,7 +10,7 @@
*/
class DBAL168Test extends DbalFunctionalTestCase
{
- public function testDomainsTable()
+ public function testDomainsTable() : void
{
if ($this->connection->getDatabasePlatform()->getName() !== 'postgresql') {
$this->markTestSkipped('PostgreSQL only test');
diff --git a/tests/Doctrine/Tests/DBAL/Functional/Ticket/DBAL202Test.php b/tests/Doctrine/Tests/DBAL/Functional/Ticket/DBAL202Test.php
index eeb9b7e24ed..da1fbcbd2f1 100644
--- a/tests/Doctrine/Tests/DBAL/Functional/Ticket/DBAL202Test.php
+++ b/tests/Doctrine/Tests/DBAL/Functional/Ticket/DBAL202Test.php
@@ -29,7 +29,7 @@ protected function setUp() : void
}
}
- public function testStatementRollback()
+ public function testStatementRollback() : void
{
$stmt = $this->connection->prepare('INSERT INTO DBAL202 VALUES (8)');
$this->connection->beginTransaction();
@@ -39,7 +39,7 @@ public function testStatementRollback()
self::assertEquals(0, $this->connection->query('SELECT COUNT(1) FROM DBAL202')->fetchColumn());
}
- public function testStatementCommit()
+ public function testStatementCommit() : void
{
$stmt = $this->connection->prepare('INSERT INTO DBAL202 VALUES (8)');
$this->connection->beginTransaction();
diff --git a/tests/Doctrine/Tests/DBAL/Functional/Ticket/DBAL421Test.php b/tests/Doctrine/Tests/DBAL/Functional/Ticket/DBAL421Test.php
index 6b77db02f0a..3ebd3a62f1f 100644
--- a/tests/Doctrine/Tests/DBAL/Functional/Ticket/DBAL421Test.php
+++ b/tests/Doctrine/Tests/DBAL/Functional/Ticket/DBAL421Test.php
@@ -23,7 +23,7 @@ protected function setUp() : void
$this->markTestSkipped('Currently restricted to MySQL and SQLite.');
}
- public function testGuidShouldMatchPattern()
+ public function testGuidShouldMatchPattern() : void
{
$guid = $this->connection->query($this->getSelectGuidSql())->fetchColumn();
$pattern = '/[0-9A-F]{8}\-[0-9A-F]{4}\-[0-9A-F]{4}\-[8-9A-B][0-9A-F]{3}\-[0-9A-F]{12}/i';
@@ -34,7 +34,7 @@ public function testGuidShouldMatchPattern()
* This test does (of course) not proof that all generated GUIDs are
* random, it should however provide some basic confidence.
*/
- public function testGuidShouldBeRandom()
+ public function testGuidShouldBeRandom() : void
{
$statement = $this->connection->prepare($this->getSelectGuidSql());
$guids = [];
@@ -49,7 +49,7 @@ public function testGuidShouldBeRandom()
$statement->closeCursor();
}
- private function getSelectGuidSql()
+ private function getSelectGuidSql() : string
{
return 'SELECT ' . $this->connection->getDatabasePlatform()->getGuidExpression();
}
diff --git a/tests/Doctrine/Tests/DBAL/Functional/Ticket/DBAL461Test.php b/tests/Doctrine/Tests/DBAL/Functional/Ticket/DBAL461Test.php
index a9dbdb1e109..e1c0927d852 100644
--- a/tests/Doctrine/Tests/DBAL/Functional/Ticket/DBAL461Test.php
+++ b/tests/Doctrine/Tests/DBAL/Functional/Ticket/DBAL461Test.php
@@ -14,7 +14,7 @@
*/
class DBAL461Test extends TestCase
{
- public function testIssue()
+ public function testIssue() : void
{
$conn = $this->createMock(Connection::class);
$platform = $this->getMockForAbstractClass(AbstractPlatform::class);
diff --git a/tests/Doctrine/Tests/DBAL/Functional/Ticket/DBAL510Test.php b/tests/Doctrine/Tests/DBAL/Functional/Ticket/DBAL510Test.php
index 620b0a66249..1b3008db65d 100644
--- a/tests/Doctrine/Tests/DBAL/Functional/Ticket/DBAL510Test.php
+++ b/tests/Doctrine/Tests/DBAL/Functional/Ticket/DBAL510Test.php
@@ -22,7 +22,7 @@ protected function setUp() : void
$this->markTestSkipped('PostgreSQL Only test');
}
- public function testSearchPathSchemaChanges()
+ public function testSearchPathSchemaChanges() : void
{
$table = new Table('dbal510tbl');
$table->addColumn('id', 'integer');
diff --git a/tests/Doctrine/Tests/DBAL/Functional/Ticket/DBAL630Test.php b/tests/Doctrine/Tests/DBAL/Functional/Ticket/DBAL630Test.php
index 21c6e492622..687e6e834a0 100644
--- a/tests/Doctrine/Tests/DBAL/Functional/Ticket/DBAL630Test.php
+++ b/tests/Doctrine/Tests/DBAL/Functional/Ticket/DBAL630Test.php
@@ -43,7 +43,7 @@ protected function tearDown() : void
parent::tearDown();
}
- public function testBooleanConversionSqlLiteral()
+ public function testBooleanConversionSqlLiteral() : void
{
$this->connection->executeUpdate('INSERT INTO dbal630 (bool_col) VALUES(false)');
$id = $this->connection->lastInsertId('dbal630_id_seq');
@@ -54,7 +54,7 @@ public function testBooleanConversionSqlLiteral()
self::assertFalse($row['bool_col']);
}
- public function testBooleanConversionBoolParamRealPrepares()
+ public function testBooleanConversionBoolParamRealPrepares() : void
{
$this->connection->executeUpdate(
'INSERT INTO dbal630 (bool_col) VALUES(?)',
@@ -69,7 +69,7 @@ public function testBooleanConversionBoolParamRealPrepares()
self::assertFalse($row['bool_col']);
}
- public function testBooleanConversionBoolParamEmulatedPrepares()
+ public function testBooleanConversionBoolParamEmulatedPrepares() : void
{
$this->connection->getWrappedConnection()->setAttribute(PDO::ATTR_EMULATE_PREPARES, true);
@@ -92,9 +92,9 @@ public function testBooleanConversionBoolParamEmulatedPrepares()
* @dataProvider booleanTypeConversionWithoutPdoTypeProvider
*/
public function testBooleanConversionNullParamEmulatedPrepares(
- $statementValue,
- $databaseConvertedValue
- ) {
+ ?bool $statementValue,
+ ?bool $databaseConvertedValue
+ ) : void {
$this->connection->getWrappedConnection()->setAttribute(PDO::ATTR_EMULATE_PREPARES, true);
$platform = $this->connection->getDatabasePlatform();
@@ -116,9 +116,9 @@ public function testBooleanConversionNullParamEmulatedPrepares(
* @dataProvider booleanTypeConversionUsingBooleanTypeProvider
*/
public function testBooleanConversionNullParamEmulatedPreparesWithBooleanTypeInBindValue(
- $statementValue,
- $databaseConvertedValue
- ) {
+ ?bool $statementValue,
+ bool $databaseConvertedValue
+ ) : void {
$this->connection->getWrappedConnection()->setAttribute(PDO::ATTR_EMULATE_PREPARES, true);
$platform = $this->connection->getDatabasePlatform();
@@ -145,7 +145,7 @@ public function testBooleanConversionNullParamEmulatedPreparesWithBooleanTypeInB
*
* @return mixed[][]
*/
- public function booleanTypeConversionUsingBooleanTypeProvider()
+ public static function booleanTypeConversionUsingBooleanTypeProvider() : iterable
{
return [
// statement value, database converted value result
@@ -160,7 +160,7 @@ public function booleanTypeConversionUsingBooleanTypeProvider()
*
* @return mixed[][]
*/
- public function booleanTypeConversionWithoutPdoTypeProvider()
+ public static function booleanTypeConversionWithoutPdoTypeProvider() : iterable
{
return [
// statement value, database converted value result
diff --git a/tests/Doctrine/Tests/DBAL/Functional/Ticket/DBAL752Test.php b/tests/Doctrine/Tests/DBAL/Functional/Ticket/DBAL752Test.php
index 3e087b21b36..47bc1c3e762 100644
--- a/tests/Doctrine/Tests/DBAL/Functional/Ticket/DBAL752Test.php
+++ b/tests/Doctrine/Tests/DBAL/Functional/Ticket/DBAL752Test.php
@@ -23,7 +23,7 @@ protected function setUp() : void
$this->markTestSkipped('Related to SQLite only');
}
- public function testUnsignedIntegerDetection()
+ public function testUnsignedIntegerDetection() : void
{
$this->connection->exec(<<dropAndCreateTable($table);
}
- public function testInsertAndSelect()
+ public function testInsertAndSelect() : void
{
$id1 = random_bytes(16);
$id2 = random_bytes(16);
@@ -70,6 +70,9 @@ private function insert(string $id, string $value) : void
self::assertSame(1, $result);
}
+ /**
+ * @return mixed
+ */
private function select(string $id)
{
$value = $this->connection->fetchColumn(
diff --git a/tests/Doctrine/Tests/DBAL/Functional/WriteTest.php b/tests/Doctrine/Tests/DBAL/Functional/WriteTest.php
index 52cef4d9fc2..b08751d5ec3 100644
--- a/tests/Doctrine/Tests/DBAL/Functional/WriteTest.php
+++ b/tests/Doctrine/Tests/DBAL/Functional/WriteTest.php
@@ -35,7 +35,7 @@ protected function setUp() : void
/**
* @group DBAL-80
*/
- public function testExecuteUpdateFirstTypeIsNull()
+ public function testExecuteUpdateFirstTypeIsNull() : void
{
$sql = 'INSERT INTO write_table (test_string, test_int) VALUES (?, ?)';
$this->connection->executeUpdate($sql, ['text', 1111], [null, ParameterType::INTEGER]);
@@ -44,7 +44,7 @@ public function testExecuteUpdateFirstTypeIsNull()
self::assertTrue((bool) $this->connection->fetchColumn($sql, ['text', 1111]));
}
- public function testExecuteUpdate()
+ public function testExecuteUpdate() : void
{
$sql = 'INSERT INTO write_table (test_int) VALUES ( ' . $this->connection->quote(1) . ')';
$affected = $this->connection->executeUpdate($sql);
@@ -52,7 +52,7 @@ public function testExecuteUpdate()
self::assertEquals(1, $affected, 'executeUpdate() should return the number of affected rows!');
}
- public function testExecuteUpdateWithTypes()
+ public function testExecuteUpdateWithTypes() : void
{
$sql = 'INSERT INTO write_table (test_int, test_string) VALUES (?, ?)';
$affected = $this->connection->executeUpdate(
@@ -64,7 +64,7 @@ public function testExecuteUpdateWithTypes()
self::assertEquals(1, $affected, 'executeUpdate() should return the number of affected rows!');
}
- public function testPrepareRowCountReturnsAffectedRows()
+ public function testPrepareRowCountReturnsAffectedRows() : void
{
$sql = 'INSERT INTO write_table (test_int, test_string) VALUES (?, ?)';
$stmt = $this->connection->prepare($sql);
@@ -76,7 +76,7 @@ public function testPrepareRowCountReturnsAffectedRows()
self::assertEquals(1, $stmt->rowCount());
}
- public function testPrepareWithPdoTypes()
+ public function testPrepareWithPdoTypes() : void
{
$sql = 'INSERT INTO write_table (test_int, test_string) VALUES (?, ?)';
$stmt = $this->connection->prepare($sql);
@@ -88,7 +88,7 @@ public function testPrepareWithPdoTypes()
self::assertEquals(1, $stmt->rowCount());
}
- public function testPrepareWithDbalTypes()
+ public function testPrepareWithDbalTypes() : void
{
$sql = 'INSERT INTO write_table (test_int, test_string) VALUES (?, ?)';
$stmt = $this->connection->prepare($sql);
@@ -100,7 +100,7 @@ public function testPrepareWithDbalTypes()
self::assertEquals(1, $stmt->rowCount());
}
- public function testPrepareWithDbalTypeNames()
+ public function testPrepareWithDbalTypeNames() : void
{
$sql = 'INSERT INTO write_table (test_int, test_string) VALUES (?, ?)';
$stmt = $this->connection->prepare($sql);
@@ -112,18 +112,18 @@ public function testPrepareWithDbalTypeNames()
self::assertEquals(1, $stmt->rowCount());
}
- public function insertRows()
+ public function insertRows() : void
{
self::assertEquals(1, $this->connection->insert('write_table', ['test_int' => 1, 'test_string' => 'foo']));
self::assertEquals(1, $this->connection->insert('write_table', ['test_int' => 2, 'test_string' => 'bar']));
}
- public function testInsert()
+ public function testInsert() : void
{
$this->insertRows();
}
- public function testDelete()
+ public function testDelete() : void
{
$this->insertRows();
@@ -134,7 +134,7 @@ public function testDelete()
self::assertCount(0, $this->connection->fetchAll('SELECT * FROM write_table'));
}
- public function testUpdate()
+ public function testUpdate() : void
{
$this->insertRows();
@@ -143,7 +143,7 @@ public function testUpdate()
self::assertEquals(0, $this->connection->update('write_table', ['test_string' => 'baz'], ['test_string' => 'bar']));
}
- public function testLastInsertId()
+ public function testLastInsertId() : void
{
if (! $this->connection->getDatabasePlatform()->prefersIdentityColumns()) {
$this->markTestSkipped('Test only works on platforms with identity columns.');
@@ -156,7 +156,7 @@ public function testLastInsertId()
self::assertGreaterThan(0, $num, 'LastInsertId() should be non-negative number.');
}
- public function testLastInsertIdSequence()
+ public function testLastInsertIdSequence() : void
{
if (! $this->connection->getDatabasePlatform()->supportsSequences()) {
$this->markTestSkipped('Test only works on platforms with sequences.');
@@ -182,7 +182,7 @@ public function testLastInsertIdSequence()
self::assertEquals($nextSequenceVal, $lastInsertId);
}
- public function testLastInsertIdNoSequenceGiven()
+ public function testLastInsertIdNoSequenceGiven() : void
{
if (! $this->connection->getDatabasePlatform()->supportsSequences() || $this->connection->getDatabasePlatform()->supportsIdentityColumns()) {
$this->markTestSkipped("Test only works consistently on platforms that support sequences and don't support identity columns.");
@@ -194,7 +194,7 @@ public function testLastInsertIdNoSequenceGiven()
/**
* @group DBAL-445
*/
- public function testInsertWithKeyValueTypes()
+ public function testInsertWithKeyValueTypes() : void
{
$testString = new DateTime('2013-04-14 10:10:10');
@@ -212,7 +212,7 @@ public function testInsertWithKeyValueTypes()
/**
* @group DBAL-445
*/
- public function testUpdateWithKeyValueTypes()
+ public function testUpdateWithKeyValueTypes() : void
{
$testString = new DateTime('2013-04-14 10:10:10');
@@ -239,7 +239,7 @@ public function testUpdateWithKeyValueTypes()
/**
* @group DBAL-445
*/
- public function testDeleteWithKeyValueTypes()
+ public function testDeleteWithKeyValueTypes() : void
{
$val = new DateTime('2013-04-14 10:10:10');
$this->connection->insert(
@@ -255,7 +255,7 @@ public function testDeleteWithKeyValueTypes()
self::assertFalse($data);
}
- public function testEmptyIdentityInsert()
+ public function testEmptyIdentityInsert() : void
{
$platform = $this->connection->getDatabasePlatform();
@@ -298,7 +298,7 @@ public function testEmptyIdentityInsert()
/**
* @group DBAL-2688
*/
- public function testUpdateWhereIsNull()
+ public function testUpdateWhereIsNull() : void
{
$this->connection->insert(
'write_table',
@@ -317,7 +317,7 @@ public function testUpdateWhereIsNull()
self::assertCount(0, $data);
}
- public function testDeleteWhereIsNull()
+ public function testDeleteWhereIsNull() : void
{
$this->connection->insert(
'write_table',
@@ -340,7 +340,7 @@ public function testDeleteWhereIsNull()
* Returns the ID of the last inserted row or skips the test if the currently used driver
* doesn't support this feature
*
- * @return string
+ * @return string|false
*
* @throws DriverException
*/
diff --git a/tests/Doctrine/Tests/DBAL/Logging/DebugStackTest.php b/tests/Doctrine/Tests/DBAL/Logging/DebugStackTest.php
index c2239639f26..26b5a959350 100644
--- a/tests/Doctrine/Tests/DBAL/Logging/DebugStackTest.php
+++ b/tests/Doctrine/Tests/DBAL/Logging/DebugStackTest.php
@@ -20,7 +20,7 @@ protected function tearDown() : void
unset($this->logger);
}
- public function testLoggedQuery()
+ public function testLoggedQuery() : void
{
$this->logger->startQuery('SELECT column FROM table');
self::assertEquals(
@@ -39,7 +39,7 @@ public function testLoggedQuery()
self::assertGreaterThan(0, $this->logger->queries[1]['executionMS']);
}
- public function testLoggedQueryDisabled()
+ public function testLoggedQueryDisabled() : void
{
$this->logger->enabled = false;
$this->logger->startQuery('SELECT column FROM table');
diff --git a/tests/Doctrine/Tests/DBAL/Performance/TypeConversionPerformanceTest.php b/tests/Doctrine/Tests/DBAL/Performance/TypeConversionPerformanceTest.php
index a0bf8936f50..6a76e90f897 100644
--- a/tests/Doctrine/Tests/DBAL/Performance/TypeConversionPerformanceTest.php
+++ b/tests/Doctrine/Tests/DBAL/Performance/TypeConversionPerformanceTest.php
@@ -17,7 +17,7 @@ class TypeConversionPerformanceTest extends DbalPerformanceTestCase
*
* @dataProvider itemCountProvider
*/
- public function testDateTimeTypeConversionPerformance($count)
+ public function testDateTimeTypeConversionPerformance(int $count) : void
{
$value = new DateTime();
$type = Type::getType('datetime');
@@ -29,7 +29,10 @@ public function testDateTimeTypeConversionPerformance($count)
$this->stopTiming();
}
- public function itemCountProvider()
+ /**
+ * @return mixed[][]
+ */
+ public static function itemCountProvider() : iterable
{
return [
'100 items' => [100],
diff --git a/tests/Doctrine/Tests/DBAL/Platforms/AbstractMySQLPlatformTestCase.php b/tests/Doctrine/Tests/DBAL/Platforms/AbstractMySQLPlatformTestCase.php
index ea6a6ffe59e..bc71767a766 100644
--- a/tests/Doctrine/Tests/DBAL/Platforms/AbstractMySQLPlatformTestCase.php
+++ b/tests/Doctrine/Tests/DBAL/Platforms/AbstractMySQLPlatformTestCase.php
@@ -3,7 +3,6 @@
namespace Doctrine\Tests\DBAL\Platforms;
use Doctrine\DBAL\Platforms\AbstractPlatform;
-use Doctrine\DBAL\Platforms\MySqlPlatform;
use Doctrine\DBAL\Schema\Comparator;
use Doctrine\DBAL\Schema\ForeignKeyConstraint;
use Doctrine\DBAL\Schema\Index;
@@ -17,13 +16,13 @@ abstract class AbstractMySQLPlatformTestCase extends AbstractPlatformTestCase
/** @var MySqlPlatform */
protected $platform;
- public function testModifyLimitQueryWitoutLimit()
+ public function testModifyLimitQueryWitoutLimit() : void
{
$sql = $this->platform->modifyLimitQuery('SELECT n FROM Foo', null, 10);
self::assertEquals('SELECT n FROM Foo LIMIT 18446744073709551615 OFFSET 10', $sql);
}
- public function testGenerateMixedCaseTableCreate()
+ public function testGenerateMixedCaseTableCreate() : void
{
$table = new Table('Foo');
$table->addColumn('Bar', 'integer');
@@ -32,29 +31,35 @@ public function testGenerateMixedCaseTableCreate()
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()
+ public function getGenerateTableSql() : string
{
return 'CREATE TABLE test (id INT AUTO_INCREMENT NOT NULL, test VARCHAR(255) DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB';
}
- public function getGenerateTableWithMultiColumnUniqueIndexSql()
+ /**
+ * @return string[]
+ */
+ public function getGenerateTableWithMultiColumnUniqueIndexSql() : array
{
return ['CREATE TABLE test (foo VARCHAR(255) DEFAULT NULL, bar VARCHAR(255) DEFAULT NULL, UNIQUE INDEX UNIQ_D87F7E0C8C73652176FF8CAA (foo, bar)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB'];
}
- public function getGenerateAlterTableSql()
+ /**
+ * {@inheritDoc}
+ */
+ public function getGenerateAlterTableSql() : array
{
return ["ALTER TABLE mytable RENAME TO userlist, ADD quota INT DEFAULT NULL, DROP foo, CHANGE bar baz VARCHAR(255) DEFAULT 'def' NOT NULL, CHANGE bloo bloo TINYINT(1) DEFAULT '0' NOT NULL"];
}
- public function testGeneratesSqlSnippets()
+ public function testGeneratesSqlSnippets() : void
{
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()
+ public function testGeneratesTransactionsCommands() : void
{
self::assertEquals(
'SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED',
@@ -75,7 +80,7 @@ public function testGeneratesTransactionsCommands()
);
}
- public function testGeneratesDDLSnippets()
+ public function testGeneratesDDLSnippets() : void
{
self::assertEquals('SHOW DATABASES', $this->platform->getListDatabasesSQL());
self::assertEquals('CREATE DATABASE foobar', $this->platform->getCreateDatabaseSQL('foobar'));
@@ -83,7 +88,7 @@ public function testGeneratesDDLSnippets()
self::assertEquals('DROP TABLE foobar', $this->platform->getDropTableSQL('foobar'));
}
- public function testGeneratesTypeDeclarationForIntegers()
+ public function testGeneratesTypeDeclarationForIntegers() : void
{
self::assertEquals(
'INT',
@@ -101,7 +106,7 @@ public function testGeneratesTypeDeclarationForIntegers()
);
}
- public function testGeneratesTypeDeclarationForStrings()
+ public function testGeneratesTypeDeclarationForStrings() : void
{
self::assertEquals(
'CHAR(10)',
@@ -121,32 +126,32 @@ public function testGeneratesTypeDeclarationForStrings()
);
}
- public function testPrefersIdentityColumns()
+ public function testPrefersIdentityColumns() : void
{
self::assertTrue($this->platform->prefersIdentityColumns());
}
- public function testSupportsIdentityColumns()
+ public function testSupportsIdentityColumns() : void
{
self::assertTrue($this->platform->supportsIdentityColumns());
}
- public function testDoesSupportSavePoints()
+ public function testDoesSupportSavePoints() : void
{
self::assertTrue($this->platform->supportsSavepoints());
}
- public function getGenerateIndexSql()
+ public function getGenerateIndexSql() : string
{
return 'CREATE INDEX my_idx ON mytable (user_name, last_login)';
}
- public function getGenerateUniqueIndexSql()
+ public function getGenerateUniqueIndexSql() : string
{
return 'CREATE UNIQUE INDEX index_name ON test (test, test2)';
}
- public function getGenerateForeignKeySql()
+ public function getGenerateForeignKeySql() : string
{
return 'ALTER TABLE test ADD FOREIGN KEY (fk_name_id) REFERENCES other_table (id)';
}
@@ -154,7 +159,7 @@ public function getGenerateForeignKeySql()
/**
* @group DBAL-126
*/
- public function testUniquePrimaryKey()
+ public function testUniquePrimaryKey() : void
{
$keyTable = new Table('foo');
$keyTable->addColumn('bar', 'integer');
@@ -177,13 +182,13 @@ public function testUniquePrimaryKey()
], $sql);
}
- public function testModifyLimitQuery()
+ public function testModifyLimitQuery() : void
{
$sql = $this->platform->modifyLimitQuery('SELECT * FROM user', 10, 0);
self::assertEquals('SELECT * FROM user LIMIT 10', $sql);
}
- public function testModifyLimitQueryWithEmptyOffset()
+ public function testModifyLimitQueryWithEmptyOffset() : void
{
$sql = $this->platform->modifyLimitQuery('SELECT * FROM user', 10);
self::assertEquals('SELECT * FROM user LIMIT 10', $sql);
@@ -192,24 +197,33 @@ public function testModifyLimitQueryWithEmptyOffset()
/**
* @group DDC-118
*/
- public function testGetDateTimeTypeDeclarationSql()
+ public function testGetDateTimeTypeDeclarationSql() : void
{
self::assertEquals('DATETIME', $this->platform->getDateTimeTypeDeclarationSQL(['version' => false]));
self::assertEquals('TIMESTAMP', $this->platform->getDateTimeTypeDeclarationSQL(['version' => true]));
self::assertEquals('DATETIME', $this->platform->getDateTimeTypeDeclarationSQL([]));
}
- public function getCreateTableColumnCommentsSQL()
+ /**
+ * {@inheritDoc}
+ */
+ public function getCreateTableColumnCommentsSQL() : array
{
return ["CREATE TABLE test (id INT NOT NULL COMMENT 'This is a comment', PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB"];
}
- public function getAlterTableColumnCommentsSQL()
+ /**
+ * {@inheritDoc}
+ */
+ public function getAlterTableColumnCommentsSQL() : array
{
return ["ALTER TABLE mytable ADD quota INT NOT NULL COMMENT 'A comment', CHANGE foo foo VARCHAR(255) NOT NULL, CHANGE bar baz VARCHAR(255) NOT NULL COMMENT 'B comment'"];
}
- public function getCreateTableColumnTypeCommentsSQL()
+ /**
+ * {@inheritDoc}
+ */
+ public function getCreateTableColumnTypeCommentsSQL() : array
{
return ["CREATE TABLE test (id INT NOT NULL, data LONGTEXT NOT NULL COMMENT '(DC2Type:array)', PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB"];
}
@@ -217,7 +231,7 @@ public function getCreateTableColumnTypeCommentsSQL()
/**
* @group DBAL-237
*/
- public function testChangeIndexWithForeignKeys()
+ public function testChangeIndexWithForeignKeys() : void
{
$index = new Index('idx', ['col'], false);
$unique = new Index('uniq', ['col'], true);
@@ -231,22 +245,34 @@ public function testChangeIndexWithForeignKeys()
self::assertEquals(['ALTER TABLE test DROP INDEX uniq, ADD INDEX idx (col)'], $sql);
}
- protected function getQuotedColumnInPrimaryKeySQL()
+ /**
+ * @return string[]
+ */
+ protected function getQuotedColumnInPrimaryKeySQL() : array
{
return ['CREATE TABLE `quoted` (`create` VARCHAR(255) NOT NULL, PRIMARY KEY(`create`)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB'];
}
- protected function getQuotedColumnInIndexSQL()
+ /**
+ * @return string[]
+ */
+ protected function getQuotedColumnInIndexSQL() : array
{
return ['CREATE TABLE `quoted` (`create` VARCHAR(255) NOT NULL, INDEX IDX_22660D028FD6E0FB (`create`)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB'];
}
- protected function getQuotedNameInIndexSQL()
+ /**
+ * @return string[]
+ */
+ protected function getQuotedNameInIndexSQL() : array
{
return ['CREATE TABLE test (column1 VARCHAR(255) NOT NULL, INDEX `key` (column1)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB'];
}
- protected function getQuotedColumnInForeignKeySQL()
+ /**
+ * @return string[]
+ */
+ protected function getQuotedColumnInForeignKeySQL() : array
{
return [
'CREATE TABLE `quoted` (`create` VARCHAR(255) NOT NULL, foo VARCHAR(255) NOT NULL, `bar` VARCHAR(255) NOT NULL) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB',
@@ -256,7 +282,7 @@ protected function getQuotedColumnInForeignKeySQL()
];
}
- public function testCreateTableWithFulltextIndex()
+ public function testCreateTableWithFulltextIndex() : void
{
$table = new Table('fulltext_table');
$table->addOption('engine', 'MyISAM');
@@ -270,7 +296,7 @@ public function testCreateTableWithFulltextIndex()
self::assertEquals(['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()
+ public function testCreateTableWithSpatialIndex() : void
{
$table = new Table('spatial_table');
$table->addOption('engine', 'MyISAM');
@@ -284,7 +310,7 @@ public function testCreateTableWithSpatialIndex()
self::assertEquals(['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()
+ public function testClobTypeDeclarationSQL() : void
{
self::assertEquals('TINYTEXT', $this->platform->getClobTypeDeclarationSQL(['length' => 1]));
self::assertEquals('TINYTEXT', $this->platform->getClobTypeDeclarationSQL(['length' => 255]));
@@ -296,7 +322,7 @@ public function testClobTypeDeclarationSQL()
self::assertEquals('LONGTEXT', $this->platform->getClobTypeDeclarationSQL([]));
}
- public function testBlobTypeDeclarationSQL()
+ public function testBlobTypeDeclarationSQL() : void
{
self::assertEquals('TINYBLOB', $this->platform->getBlobTypeDeclarationSQL(['length' => 1]));
self::assertEquals('TINYBLOB', $this->platform->getBlobTypeDeclarationSQL(['length' => 255]));
@@ -311,7 +337,7 @@ public function testBlobTypeDeclarationSQL()
/**
* @group DBAL-400
*/
- public function testAlterTableAddPrimaryKey()
+ public function testAlterTableAddPrimaryKey() : void
{
$table = new Table('alter_table_add_pk');
$table->addColumn('id', 'integer');
@@ -333,7 +359,7 @@ public function testAlterTableAddPrimaryKey()
/**
* @group DBAL-1132
*/
- public function testAlterPrimaryKeyWithAutoincrementColumn()
+ public function testAlterPrimaryKeyWithAutoincrementColumn() : void
{
$table = new Table('alter_primary_key');
$table->addColumn('id', 'integer', ['autoincrement' => true]);
@@ -359,7 +385,7 @@ public function testAlterPrimaryKeyWithAutoincrementColumn()
/**
* @group DBAL-464
*/
- public function testDropPrimaryKeyWithAutoincrementColumn()
+ public function testDropPrimaryKeyWithAutoincrementColumn() : void
{
$table = new Table('drop_primary_key');
$table->addColumn('id', 'integer', ['autoincrement' => true]);
@@ -384,7 +410,7 @@ public function testDropPrimaryKeyWithAutoincrementColumn()
/**
* @group DBAL-2302
*/
- public function testDropNonAutoincrementColumnFromCompositePrimaryKeyWithAutoincrementColumn()
+ public function testDropNonAutoincrementColumnFromCompositePrimaryKeyWithAutoincrementColumn() : void
{
$table = new Table('tbl');
$table->addColumn('id', 'integer', ['autoincrement' => true]);
@@ -411,7 +437,7 @@ public function testDropNonAutoincrementColumnFromCompositePrimaryKeyWithAutoinc
/**
* @group DBAL-2302
*/
- public function testAddNonAutoincrementColumnToPrimaryKeyWithAutoincrementColumn()
+ public function testAddNonAutoincrementColumnToPrimaryKeyWithAutoincrementColumn() : void
{
$table = new Table('tbl');
$table->addColumn('id', 'integer', ['autoincrement' => true]);
@@ -438,7 +464,7 @@ public function testAddNonAutoincrementColumnToPrimaryKeyWithAutoincrementColumn
/**
* @group DBAL-586
*/
- public function testAddAutoIncrementPrimaryKey()
+ public function testAddAutoIncrementPrimaryKey() : void
{
$keyTable = new Table('foo');
$keyTable->addColumn('id', 'integer', ['autoincrement' => true]);
@@ -456,7 +482,7 @@ public function testAddAutoIncrementPrimaryKey()
self::assertEquals(['ALTER TABLE foo ADD id INT AUTO_INCREMENT NOT NULL, ADD PRIMARY KEY (id)'], $sql);
}
- public function testNamedPrimaryKey()
+ public function testNamedPrimaryKey() : void
{
$diff = new TableDiff('mytable');
$diff->changedIndexes['foo_index'] = new Index('foo_index', ['foo'], true, true);
@@ -469,7 +495,7 @@ public function testNamedPrimaryKey()
], $sql);
}
- public function testAlterPrimaryKeyWithNewColumn()
+ public function testAlterPrimaryKeyWithNewColumn() : void
{
$table = new Table('yolo');
$table->addColumn('pkc1', 'integer');
@@ -493,7 +519,7 @@ public function testAlterPrimaryKeyWithNewColumn()
);
}
- public function testInitializesDoctrineTypeMappings()
+ public function testInitializesDoctrineTypeMappings() : void
{
self::assertTrue($this->platform->hasDoctrineTypeMappingFor('binary'));
self::assertSame('binary', $this->platform->getDoctrineTypeMapping('binary'));
@@ -502,12 +528,12 @@ public function testInitializesDoctrineTypeMappings()
self::assertSame('binary', $this->platform->getDoctrineTypeMapping('varbinary'));
}
- protected function getBinaryMaxLength()
+ protected function getBinaryMaxLength() : int
{
return 65535;
}
- public function testReturnsBinaryTypeDeclarationSQL()
+ public function testReturnsBinaryTypeDeclarationSQL() : void
{
self::assertSame('VARBINARY(255)', $this->platform->getBinaryTypeDeclarationSQL([]));
self::assertSame('VARBINARY(255)', $this->platform->getBinaryTypeDeclarationSQL(['length' => 0]));
@@ -524,7 +550,7 @@ public function testReturnsBinaryTypeDeclarationSQL()
* @expectedDeprecation Binary field length 16777215 is greater than supported by the platform (65535). Reduce the field length or use a BLOB field instead.
* @expectedDeprecation Binary field length 16777216 is greater than supported by the platform (65535). Reduce the field length or use a BLOB field instead.
*/
- public function testReturnsBinaryTypeLongerThanMaxDeclarationSQL()
+ public function testReturnsBinaryTypeLongerThanMaxDeclarationSQL() : void
{
self::assertSame('MEDIUMBLOB', $this->platform->getBinaryTypeDeclarationSQL(['length' => 65536]));
self::assertSame('MEDIUMBLOB', $this->platform->getBinaryTypeDeclarationSQL(['length' => 16777215]));
@@ -535,7 +561,7 @@ public function testReturnsBinaryTypeLongerThanMaxDeclarationSQL()
self::assertSame('LONGBLOB', $this->platform->getBinaryTypeDeclarationSQL(['fixed' => true, 'length' => 16777216]));
}
- public function testDoesNotPropagateForeignKeyCreationForNonSupportingEngines()
+ public function testDoesNotPropagateForeignKeyCreationForNonSupportingEngines() : void
{
$table = new Table('foreign_table');
$table->addColumn('id', 'integer');
@@ -567,7 +593,7 @@ public function testDoesNotPropagateForeignKeyCreationForNonSupportingEngines()
);
}
- public function testDoesNotPropagateForeignKeyAlterationForNonSupportingEngines()
+ public function testDoesNotPropagateForeignKeyAlterationForNonSupportingEngines() : void
{
$table = new Table('foreign_table');
$table->addColumn('id', 'integer');
@@ -608,9 +634,11 @@ public function testDoesNotPropagateForeignKeyAlterationForNonSupportingEngines(
}
/**
+ * @return string[]
+ *
* @group DBAL-234
*/
- protected function getAlterTableRenameIndexSQL()
+ protected function getAlterTableRenameIndexSQL() : array
{
return [
'DROP INDEX idx_foo ON mytable',
@@ -619,9 +647,11 @@ protected function getAlterTableRenameIndexSQL()
}
/**
+ * @return string[]
+ *
* @group DBAL-234
*/
- protected function getQuotedAlterTableRenameIndexSQL()
+ protected function getQuotedAlterTableRenameIndexSQL() : array
{
return [
'DROP INDEX `create` ON `table`',
@@ -632,9 +662,11 @@ protected function getQuotedAlterTableRenameIndexSQL()
}
/**
+ * @return string[]
+ *
* @group DBAL-807
*/
- protected function getAlterTableRenameIndexInSchemaSQL()
+ protected function getAlterTableRenameIndexInSchemaSQL() : array
{
return [
'DROP INDEX idx_foo ON myschema.mytable',
@@ -643,9 +675,11 @@ protected function getAlterTableRenameIndexInSchemaSQL()
}
/**
+ * @return string[]
+ *
* @group DBAL-807
*/
- protected function getQuotedAlterTableRenameIndexInSchemaSQL()
+ protected function getQuotedAlterTableRenameIndexInSchemaSQL() : array
{
return [
'DROP INDEX `create` ON `schema`.`table`',
@@ -655,17 +689,17 @@ protected function getQuotedAlterTableRenameIndexInSchemaSQL()
];
}
- protected function getQuotesDropForeignKeySQL()
+ protected function getQuotesDropForeignKeySQL() : string
{
return 'ALTER TABLE `table` DROP FOREIGN KEY `select`';
}
- protected function getQuotesDropConstraintSQL()
+ protected function getQuotesDropConstraintSQL() : string
{
return 'ALTER TABLE `table` DROP CONSTRAINT `select`';
}
- public function testDoesNotPropagateDefaultValuesForUnsupportedColumnTypes()
+ public function testDoesNotPropagateDefaultValuesForUnsupportedColumnTypes() : void
{
$table = new Table('text_blob_default_value');
$table->addColumn('def_text', 'text', ['default' => 'def']);
@@ -692,7 +726,7 @@ public function testDoesNotPropagateDefaultValuesForUnsupportedColumnTypes()
/**
* {@inheritdoc}
*/
- protected function getQuotedAlterTableRenameColumnSQL()
+ protected function getQuotedAlterTableRenameColumnSQL() : array
{
return ['ALTER TABLE mytable ' .
"CHANGE unquoted1 unquoted INT NOT NULL COMMENT 'Unquoted 1', " .
@@ -710,7 +744,7 @@ protected function getQuotedAlterTableRenameColumnSQL()
/**
* {@inheritdoc}
*/
- protected function getQuotedAlterTableChangeColumnLengthSQL()
+ protected function getQuotedAlterTableChangeColumnLengthSQL() : array
{
return ['ALTER TABLE mytable ' .
"CHANGE unquoted1 unquoted1 VARCHAR(255) NOT NULL COMMENT 'Unquoted 1', " .
@@ -725,7 +759,7 @@ protected function getQuotedAlterTableChangeColumnLengthSQL()
/**
* @group DBAL-423
*/
- public function testReturnsGuidTypeDeclarationSQL()
+ public function testReturnsGuidTypeDeclarationSQL() : void
{
self::assertSame('CHAR(36)', $this->platform->getGuidTypeDeclarationSQL([]));
}
@@ -733,7 +767,7 @@ public function testReturnsGuidTypeDeclarationSQL()
/**
* {@inheritdoc}
*/
- public function getAlterTableRenameColumnSQL()
+ public function getAlterTableRenameColumnSQL() : array
{
return ["ALTER TABLE foo CHANGE bar baz INT DEFAULT 666 NOT NULL COMMENT 'rename test'"];
}
@@ -741,7 +775,7 @@ public function getAlterTableRenameColumnSQL()
/**
* {@inheritdoc}
*/
- protected function getQuotesTableIdentifiersInAlterTableSQL()
+ protected function getQuotesTableIdentifiersInAlterTableSQL() : array
{
return [
'ALTER TABLE `foo` DROP FOREIGN KEY fk1',
@@ -756,7 +790,7 @@ protected function getQuotesTableIdentifiersInAlterTableSQL()
/**
* {@inheritdoc}
*/
- protected function getCommentOnColumnSQL()
+ protected function getCommentOnColumnSQL() : array
{
return [
"COMMENT ON COLUMN foo.bar IS 'comment'",
@@ -768,7 +802,7 @@ protected function getCommentOnColumnSQL()
/**
* {@inheritdoc}
*/
- protected function getQuotesReservedKeywordInUniqueConstraintDeclarationSQL()
+ protected function getQuotesReservedKeywordInUniqueConstraintDeclarationSQL() : string
{
return 'CONSTRAINT `select` UNIQUE (foo)';
}
@@ -776,7 +810,7 @@ protected function getQuotesReservedKeywordInUniqueConstraintDeclarationSQL()
/**
* {@inheritdoc}
*/
- protected function getQuotesReservedKeywordInIndexDeclarationSQL()
+ protected function getQuotesReservedKeywordInIndexDeclarationSQL() : string
{
return 'INDEX `select` (foo)';
}
@@ -784,7 +818,7 @@ protected function getQuotesReservedKeywordInIndexDeclarationSQL()
/**
* {@inheritdoc}
*/
- protected function getQuotesReservedKeywordInTruncateTableSQL()
+ protected function getQuotesReservedKeywordInTruncateTableSQL() : string
{
return 'TRUNCATE `select`';
}
@@ -792,7 +826,7 @@ protected function getQuotesReservedKeywordInTruncateTableSQL()
/**
* {@inheritdoc}
*/
- protected function getAlterStringToFixedStringSQL()
+ protected function getAlterStringToFixedStringSQL() : array
{
return ['ALTER TABLE mytable CHANGE name name CHAR(2) NOT NULL'];
}
@@ -800,7 +834,7 @@ protected function getAlterStringToFixedStringSQL()
/**
* {@inheritdoc}
*/
- protected function getGeneratesAlterTableRenameIndexUsedByForeignKeySQL()
+ protected function getGeneratesAlterTableRenameIndexUsedByForeignKeySQL() : array
{
return [
'ALTER TABLE mytable DROP FOREIGN KEY fk_foo',
@@ -813,7 +847,7 @@ protected function getGeneratesAlterTableRenameIndexUsedByForeignKeySQL()
/**
* {@inheritdoc}
*/
- public function getGeneratesDecimalTypeDeclarationSQL()
+ public static function getGeneratesDecimalTypeDeclarationSQL() : iterable
{
return [
[[], 'NUMERIC(10, 0)'],
@@ -828,7 +862,7 @@ public function getGeneratesDecimalTypeDeclarationSQL()
/**
* {@inheritdoc}
*/
- public function getGeneratesFloatDeclarationSQL()
+ public static function getGeneratesFloatDeclarationSQL() : iterable
{
return [
[[], 'DOUBLE PRECISION'],
@@ -843,7 +877,7 @@ public function getGeneratesFloatDeclarationSQL()
/**
* @group DBAL-2436
*/
- public function testQuotesTableNameInListTableIndexesSQL()
+ public function testQuotesTableNameInListTableIndexesSQL() : void
{
self::assertStringContainsStringIgnoringCase(
"'Foo''Bar\\\\'",
@@ -854,7 +888,7 @@ public function testQuotesTableNameInListTableIndexesSQL()
/**
* @group DBAL-2436
*/
- public function testQuotesDatabaseNameInListTableIndexesSQL()
+ public function testQuotesDatabaseNameInListTableIndexesSQL() : void
{
self::assertStringContainsStringIgnoringCase(
"'Foo''Bar\\\\'",
@@ -865,7 +899,7 @@ public function testQuotesDatabaseNameInListTableIndexesSQL()
/**
* @group DBAL-2436
*/
- public function testQuotesDatabaseNameInListViewsSQL()
+ public function testQuotesDatabaseNameInListViewsSQL() : void
{
self::assertStringContainsStringIgnoringCase(
"'Foo''Bar\\\\'",
@@ -876,7 +910,7 @@ public function testQuotesDatabaseNameInListViewsSQL()
/**
* @group DBAL-2436
*/
- public function testQuotesTableNameInListTableForeignKeysSQL()
+ public function testQuotesTableNameInListTableForeignKeysSQL() : void
{
self::assertStringContainsStringIgnoringCase(
"'Foo''Bar\\\\'",
@@ -887,7 +921,7 @@ public function testQuotesTableNameInListTableForeignKeysSQL()
/**
* @group DBAL-2436
*/
- public function testQuotesDatabaseNameInListTableForeignKeysSQL()
+ public function testQuotesDatabaseNameInListTableForeignKeysSQL() : void
{
self::assertStringContainsStringIgnoringCase(
"'Foo''Bar\\\\'",
@@ -898,7 +932,7 @@ public function testQuotesDatabaseNameInListTableForeignKeysSQL()
/**
* @group DBAL-2436
*/
- public function testQuotesTableNameInListTableColumnsSQL()
+ public function testQuotesTableNameInListTableColumnsSQL() : void
{
self::assertStringContainsStringIgnoringCase(
"'Foo''Bar\\\\'",
@@ -909,7 +943,7 @@ public function testQuotesTableNameInListTableColumnsSQL()
/**
* @group DBAL-2436
*/
- public function testQuotesDatabaseNameInListTableColumnsSQL()
+ public function testQuotesDatabaseNameInListTableColumnsSQL() : void
{
self::assertStringContainsStringIgnoringCase(
"'Foo''Bar\\\\'",
@@ -917,7 +951,7 @@ public function testQuotesDatabaseNameInListTableColumnsSQL()
);
}
- public function testListTableForeignKeysSQLEvaluatesDatabase()
+ public function testListTableForeignKeysSQLEvaluatesDatabase() : void
{
$sql = $this->platform->getListTableForeignKeysSQL('foo');
diff --git a/tests/Doctrine/Tests/DBAL/Platforms/AbstractPlatformTestCase.php b/tests/Doctrine/Tests/DBAL/Platforms/AbstractPlatformTestCase.php
index 910f2daa2c1..0c44d42a7b4 100644
--- a/tests/Doctrine/Tests/DBAL/Platforms/AbstractPlatformTestCase.php
+++ b/tests/Doctrine/Tests/DBAL/Platforms/AbstractPlatformTestCase.php
@@ -27,7 +27,7 @@ abstract class AbstractPlatformTestCase extends DbalTestCase
/** @var AbstractPlatform */
protected $platform;
- abstract public function createPlatform();
+ abstract public function createPlatform() : AbstractPlatform;
protected function setUp() : void
{
@@ -37,7 +37,7 @@ protected function setUp() : void
/**
* @group DDC-1360
*/
- public function testQuoteIdentifier()
+ public function testQuoteIdentifier() : void
{
if ($this->platform->getName() === 'mssql') {
$this->markTestSkipped('Not working this way on mssql.');
@@ -52,7 +52,7 @@ public function testQuoteIdentifier()
/**
* @group DDC-1360
*/
- public function testQuoteSingleIdentifier()
+ public function testQuoteSingleIdentifier() : void
{
if ($this->platform->getName() === 'mssql') {
$this->markTestSkipped('Not working this way on mssql.');
@@ -68,15 +68,15 @@ public function testQuoteSingleIdentifier()
* @group DBAL-1029
* @dataProvider getReturnsForeignKeyReferentialActionSQL
*/
- public function testReturnsForeignKeyReferentialActionSQL($action, $expectedSQL)
+ public function testReturnsForeignKeyReferentialActionSQL(string $action, string $expectedSQL) : void
{
self::assertSame($expectedSQL, $this->platform->getForeignKeyReferentialActionSQL($action));
}
/**
- * @return string[][]
+ * @return mixed[][]
*/
- public function getReturnsForeignKeyReferentialActionSQL()
+ public static function getReturnsForeignKeyReferentialActionSQL() : iterable
{
return [
['CASCADE', 'CASCADE'],
@@ -88,25 +88,25 @@ public function getReturnsForeignKeyReferentialActionSQL()
];
}
- public function testGetInvalidForeignKeyReferentialActionSQL()
+ public function testGetInvalidForeignKeyReferentialActionSQL() : void
{
$this->expectException('InvalidArgumentException');
$this->platform->getForeignKeyReferentialActionSQL('unknown');
}
- public function testGetUnknownDoctrineMappingType()
+ public function testGetUnknownDoctrineMappingType() : void
{
$this->expectException(DBALException::class);
$this->platform->getDoctrineTypeMapping('foobar');
}
- public function testRegisterDoctrineMappingType()
+ public function testRegisterDoctrineMappingType() : void
{
$this->platform->registerDoctrineTypeMapping('foo', 'integer');
self::assertEquals('integer', $this->platform->getDoctrineTypeMapping('foo'));
}
- public function testRegisterUnknownDoctrineMappingType()
+ public function testRegisterUnknownDoctrineMappingType() : void
{
$this->expectException(DBALException::class);
$this->platform->registerDoctrineTypeMapping('foo', 'bar');
@@ -115,7 +115,7 @@ public function testRegisterUnknownDoctrineMappingType()
/**
* @group DBAL-2594
*/
- public function testRegistersCommentedDoctrineMappingTypeImplicitly()
+ public function testRegistersCommentedDoctrineMappingTypeImplicitly() : void
{
if (! Type::hasType('my_commented')) {
Type::addType('my_commented', CommentedType::class);
@@ -131,12 +131,15 @@ public function testRegistersCommentedDoctrineMappingTypeImplicitly()
* @group DBAL-939
* @dataProvider getIsCommentedDoctrineType
*/
- public function testIsCommentedDoctrineType(Type $type, $commented)
+ public function testIsCommentedDoctrineType(Type $type, bool $commented) : void
{
self::assertSame($commented, $this->platform->isCommentedDoctrineType($type));
}
- public function getIsCommentedDoctrineType()
+ /**
+ * @return mixed[]
+ */
+ public function getIsCommentedDoctrineType() : iterable
{
$this->setUp();
@@ -154,7 +157,7 @@ public function getIsCommentedDoctrineType()
return $data;
}
- public function testCreateWithNoColumns()
+ public function testCreateWithNoColumns() : void
{
$table = new Table('test');
@@ -162,7 +165,7 @@ public function testCreateWithNoColumns()
$sql = $this->platform->getCreateTableSQL($table);
}
- public function testGeneratesTableCreationSql()
+ public function testGeneratesTableCreationSql() : void
{
$table = new Table('test');
$table->addColumn('id', 'integer', ['notnull' => true, 'autoincrement' => true]);
@@ -173,9 +176,9 @@ public function testGeneratesTableCreationSql()
self::assertEquals($this->getGenerateTableSql(), $sql[0]);
}
- abstract public function getGenerateTableSql();
+ abstract public function getGenerateTableSql() : string;
- public function testGenerateTableWithMultiColumnUniqueIndex()
+ public function testGenerateTableWithMultiColumnUniqueIndex() : void
{
$table = new Table('test');
$table->addColumn('foo', 'string', ['notnull' => false, 'length' => 255]);
@@ -186,9 +189,12 @@ public function testGenerateTableWithMultiColumnUniqueIndex()
self::assertEquals($this->getGenerateTableWithMultiColumnUniqueIndexSql(), $sql);
}
- abstract public function getGenerateTableWithMultiColumnUniqueIndexSql();
+ /**
+ * @return string[]
+ */
+ abstract public function getGenerateTableWithMultiColumnUniqueIndexSql() : array;
- public function testGeneratesIndexCreationSql()
+ public function testGeneratesIndexCreationSql() : void
{
$indexDef = new Index('my_idx', ['user_name', 'last_login']);
@@ -198,9 +204,9 @@ public function testGeneratesIndexCreationSql()
);
}
- abstract public function getGenerateIndexSql();
+ abstract public function getGenerateIndexSql() : string;
- public function testGeneratesUniqueIndexCreationSql()
+ public function testGeneratesUniqueIndexCreationSql() : void
{
$indexDef = new Index('index_name', ['test', 'test2'], true);
@@ -208,9 +214,9 @@ public function testGeneratesUniqueIndexCreationSql()
self::assertEquals($this->getGenerateUniqueIndexSql(), $sql);
}
- abstract public function getGenerateUniqueIndexSql();
+ abstract public function getGenerateUniqueIndexSql() : string;
- public function testGeneratesPartialIndexesSqlOnlyWhenSupportingPartialIndexes()
+ public function testGeneratesPartialIndexesSqlOnlyWhenSupportingPartialIndexes() : void
{
$where = 'test IS NULL AND test2 IS NOT NULL';
$indexDef = new Index('name', ['test', 'test2'], false, false, [], ['where' => $where]);
@@ -236,7 +242,7 @@ public function testGeneratesPartialIndexesSqlOnlyWhenSupportingPartialIndexes()
}
}
- public function testGeneratesForeignKeyCreationSql()
+ public function testGeneratesForeignKeyCreationSql() : void
{
$fk = new ForeignKeyConstraint(['fk_name_id'], 'other_table', ['id'], '');
@@ -244,9 +250,9 @@ public function testGeneratesForeignKeyCreationSql()
self::assertEquals($sql, $this->getGenerateForeignKeySql());
}
- abstract public function getGenerateForeignKeySql();
+ abstract public function getGenerateForeignKeySql() : string;
- public function testGeneratesConstraintCreationSql()
+ public function testGeneratesConstraintCreationSql() : void
{
$idx = new Index('constraint_name', ['test'], true, false);
$sql = $this->platform->getCreateConstraintSQL($idx, 'test');
@@ -261,7 +267,7 @@ public function testGeneratesConstraintCreationSql()
self::assertEquals($this->getGenerateConstraintForeignKeySql($fk), $sql);
}
- public function testGeneratesForeignKeySqlOnlyWhenSupportingForeignKeys()
+ public function testGeneratesForeignKeySqlOnlyWhenSupportingForeignKeys() : void
{
$fk = new ForeignKeyConstraint(['fk_name'], 'foreign', ['id'], 'constraint_fk');
@@ -273,7 +279,7 @@ public function testGeneratesForeignKeySqlOnlyWhenSupportingForeignKeys()
}
}
- protected function getBitAndComparisonExpressionSql($value1, $value2)
+ protected function getBitAndComparisonExpressionSql(string $value1, string $value2) : string
{
return '(' . $value1 . ' & ' . $value2 . ')';
}
@@ -281,13 +287,13 @@ protected function getBitAndComparisonExpressionSql($value1, $value2)
/**
* @group DDC-1213
*/
- public function testGeneratesBitAndComparisonExpressionSql()
+ public function testGeneratesBitAndComparisonExpressionSql() : void
{
$sql = $this->platform->getBitAndComparisonExpression(2, 4);
self::assertEquals($this->getBitAndComparisonExpressionSql(2, 4), $sql);
}
- protected function getBitOrComparisonExpressionSql($value1, $value2)
+ protected function getBitOrComparisonExpressionSql(string $value1, string $value2) : string
{
return '(' . $value1 . ' | ' . $value2 . ')';
}
@@ -295,23 +301,23 @@ protected function getBitOrComparisonExpressionSql($value1, $value2)
/**
* @group DDC-1213
*/
- public function testGeneratesBitOrComparisonExpressionSql()
+ public function testGeneratesBitOrComparisonExpressionSql() : void
{
$sql = $this->platform->getBitOrComparisonExpression(2, 4);
self::assertEquals($this->getBitOrComparisonExpressionSql(2, 4), $sql);
}
- public function getGenerateConstraintUniqueIndexSql()
+ public function getGenerateConstraintUniqueIndexSql() : string
{
return 'ALTER TABLE test ADD CONSTRAINT constraint_name UNIQUE (test)';
}
- public function getGenerateConstraintPrimaryIndexSql()
+ public function getGenerateConstraintPrimaryIndexSql() : string
{
return 'ALTER TABLE test ADD CONSTRAINT constraint_name PRIMARY KEY (test)';
}
- public function getGenerateConstraintForeignKeySql(ForeignKeyConstraint $fk)
+ public function getGenerateConstraintForeignKeySql(ForeignKeyConstraint $fk) : string
{
$quotedForeignTable = $fk->getQuotedForeignTableName($this->platform);
@@ -321,9 +327,12 @@ public function getGenerateConstraintForeignKeySql(ForeignKeyConstraint $fk)
);
}
- abstract public function getGenerateAlterTableSql();
+ /**
+ * @return string[]
+ */
+ abstract public function getGenerateAlterTableSql() : array;
- public function testGeneratesTableAlterationSql()
+ public function testGeneratesTableAlterationSql() : void
{
$expectedSql = $this->getGenerateAlterTableSql();
@@ -363,13 +372,13 @@ public function testGeneratesTableAlterationSql()
self::assertEquals($expectedSql, $sql);
}
- public function testGetCustomColumnDeclarationSql()
+ public function testGetCustomColumnDeclarationSql() : void
{
$field = ['columnDefinition' => 'MEDIUMINT(6) UNSIGNED'];
self::assertEquals('foo MEDIUMINT(6) UNSIGNED', $this->platform->getColumnDeclarationSQL('foo', $field));
}
- public function testGetCreateTableSqlDispatchEvent()
+ public function testGetCreateTableSqlDispatchEvent() : void
{
$listenerMock = $this->getMockBuilder('GetCreateTableSqlDispatchEvenListener')
->setMethods(['onSchemaCreateTable', 'onSchemaCreateTableColumn'])
@@ -393,7 +402,7 @@ public function testGetCreateTableSqlDispatchEvent()
$this->platform->getCreateTableSQL($table);
}
- public function testGetDropTableSqlDispatchEvent()
+ public function testGetDropTableSqlDispatchEvent() : void
{
$listenerMock = $this->getMockBuilder('GetDropTableSqlDispatchEventListener')
->setMethods(['onSchemaDropTable'])
@@ -410,7 +419,7 @@ public function testGetDropTableSqlDispatchEvent()
$this->platform->getDropTableSQL('TABLE');
}
- public function testGetAlterTableSqlDispatchEvent()
+ public function testGetAlterTableSqlDispatchEvent() : void
{
$events = [
'onSchemaAlterTable',
@@ -477,7 +486,7 @@ public function testGetAlterTableSqlDispatchEvent()
/**
* @group DBAL-42
*/
- public function testCreateTableColumnComments()
+ public function testCreateTableColumnComments() : void
{
$table = new Table('test');
$table->addColumn('id', 'integer', ['comment' => 'This is a comment']);
@@ -489,7 +498,7 @@ public function testCreateTableColumnComments()
/**
* @group DBAL-42
*/
- public function testAlterTableColumnComments()
+ public function testAlterTableColumnComments() : void
{
$tableDiff = new TableDiff('mytable');
$tableDiff->addedColumns['quota'] = new Column('quota', Type::getType('integer'), ['comment' => 'A comment']);
@@ -514,7 +523,7 @@ public function testAlterTableColumnComments()
self::assertEquals($this->getAlterTableColumnCommentsSQL(), $this->platform->getAlterTableSQL($tableDiff));
}
- public function testCreateTableColumnTypeComments()
+ public function testCreateTableColumnTypeComments() : void
{
$table = new Table('test');
$table->addColumn('id', 'integer');
@@ -524,22 +533,31 @@ public function testCreateTableColumnTypeComments()
self::assertEquals($this->getCreateTableColumnTypeCommentsSQL(), $this->platform->getCreateTableSQL($table));
}
- public function getCreateTableColumnCommentsSQL()
+ /**
+ * @return string[]
+ */
+ public function getCreateTableColumnCommentsSQL() : array
{
$this->markTestSkipped('Platform does not support Column comments.');
}
- public function getAlterTableColumnCommentsSQL()
+ /**
+ * @return string[]
+ */
+ public function getAlterTableColumnCommentsSQL() : array
{
$this->markTestSkipped('Platform does not support Column comments.');
}
- public function getCreateTableColumnTypeCommentsSQL()
+ /**
+ * @return string[]
+ */
+ public function getCreateTableColumnTypeCommentsSQL() : array
{
$this->markTestSkipped('Platform does not support Column comments.');
}
- public function testGetDefaultValueDeclarationSQL()
+ public function testGetDefaultValueDeclarationSQL() : void
{
// non-timestamp value will get single quotes
$field = [
@@ -569,7 +587,7 @@ public function testGetDefaultValueDeclarationSQLDateTime() : void
}
}
- public function testGetDefaultValueDeclarationSQLForIntegerTypes()
+ public function testGetDefaultValueDeclarationSQLForIntegerTypes() : void
{
foreach (['bigint', 'integer', 'smallint'] as $type) {
$field = [
@@ -606,7 +624,7 @@ public function testGetDefaultValueDeclarationSQLForDateType() : void
/**
* @group DBAL-45
*/
- public function testKeywordList()
+ public function testKeywordList() : void
{
$keywordList = $this->platform->getReservedKeywordsList();
self::assertInstanceOf(KeywordList::class, $keywordList);
@@ -617,7 +635,7 @@ public function testKeywordList()
/**
* @group DBAL-374
*/
- public function testQuotedColumnInPrimaryKeyPropagation()
+ public function testQuotedColumnInPrimaryKeyPropagation() : void
{
$table = new Table('`quoted`');
$table->addColumn('create', 'string');
@@ -627,18 +645,30 @@ public function testQuotedColumnInPrimaryKeyPropagation()
self::assertEquals($this->getQuotedColumnInPrimaryKeySQL(), $sql);
}
- abstract protected function getQuotedColumnInPrimaryKeySQL();
+ /**
+ * @return string[]
+ */
+ abstract protected function getQuotedColumnInPrimaryKeySQL() : array;
- abstract protected function getQuotedColumnInIndexSQL();
+ /**
+ * @return string[]
+ */
+ abstract protected function getQuotedColumnInIndexSQL() : array;
- abstract protected function getQuotedNameInIndexSQL();
+ /**
+ * @return string[]
+ */
+ abstract protected function getQuotedNameInIndexSQL() : array;
- abstract protected function getQuotedColumnInForeignKeySQL();
+ /**
+ * @return string[]
+ */
+ abstract protected function getQuotedColumnInForeignKeySQL() : array;
/**
* @group DBAL-374
*/
- public function testQuotedColumnInIndexPropagation()
+ public function testQuotedColumnInIndexPropagation() : void
{
$table = new Table('`quoted`');
$table->addColumn('create', 'string');
@@ -648,7 +678,7 @@ public function testQuotedColumnInIndexPropagation()
self::assertEquals($this->getQuotedColumnInIndexSQL(), $sql);
}
- public function testQuotedNameInIndexSQL()
+ public function testQuotedNameInIndexSQL() : void
{
$table = new Table('test');
$table->addColumn('column1', 'string');
@@ -661,7 +691,7 @@ public function testQuotedNameInIndexSQL()
/**
* @group DBAL-374
*/
- public function testQuotedColumnInForeignKeyPropagation()
+ public function testQuotedColumnInForeignKeyPropagation() : void
{
$table = new Table('`quoted`');
$table->addColumn('create', 'string');
@@ -699,7 +729,7 @@ public function testQuotedColumnInForeignKeyPropagation()
/**
* @group DBAL-1051
*/
- public function testQuotesReservedKeywordInUniqueConstraintDeclarationSQL()
+ public function testQuotesReservedKeywordInUniqueConstraintDeclarationSQL() : void
{
$index = new Index('select', ['foo'], true);
@@ -709,15 +739,12 @@ public function testQuotesReservedKeywordInUniqueConstraintDeclarationSQL()
);
}
- /**
- * @return string
- */
- abstract protected function getQuotesReservedKeywordInUniqueConstraintDeclarationSQL();
+ abstract protected function getQuotesReservedKeywordInUniqueConstraintDeclarationSQL() : string;
/**
* @group DBAL-2270
*/
- public function testQuotesReservedKeywordInTruncateTableSQL()
+ public function testQuotesReservedKeywordInTruncateTableSQL() : void
{
self::assertSame(
$this->getQuotesReservedKeywordInTruncateTableSQL(),
@@ -725,15 +752,12 @@ public function testQuotesReservedKeywordInTruncateTableSQL()
);
}
- /**
- * @return string
- */
- abstract protected function getQuotesReservedKeywordInTruncateTableSQL();
+ abstract protected function getQuotesReservedKeywordInTruncateTableSQL() : string;
/**
* @group DBAL-1051
*/
- public function testQuotesReservedKeywordInIndexDeclarationSQL()
+ public function testQuotesReservedKeywordInIndexDeclarationSQL() : void
{
$index = new Index('select', ['foo']);
@@ -747,33 +771,24 @@ public function testQuotesReservedKeywordInIndexDeclarationSQL()
);
}
- /**
- * @return string
- */
- abstract protected function getQuotesReservedKeywordInIndexDeclarationSQL();
+ abstract protected function getQuotesReservedKeywordInIndexDeclarationSQL() : string;
- /**
- * @return bool
- */
- protected function supportsInlineIndexDeclaration()
+ protected function supportsInlineIndexDeclaration() : bool
{
return true;
}
- public function testSupportsCommentOnStatement()
+ public function testSupportsCommentOnStatement() : void
{
self::assertSame($this->supportsCommentOnStatement(), $this->platform->supportsCommentOnStatement());
}
- /**
- * @return bool
- */
- protected function supportsCommentOnStatement()
+ protected function supportsCommentOnStatement() : bool
{
return false;
}
- public function testGetCreateSchemaSQL()
+ public function testGetCreateSchemaSQL() : void
{
$this->expectException(DBALException::class);
@@ -783,7 +798,7 @@ public function testGetCreateSchemaSQL()
/**
* @group DBAL-585
*/
- public function testAlterTableChangeQuotedColumn()
+ public function testAlterTableChangeQuotedColumn() : void
{
$tableDiff = new TableDiff('mytable');
$tableDiff->fromTable = new Table('mytable');
@@ -805,7 +820,7 @@ public function testAlterTableChangeQuotedColumn()
/**
* @group DBAL-563
*/
- public function testUsesSequenceEmulatedIdentityColumns()
+ public function testUsesSequenceEmulatedIdentityColumns() : void
{
self::assertFalse($this->platform->usesSequenceEmulatedIdentityColumns());
}
@@ -813,41 +828,41 @@ public function testUsesSequenceEmulatedIdentityColumns()
/**
* @group DBAL-563
*/
- public function testReturnsIdentitySequenceName()
+ public function testReturnsIdentitySequenceName() : void
{
$this->expectException(DBALException::class);
$this->platform->getIdentitySequenceName('mytable', 'mycolumn');
}
- public function testReturnsBinaryDefaultLength()
+ public function testReturnsBinaryDefaultLength() : void
{
self::assertSame($this->getBinaryDefaultLength(), $this->platform->getBinaryDefaultLength());
}
- protected function getBinaryDefaultLength()
+ protected function getBinaryDefaultLength() : int
{
return 255;
}
- public function testReturnsBinaryMaxLength()
+ public function testReturnsBinaryMaxLength() : void
{
self::assertSame($this->getBinaryMaxLength(), $this->platform->getBinaryMaxLength());
}
- protected function getBinaryMaxLength()
+ protected function getBinaryMaxLength() : int
{
return 4000;
}
- public function testReturnsBinaryTypeDeclarationSQL()
+ public function testReturnsBinaryTypeDeclarationSQL() : void
{
$this->expectException(DBALException::class);
$this->platform->getBinaryTypeDeclarationSQL([]);
}
- public function testReturnsBinaryTypeLongerThanMaxDeclarationSQL()
+ public function testReturnsBinaryTypeLongerThanMaxDeclarationSQL() : void
{
$this->markTestSkipped('Not applicable to the platform');
}
@@ -855,7 +870,7 @@ public function testReturnsBinaryTypeLongerThanMaxDeclarationSQL()
/**
* @group DBAL-553
*/
- public function hasNativeJsonType()
+ public function hasNativeJsonType() : void
{
self::assertFalse($this->platform->hasNativeJsonType());
}
@@ -863,7 +878,7 @@ public function hasNativeJsonType()
/**
* @group DBAL-553
*/
- public function testReturnsJsonTypeDeclarationSQL()
+ public function testReturnsJsonTypeDeclarationSQL() : void
{
$column = [
'length' => 666,
@@ -880,7 +895,7 @@ public function testReturnsJsonTypeDeclarationSQL()
/**
* @group DBAL-234
*/
- public function testAlterTableRenameIndex()
+ public function testAlterTableRenameIndex() : void
{
$tableDiff = new TableDiff('mytable');
$tableDiff->fromTable = new Table('mytable');
@@ -897,9 +912,11 @@ public function testAlterTableRenameIndex()
}
/**
+ * @return string[]
+ *
* @group DBAL-234
*/
- protected function getAlterTableRenameIndexSQL()
+ protected function getAlterTableRenameIndexSQL() : array
{
return [
'DROP INDEX idx_foo',
@@ -910,7 +927,7 @@ protected function getAlterTableRenameIndexSQL()
/**
* @group DBAL-234
*/
- public function testQuotesAlterTableRenameIndex()
+ public function testQuotesAlterTableRenameIndex() : void
{
$tableDiff = new TableDiff('table');
$tableDiff->fromTable = new Table('table');
@@ -928,9 +945,11 @@ public function testQuotesAlterTableRenameIndex()
}
/**
+ * @return string[]
+ *
* @group DBAL-234
*/
- protected function getQuotedAlterTableRenameIndexSQL()
+ protected function getQuotedAlterTableRenameIndexSQL() : array
{
return [
'DROP INDEX "create"',
@@ -943,7 +962,7 @@ protected function getQuotedAlterTableRenameIndexSQL()
/**
* @group DBAL-835
*/
- public function testQuotesAlterTableRenameColumn()
+ public function testQuotesAlterTableRenameColumn() : void
{
$fromTable = new Table('mytable');
@@ -988,12 +1007,12 @@ public function testQuotesAlterTableRenameColumn()
*
* @group DBAL-835
*/
- abstract protected function getQuotedAlterTableRenameColumnSQL();
+ abstract protected function getQuotedAlterTableRenameColumnSQL() : array;
/**
* @group DBAL-835
*/
- public function testQuotesAlterTableChangeColumnLength()
+ public function testQuotesAlterTableChangeColumnLength() : void
{
$fromTable = new Table('mytable');
@@ -1030,12 +1049,12 @@ public function testQuotesAlterTableChangeColumnLength()
*
* @group DBAL-835
*/
- abstract protected function getQuotedAlterTableChangeColumnLengthSQL();
+ abstract protected function getQuotedAlterTableChangeColumnLengthSQL() : array;
/**
* @group DBAL-807
*/
- public function testAlterTableRenameIndexInSchema()
+ public function testAlterTableRenameIndexInSchema() : void
{
$tableDiff = new TableDiff('myschema.mytable');
$tableDiff->fromTable = new Table('myschema.mytable');
@@ -1052,9 +1071,11 @@ public function testAlterTableRenameIndexInSchema()
}
/**
+ * @return string[]
+ *
* @group DBAL-807
*/
- protected function getAlterTableRenameIndexInSchemaSQL()
+ protected function getAlterTableRenameIndexInSchemaSQL() : array
{
return [
'DROP INDEX idx_foo',
@@ -1065,7 +1086,7 @@ protected function getAlterTableRenameIndexInSchemaSQL()
/**
* @group DBAL-807
*/
- public function testQuotesAlterTableRenameIndexInSchema()
+ public function testQuotesAlterTableRenameIndexInSchema() : void
{
$tableDiff = new TableDiff('`schema`.table');
$tableDiff->fromTable = new Table('`schema`.table');
@@ -1083,9 +1104,11 @@ public function testQuotesAlterTableRenameIndexInSchema()
}
/**
+ * @return string[]
+ *
* @group DBAL-234
*/
- protected function getQuotedAlterTableRenameIndexInSchemaSQL()
+ protected function getQuotedAlterTableRenameIndexInSchemaSQL() : array
{
return [
'DROP INDEX "schema"."create"',
@@ -1098,7 +1121,7 @@ protected function getQuotedAlterTableRenameIndexInSchemaSQL()
/**
* @group DBAL-1237
*/
- public function testQuotesDropForeignKeySQL()
+ public function testQuotesDropForeignKeySQL() : void
{
if (! $this->platform->supportsForeignKeyConstraints()) {
$this->markTestSkipped(
@@ -1116,7 +1139,7 @@ public function testQuotesDropForeignKeySQL()
self::assertSame($expectedSql, $this->platform->getDropForeignKeySQL($foreignKey, $table));
}
- protected function getQuotesDropForeignKeySQL()
+ protected function getQuotesDropForeignKeySQL() : string
{
return 'ALTER TABLE "table" DROP FOREIGN KEY "select"';
}
@@ -1124,7 +1147,7 @@ protected function getQuotesDropForeignKeySQL()
/**
* @group DBAL-1237
*/
- public function testQuotesDropConstraintSQL()
+ public function testQuotesDropConstraintSQL() : void
{
$tableName = 'table';
$table = new Table($tableName);
@@ -1136,27 +1159,27 @@ public function testQuotesDropConstraintSQL()
self::assertSame($expectedSql, $this->platform->getDropConstraintSQL($constraint, $table));
}
- protected function getQuotesDropConstraintSQL()
+ protected function getQuotesDropConstraintSQL() : string
{
return 'ALTER TABLE "table" DROP CONSTRAINT "select"';
}
- protected function getStringLiteralQuoteCharacter()
+ protected function getStringLiteralQuoteCharacter() : string
{
return "'";
}
- public function testGetStringLiteralQuoteCharacter()
+ public function testGetStringLiteralQuoteCharacter() : void
{
self::assertSame($this->getStringLiteralQuoteCharacter(), $this->platform->getStringLiteralQuoteCharacter());
}
- protected function getQuotedCommentOnColumnSQLWithoutQuoteCharacter()
+ protected function getQuotedCommentOnColumnSQLWithoutQuoteCharacter() : string
{
return "COMMENT ON COLUMN mytable.id IS 'This is a comment'";
}
- public function testGetCommentOnColumnSQLWithoutQuoteCharacter()
+ public function testGetCommentOnColumnSQLWithoutQuoteCharacter() : void
{
self::assertEquals(
$this->getQuotedCommentOnColumnSQLWithoutQuoteCharacter(),
@@ -1164,12 +1187,12 @@ public function testGetCommentOnColumnSQLWithoutQuoteCharacter()
);
}
- protected function getQuotedCommentOnColumnSQLWithQuoteCharacter()
+ protected function getQuotedCommentOnColumnSQLWithQuoteCharacter() : string
{
return "COMMENT ON COLUMN mytable.id IS 'It''s a quote !'";
}
- public function testGetCommentOnColumnSQLWithQuoteCharacter()
+ public function testGetCommentOnColumnSQLWithQuoteCharacter() : void
{
$c = $this->getStringLiteralQuoteCharacter();
@@ -1184,12 +1207,12 @@ public function testGetCommentOnColumnSQLWithQuoteCharacter()
*
* @return string[]
*/
- abstract protected function getCommentOnColumnSQL();
+ abstract protected function getCommentOnColumnSQL() : array;
/**
* @group DBAL-1004
*/
- public function testGetCommentOnColumnSQL()
+ public function testGetCommentOnColumnSQL() : void
{
self::assertSame(
$this->getCommentOnColumnSQL(),
@@ -1205,7 +1228,7 @@ public function testGetCommentOnColumnSQL()
* @group DBAL-1176
* @dataProvider getGeneratesInlineColumnCommentSQL
*/
- public function testGeneratesInlineColumnCommentSQL($comment, $expectedSql)
+ public function testGeneratesInlineColumnCommentSQL(?string $comment, string $expectedSql) : void
{
if (! $this->platform->supportsInlineColumnComments()) {
$this->markTestSkipped(sprintf('%s does not support inline column comments.', get_class($this->platform)));
@@ -1214,52 +1237,55 @@ public function testGeneratesInlineColumnCommentSQL($comment, $expectedSql)
self::assertSame($expectedSql, $this->platform->getInlineColumnCommentSQL($comment));
}
- public function getGeneratesInlineColumnCommentSQL()
+ /**
+ * @return mixed[][]
+ */
+ public static function getGeneratesInlineColumnCommentSQL() : iterable
{
return [
- 'regular comment' => ['Regular comment', $this->getInlineColumnRegularCommentSQL()],
+ 'regular comment' => ['Regular comment', static::getInlineColumnRegularCommentSQL()],
'comment requiring escaping' => [
sprintf(
'Using inline comment delimiter %s works',
- $this->getInlineColumnCommentDelimiter()
+ static::getInlineColumnCommentDelimiter()
),
- $this->getInlineColumnCommentRequiringEscapingSQL(),
+ static::getInlineColumnCommentRequiringEscapingSQL(),
],
- 'empty comment' => ['', $this->getInlineColumnEmptyCommentSQL()],
+ 'empty comment' => ['', static::getInlineColumnEmptyCommentSQL()],
];
}
- protected function getInlineColumnCommentDelimiter()
+ protected static function getInlineColumnCommentDelimiter() : string
{
return "'";
}
- protected function getInlineColumnRegularCommentSQL()
+ protected static function getInlineColumnRegularCommentSQL() : string
{
return "COMMENT 'Regular comment'";
}
- protected function getInlineColumnCommentRequiringEscapingSQL()
+ protected static function getInlineColumnCommentRequiringEscapingSQL() : string
{
return "COMMENT 'Using inline comment delimiter '' works'";
}
- protected function getInlineColumnEmptyCommentSQL()
+ protected static function getInlineColumnEmptyCommentSQL() : string
{
return "COMMENT ''";
}
- protected function getQuotedStringLiteralWithoutQuoteCharacter()
+ protected function getQuotedStringLiteralWithoutQuoteCharacter() : string
{
return "'No quote'";
}
- protected function getQuotedStringLiteralWithQuoteCharacter()
+ protected function getQuotedStringLiteralWithQuoteCharacter() : string
{
return "'It''s a quote'";
}
- protected function getQuotedStringLiteralQuoteCharacter()
+ protected function getQuotedStringLiteralQuoteCharacter() : string
{
return "''''";
}
@@ -1267,7 +1293,7 @@ protected function getQuotedStringLiteralQuoteCharacter()
/**
* @group DBAL-1176
*/
- public function testThrowsExceptionOnGeneratingInlineColumnCommentSQLIfUnsupported()
+ public function testThrowsExceptionOnGeneratingInlineColumnCommentSQLIfUnsupported() : void
{
if ($this->platform->supportsInlineColumnComments()) {
$this->markTestSkipped(sprintf('%s supports inline column comments.', get_class($this->platform)));
@@ -1280,7 +1306,7 @@ public function testThrowsExceptionOnGeneratingInlineColumnCommentSQLIfUnsupport
$this->platform->getInlineColumnCommentSQL('unsupported');
}
- public function testQuoteStringLiteral()
+ public function testQuoteStringLiteral() : void
{
$c = $this->getStringLiteralQuoteCharacter();
@@ -1301,7 +1327,7 @@ public function testQuoteStringLiteral()
/**
* @group DBAL-423
*/
- public function testReturnsGuidTypeDeclarationSQL()
+ public function testReturnsGuidTypeDeclarationSQL() : void
{
$this->expectException(DBALException::class);
@@ -1311,7 +1337,7 @@ public function testReturnsGuidTypeDeclarationSQL()
/**
* @group DBAL-1010
*/
- public function testGeneratesAlterTableRenameColumnSQL()
+ public function testGeneratesAlterTableRenameColumnSQL() : void
{
$table = new Table('foo');
$table->addColumn(
@@ -1334,12 +1360,12 @@ public function testGeneratesAlterTableRenameColumnSQL()
/**
* @return string[]
*/
- abstract public function getAlterTableRenameColumnSQL();
+ abstract public function getAlterTableRenameColumnSQL() : array;
/**
* @group DBAL-1016
*/
- public function testQuotesTableIdentifiersInAlterTableSQL()
+ public function testQuotesTableIdentifiersInAlterTableSQL() : void
{
$table = new Table('"foo"');
$table->addColumn('id', 'integer');
@@ -1376,12 +1402,12 @@ public function testQuotesTableIdentifiersInAlterTableSQL()
/**
* @return string[]
*/
- abstract protected function getQuotesTableIdentifiersInAlterTableSQL();
+ abstract protected function getQuotesTableIdentifiersInAlterTableSQL() : array;
/**
* @group DBAL-1090
*/
- public function testAlterStringToFixedString()
+ public function testAlterStringToFixedString() : void
{
$table = new Table('mytable');
$table->addColumn('name', 'string', ['length' => 2]);
@@ -1409,12 +1435,12 @@ public function testAlterStringToFixedString()
/**
* @return string[]
*/
- abstract protected function getAlterStringToFixedStringSQL();
+ abstract protected function getAlterStringToFixedStringSQL() : array;
/**
* @group DBAL-1062
*/
- public function testGeneratesAlterTableRenameIndexUsedByForeignKeySQL()
+ public function testGeneratesAlterTableRenameIndexUsedByForeignKeySQL() : void
{
$foreignTable = new Table('foreign_table');
$foreignTable->addColumn('id', 'integer');
@@ -1442,7 +1468,7 @@ public function testGeneratesAlterTableRenameIndexUsedByForeignKeySQL()
/**
* @return string[]
*/
- abstract protected function getGeneratesAlterTableRenameIndexUsedByForeignKeySQL();
+ abstract protected function getGeneratesAlterTableRenameIndexUsedByForeignKeySQL() : array;
/**
* @param mixed[] $column
@@ -1450,15 +1476,15 @@ abstract protected function getGeneratesAlterTableRenameIndexUsedByForeignKeySQL
* @group DBAL-1082
* @dataProvider getGeneratesDecimalTypeDeclarationSQL
*/
- public function testGeneratesDecimalTypeDeclarationSQL(array $column, $expectedSql)
+ public function testGeneratesDecimalTypeDeclarationSQL(array $column, string $expectedSql) : void
{
self::assertSame($expectedSql, $this->platform->getDecimalTypeDeclarationSQL($column));
}
/**
- * @return mixed[]
+ * @return mixed[][]
*/
- public function getGeneratesDecimalTypeDeclarationSQL()
+ public static function getGeneratesDecimalTypeDeclarationSQL() : iterable
{
return [
[[], 'NUMERIC(10, 0)'],
@@ -1476,15 +1502,15 @@ public function getGeneratesDecimalTypeDeclarationSQL()
* @group DBAL-1082
* @dataProvider getGeneratesFloatDeclarationSQL
*/
- public function testGeneratesFloatDeclarationSQL(array $column, $expectedSql)
+ public function testGeneratesFloatDeclarationSQL(array $column, string $expectedSql) : void
{
self::assertSame($expectedSql, $this->platform->getFloatDeclarationSQL($column));
}
/**
- * @return mixed[]
+ * @return mixed[][]
*/
- public function getGeneratesFloatDeclarationSQL()
+ public static function getGeneratesFloatDeclarationSQL() : iterable
{
return [
[[], 'DOUBLE PRECISION'],
diff --git a/tests/Doctrine/Tests/DBAL/Platforms/AbstractPostgreSqlPlatformTestCase.php b/tests/Doctrine/Tests/DBAL/Platforms/AbstractPostgreSqlPlatformTestCase.php
index 81d760e30b6..44c28018849 100644
--- a/tests/Doctrine/Tests/DBAL/Platforms/AbstractPostgreSqlPlatformTestCase.php
+++ b/tests/Doctrine/Tests/DBAL/Platforms/AbstractPostgreSqlPlatformTestCase.php
@@ -16,12 +16,15 @@
abstract class AbstractPostgreSqlPlatformTestCase extends AbstractPlatformTestCase
{
- public function getGenerateTableSql()
+ public function getGenerateTableSql() : string
{
return 'CREATE TABLE test (id SERIAL NOT NULL, test VARCHAR(255) DEFAULT NULL, PRIMARY KEY(id))';
}
- public function getGenerateTableWithMultiColumnUniqueIndexSql()
+ /**
+ * {@inheritDoc}
+ */
+ public function getGenerateTableWithMultiColumnUniqueIndexSql() : array
{
return [
'CREATE TABLE test (foo VARCHAR(255) DEFAULT NULL, bar VARCHAR(255) DEFAULT NULL)',
@@ -29,7 +32,10 @@ public function getGenerateTableWithMultiColumnUniqueIndexSql()
];
}
- public function getGenerateAlterTableSql()
+ /**
+ * {@inheritDoc}
+ */
+ public function getGenerateAlterTableSql() : array
{
return [
'ALTER TABLE mytable ADD quota INT DEFAULT NULL',
@@ -44,17 +50,17 @@ public function getGenerateAlterTableSql()
];
}
- public function getGenerateIndexSql()
+ public function getGenerateIndexSql() : string
{
return 'CREATE INDEX my_idx ON mytable (user_name, last_login)';
}
- public function getGenerateForeignKeySql()
+ public function getGenerateForeignKeySql() : string
{
return 'ALTER TABLE test ADD FOREIGN KEY (fk_name_id) REFERENCES other_table (id) NOT DEFERRABLE INITIALLY IMMEDIATE';
}
- public function testGeneratesForeignKeySqlForNonStandardOptions()
+ public function testGeneratesForeignKeySqlForNonStandardOptions() : void
{
$foreignKey = new ForeignKeyConstraint(
['foreign_id'],
@@ -129,7 +135,7 @@ public function testGeneratesForeignKeySqlForNonStandardOptions()
);
}
- public function testGeneratesSqlSnippets()
+ public function testGeneratesSqlSnippets() : void
{
self::assertEquals('SIMILAR TO', $this->platform->getRegexpExpression(), 'Regular expression operator is not correct');
self::assertEquals('"', $this->platform->getIdentifierQuoteCharacter(), 'Identifier quote character is not correct');
@@ -138,7 +144,7 @@ public function testGeneratesSqlSnippets()
self::assertEquals('SUBSTRING(column FROM 1 FOR 5)', $this->platform->getSubstringExpression('column', 1, 5), 'Substring expression with length is not correct');
}
- public function testGeneratesTransactionCommands()
+ public function testGeneratesTransactionCommands() : void
{
self::assertEquals(
'SET SESSION CHARACTERISTICS AS TRANSACTION ISOLATION LEVEL READ UNCOMMITTED',
@@ -158,14 +164,14 @@ public function testGeneratesTransactionCommands()
);
}
- public function testGeneratesDDLSnippets()
+ public function testGeneratesDDLSnippets() : void
{
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()
+ public function testGenerateTableWithAutoincrement() : void
{
$table = new Table('autoinc_table');
$column = $table->addColumn('id', 'integer');
@@ -175,9 +181,9 @@ public function testGenerateTableWithAutoincrement()
}
/**
- * @return string[][]
+ * @return mixed[][]
*/
- public static function serialTypes() : array
+ public static function serialTypes() : iterable
{
return [
['integer', 'SERIAL'],
@@ -234,7 +240,7 @@ public function testGetDefaultValueDeclarationSQLIgnoresTheDefaultKeyWhenTheFiel
self::assertSame('', $sql);
}
- public function testGeneratesTypeDeclarationForIntegers()
+ public function testGeneratesTypeDeclarationForIntegers() : void
{
self::assertEquals(
'INT',
@@ -252,7 +258,7 @@ public function testGeneratesTypeDeclarationForIntegers()
);
}
- public function testGeneratesTypeDeclarationForStrings()
+ public function testGeneratesTypeDeclarationForStrings() : void
{
self::assertEquals(
'CHAR(10)',
@@ -272,12 +278,12 @@ public function testGeneratesTypeDeclarationForStrings()
);
}
- public function getGenerateUniqueIndexSql()
+ public function getGenerateUniqueIndexSql() : string
{
return 'CREATE UNIQUE INDEX index_name ON test (test, test2)';
}
- public function testGeneratesSequenceSqlCommands()
+ public function testGeneratesSequenceSqlCommands() : void
{
$sequence = new Sequence('myseq', 20, 1);
self::assertEquals(
@@ -294,27 +300,27 @@ public function testGeneratesSequenceSqlCommands()
);
}
- public function testDoesNotPreferIdentityColumns()
+ public function testDoesNotPreferIdentityColumns() : void
{
self::assertFalse($this->platform->prefersIdentityColumns());
}
- public function testPrefersSequences()
+ public function testPrefersSequences() : void
{
self::assertTrue($this->platform->prefersSequences());
}
- public function testSupportsIdentityColumns()
+ public function testSupportsIdentityColumns() : void
{
self::assertTrue($this->platform->supportsIdentityColumns());
}
- public function testSupportsSavePoints()
+ public function testSupportsSavePoints() : void
{
self::assertTrue($this->platform->supportsSavepoints());
}
- public function testSupportsSequences()
+ public function testSupportsSequences() : void
{
self::assertTrue($this->platform->supportsSequences());
}
@@ -322,24 +328,27 @@ public function testSupportsSequences()
/**
* {@inheritdoc}
*/
- protected function supportsCommentOnStatement()
+ protected function supportsCommentOnStatement() : bool
{
return true;
}
- public function testModifyLimitQuery()
+ public function testModifyLimitQuery() : void
{
$sql = $this->platform->modifyLimitQuery('SELECT * FROM user', 10, 0);
self::assertEquals('SELECT * FROM user LIMIT 10', $sql);
}
- public function testModifyLimitQueryWithEmptyOffset()
+ public function testModifyLimitQueryWithEmptyOffset() : void
{
$sql = $this->platform->modifyLimitQuery('SELECT * FROM user', 10);
self::assertEquals('SELECT * FROM user LIMIT 10', $sql);
}
- public function getCreateTableColumnCommentsSQL()
+ /**
+ * {@inheritDoc}
+ */
+ public function getCreateTableColumnCommentsSQL() : array
{
return [
'CREATE TABLE test (id INT NOT NULL, PRIMARY KEY(id))',
@@ -347,7 +356,10 @@ public function getCreateTableColumnCommentsSQL()
];
}
- public function getAlterTableColumnCommentsSQL()
+ /**
+ * {@inheritDoc}
+ */
+ public function getAlterTableColumnCommentsSQL() : array
{
return [
'ALTER TABLE mytable ADD quota INT NOT NULL',
@@ -357,7 +369,10 @@ public function getAlterTableColumnCommentsSQL()
];
}
- public function getCreateTableColumnTypeCommentsSQL()
+ /**
+ * {@inheritDoc}
+ */
+ public function getCreateTableColumnTypeCommentsSQL() : array
{
return [
'CREATE TABLE test (id INT NOT NULL, data TEXT NOT NULL, PRIMARY KEY(id))',
@@ -365,12 +380,18 @@ public function getCreateTableColumnTypeCommentsSQL()
];
}
- protected function getQuotedColumnInPrimaryKeySQL()
+ /**
+ * {@inheritDoc}
+ */
+ protected function getQuotedColumnInPrimaryKeySQL() : array
{
return ['CREATE TABLE "quoted" ("create" VARCHAR(255) NOT NULL, PRIMARY KEY("create"))'];
}
- protected function getQuotedColumnInIndexSQL()
+ /**
+ * {@inheritDoc}
+ */
+ protected function getQuotedColumnInIndexSQL() : array
{
return [
'CREATE TABLE "quoted" ("create" VARCHAR(255) NOT NULL)',
@@ -378,7 +399,10 @@ protected function getQuotedColumnInIndexSQL()
];
}
- protected function getQuotedNameInIndexSQL()
+ /**
+ * {@inheritDoc}
+ */
+ protected function getQuotedNameInIndexSQL() : array
{
return [
'CREATE TABLE test (column1 VARCHAR(255) NOT NULL)',
@@ -386,7 +410,10 @@ protected function getQuotedNameInIndexSQL()
];
}
- protected function getQuotedColumnInForeignKeySQL()
+ /**
+ * {@inheritDoc}
+ */
+ protected function getQuotedColumnInForeignKeySQL() : array
{
return [
'CREATE TABLE "quoted" ("create" VARCHAR(255) NOT NULL, foo VARCHAR(255) NOT NULL, "bar" VARCHAR(255) NOT NULL)',
@@ -397,20 +424,17 @@ protected function getQuotedColumnInForeignKeySQL()
}
/**
- * @param string $databaseValue
- * @param string $preparedStatementValue
- * @param int $integerValue
- * @param bool $booleanValue
+ * @param string|bool $databaseValue
*
* @group DBAL-457
* @dataProvider pgBooleanProvider
*/
public function testConvertBooleanAsLiteralStrings(
$databaseValue,
- $preparedStatementValue,
- $integerValue,
- $booleanValue
- ) {
+ string $preparedStatementValue,
+ ?int $integerValue,
+ ?bool $booleanValue
+ ) : void {
$platform = $this->createPlatform();
self::assertEquals($preparedStatementValue, $platform->convertBooleans($databaseValue));
@@ -419,7 +443,7 @@ public function testConvertBooleanAsLiteralStrings(
/**
* @group DBAL-457
*/
- public function testConvertBooleanAsLiteralIntegers()
+ public function testConvertBooleanAsLiteralIntegers() : void
{
$platform = $this->createPlatform();
$platform->setUseBooleanTrueFalseStrings(false);
@@ -432,20 +456,17 @@ public function testConvertBooleanAsLiteralIntegers()
}
/**
- * @param string $databaseValue
- * @param string $preparedStatementValue
- * @param int $integerValue
- * @param bool $booleanValue
+ * @param string|bool $databaseValue
*
* @group DBAL-630
* @dataProvider pgBooleanProvider
*/
public function testConvertBooleanAsDatabaseValueStrings(
$databaseValue,
- $preparedStatementValue,
- $integerValue,
- $booleanValue
- ) {
+ string $preparedStatementValue,
+ ?int $integerValue,
+ ?bool $booleanValue
+ ) : void {
$platform = $this->createPlatform();
self::assertSame($integerValue, $platform->convertBooleansToDatabaseValue($booleanValue));
@@ -454,7 +475,7 @@ public function testConvertBooleanAsDatabaseValueStrings(
/**
* @group DBAL-630
*/
- public function testConvertBooleanAsDatabaseValueIntegers()
+ public function testConvertBooleanAsDatabaseValueIntegers() : void
{
$platform = $this->createPlatform();
$platform->setUseBooleanTrueFalseStrings(false);
@@ -464,21 +485,18 @@ public function testConvertBooleanAsDatabaseValueIntegers()
}
/**
- * @param string $databaseValue
- * @param string $prepareStatementValue
- * @param int $integerValue
- * @param bool $booleanValue
+ * @param string|bool $databaseValue
*
* @dataProvider pgBooleanProvider
*/
- public function testConvertFromBoolean($databaseValue, $prepareStatementValue, $integerValue, $booleanValue)
+ public function testConvertFromBoolean($databaseValue, string $prepareStatementValue, ?int $integerValue, ?bool $booleanValue) : void
{
$platform = $this->createPlatform();
self::assertSame($booleanValue, $platform->convertFromBoolean($databaseValue));
}
- public function testThrowsExceptionWithInvalidBooleanLiteral()
+ public function testThrowsExceptionWithInvalidBooleanLiteral() : void
{
$platform = $this->createPlatform();
@@ -488,14 +506,14 @@ public function testThrowsExceptionWithInvalidBooleanLiteral()
$platform->convertBooleansToDatabaseValue('my-bool');
}
- public function testGetCreateSchemaSQL()
+ public function testGetCreateSchemaSQL() : void
{
$schemaName = 'schema';
$sql = $this->platform->getCreateSchemaSQL($schemaName);
self::assertEquals('CREATE SCHEMA ' . $schemaName, $sql);
}
- public function testAlterDecimalPrecisionScale()
+ public function testAlterDecimalPrecisionScale() : void
{
$table = new Table('mytable');
$table->addColumn('dfoo1', 'decimal');
@@ -557,7 +575,7 @@ public function testAlterDecimalPrecisionScale()
/**
* @group DBAL-365
*/
- public function testDroppingConstraintsBeforeColumns()
+ public function testDroppingConstraintsBeforeColumns() : void
{
$newTable = new Table('mytable');
$newTable->addColumn('id', 'integer');
@@ -584,7 +602,7 @@ public function testDroppingConstraintsBeforeColumns()
/**
* @group DBAL-563
*/
- public function testUsesSequenceEmulatedIdentityColumns()
+ public function testUsesSequenceEmulatedIdentityColumns() : void
{
self::assertTrue($this->platform->usesSequenceEmulatedIdentityColumns());
}
@@ -592,7 +610,7 @@ public function testUsesSequenceEmulatedIdentityColumns()
/**
* @group DBAL-563
*/
- public function testReturnsIdentitySequenceName()
+ public function testReturnsIdentitySequenceName() : void
{
self::assertSame('mytable_mycolumn_seq', $this->platform->getIdentitySequenceName('mytable', 'mycolumn'));
}
@@ -601,30 +619,33 @@ public function testReturnsIdentitySequenceName()
* @dataProvider dataCreateSequenceWithCache
* @group DBAL-139
*/
- public function testCreateSequenceWithCache($cacheSize, $expectedSql)
+ public function testCreateSequenceWithCache(int $cacheSize, string $expectedSql) : void
{
$sequence = new Sequence('foo', 1, 1, $cacheSize);
self::assertStringContainsString($expectedSql, $this->platform->getCreateSequenceSQL($sequence));
}
- public function dataCreateSequenceWithCache()
+ /**
+ * @return mixed[][]
+ */
+ public static function dataCreateSequenceWithCache() : iterable
{
return [
[3, 'CACHE 3'],
];
}
- protected function getBinaryDefaultLength()
+ protected function getBinaryDefaultLength() : int
{
return 0;
}
- protected function getBinaryMaxLength()
+ protected function getBinaryMaxLength() : int
{
return 0;
}
- public function testReturnsBinaryTypeDeclarationSQL()
+ public function testReturnsBinaryTypeDeclarationSQL() : void
{
self::assertSame('BYTEA', $this->platform->getBinaryTypeDeclarationSQL([]));
self::assertSame('BYTEA', $this->platform->getBinaryTypeDeclarationSQL(['length' => 0]));
@@ -635,7 +656,7 @@ public function testReturnsBinaryTypeDeclarationSQL()
self::assertSame('BYTEA', $this->platform->getBinaryTypeDeclarationSQL(['fixed' => true, 'length' => 9999999]));
}
- public function testDoesNotPropagateUnnecessaryTableAlterationOnBinaryType()
+ public function testDoesNotPropagateUnnecessaryTableAlterationOnBinaryType() : void
{
$table1 = new Table('mytable');
$table1->addColumn('column_varbinary', 'binary');
@@ -676,17 +697,21 @@ public function testDoesNotPropagateUnnecessaryTableAlterationOnBinaryType()
}
/**
+ * {@inheritDoc}
+ *
* @group DBAL-234
*/
- protected function getAlterTableRenameIndexSQL()
+ protected function getAlterTableRenameIndexSQL() : array
{
return ['ALTER INDEX idx_foo RENAME TO idx_bar'];
}
/**
+ * {@inheritDoc}
+ *
* @group DBAL-234
*/
- protected function getQuotedAlterTableRenameIndexSQL()
+ protected function getQuotedAlterTableRenameIndexSQL() : array
{
return [
'ALTER INDEX "create" RENAME TO "select"',
@@ -697,9 +722,9 @@ protected function getQuotedAlterTableRenameIndexSQL()
/**
* PostgreSQL boolean strings provider
*
- * @return mixed[]
+ * @return mixed[][]
*/
- public function pgBooleanProvider()
+ public static function pgBooleanProvider() : iterable
{
return [
// Database value, prepared statement value, boolean integer value, boolean value.
@@ -726,7 +751,7 @@ public function pgBooleanProvider()
/**
* {@inheritdoc}
*/
- protected function getQuotedAlterTableRenameColumnSQL()
+ protected function getQuotedAlterTableRenameColumnSQL() : array
{
return [
'ALTER TABLE mytable RENAME COLUMN unquoted1 TO unquoted',
@@ -744,7 +769,7 @@ protected function getQuotedAlterTableRenameColumnSQL()
/**
* {@inheritdoc}
*/
- protected function getQuotedAlterTableChangeColumnLengthSQL()
+ protected function getQuotedAlterTableChangeColumnLengthSQL() : array
{
return [
'ALTER TABLE mytable ALTER unquoted1 TYPE VARCHAR(255)',
@@ -757,17 +782,21 @@ protected function getQuotedAlterTableChangeColumnLengthSQL()
}
/**
+ * {@inheritDoc}
+ *
* @group DBAL-807
*/
- protected function getAlterTableRenameIndexInSchemaSQL()
+ protected function getAlterTableRenameIndexInSchemaSQL() : array
{
return ['ALTER INDEX myschema.idx_foo RENAME TO idx_bar'];
}
/**
+ * {@inheritDoc}
+ *
* @group DBAL-807
*/
- protected function getQuotedAlterTableRenameIndexInSchemaSQL()
+ protected function getQuotedAlterTableRenameIndexInSchemaSQL() : array
{
return [
'ALTER INDEX "schema"."create" RENAME TO "select"',
@@ -775,12 +804,12 @@ protected function getQuotedAlterTableRenameIndexInSchemaSQL()
];
}
- protected function getQuotesDropForeignKeySQL()
+ protected function getQuotesDropForeignKeySQL() : string
{
return 'ALTER TABLE "table" DROP CONSTRAINT "select"';
}
- public function testGetNullCommentOnColumnSQL()
+ public function testGetNullCommentOnColumnSQL() : void
{
self::assertEquals(
'COMMENT ON COLUMN mytable.id IS NULL',
@@ -791,7 +820,7 @@ public function testGetNullCommentOnColumnSQL()
/**
* @group DBAL-423
*/
- public function testReturnsGuidTypeDeclarationSQL()
+ public function testReturnsGuidTypeDeclarationSQL() : void
{
self::assertSame('UUID', $this->platform->getGuidTypeDeclarationSQL([]));
}
@@ -799,7 +828,7 @@ public function testReturnsGuidTypeDeclarationSQL()
/**
* {@inheritdoc}
*/
- public function getAlterTableRenameColumnSQL()
+ public function getAlterTableRenameColumnSQL() : array
{
return ['ALTER TABLE foo RENAME COLUMN bar TO baz'];
}
@@ -807,7 +836,7 @@ public function getAlterTableRenameColumnSQL()
/**
* {@inheritdoc}
*/
- protected function getQuotesTableIdentifiersInAlterTableSQL()
+ protected function getQuotesTableIdentifiersInAlterTableSQL() : array
{
return [
'ALTER TABLE "foo" DROP CONSTRAINT fk1',
@@ -827,7 +856,7 @@ protected function getQuotesTableIdentifiersInAlterTableSQL()
/**
* {@inheritdoc}
*/
- protected function getCommentOnColumnSQL()
+ protected function getCommentOnColumnSQL() : array
{
return [
'COMMENT ON COLUMN foo.bar IS \'comment\'',
@@ -839,7 +868,7 @@ protected function getCommentOnColumnSQL()
/**
* @group DBAL-1004
*/
- public function testAltersTableColumnCommentWithExplicitlyQuotedIdentifiers()
+ public function testAltersTableColumnCommentWithExplicitlyQuotedIdentifiers() : void
{
$table1 = new Table('"foo"', [new Column('"bar"', Type::getType('integer'))]);
$table2 = new Table('"foo"', [new Column('"bar"', Type::getType('integer'), ['comment' => 'baz'])]);
@@ -858,7 +887,7 @@ public function testAltersTableColumnCommentWithExplicitlyQuotedIdentifiers()
/**
* @group 3158
*/
- public function testAltersTableColumnCommentIfRequiredByType()
+ public function testAltersTableColumnCommentIfRequiredByType() : void
{
$table1 = new Table('"foo"', [new Column('"bar"', Type::getType('datetime'))]);
$table2 = new Table('"foo"', [new Column('"bar"', Type::getType('datetime_immutable'))]);
@@ -881,7 +910,7 @@ public function testAltersTableColumnCommentIfRequiredByType()
/**
* {@inheritdoc}
*/
- protected function getQuotesReservedKeywordInUniqueConstraintDeclarationSQL()
+ protected function getQuotesReservedKeywordInUniqueConstraintDeclarationSQL() : string
{
return 'CONSTRAINT "select" UNIQUE (foo)';
}
@@ -889,7 +918,7 @@ protected function getQuotesReservedKeywordInUniqueConstraintDeclarationSQL()
/**
* {@inheritdoc}
*/
- protected function getQuotesReservedKeywordInIndexDeclarationSQL()
+ protected function getQuotesReservedKeywordInIndexDeclarationSQL() : string
{
return 'INDEX "select" (foo)';
}
@@ -897,7 +926,7 @@ protected function getQuotesReservedKeywordInIndexDeclarationSQL()
/**
* {@inheritdoc}
*/
- protected function getQuotesReservedKeywordInTruncateTableSQL()
+ protected function getQuotesReservedKeywordInTruncateTableSQL() : string
{
return 'TRUNCATE "select"';
}
@@ -905,7 +934,7 @@ protected function getQuotesReservedKeywordInTruncateTableSQL()
/**
* {@inheritdoc}
*/
- protected function getAlterStringToFixedStringSQL()
+ protected function getAlterStringToFixedStringSQL() : array
{
return ['ALTER TABLE mytable ALTER name TYPE CHAR(2)'];
}
@@ -913,7 +942,7 @@ protected function getAlterStringToFixedStringSQL()
/**
* {@inheritdoc}
*/
- protected function getGeneratesAlterTableRenameIndexUsedByForeignKeySQL()
+ protected function getGeneratesAlterTableRenameIndexUsedByForeignKeySQL() : array
{
return ['ALTER INDEX idx_foo RENAME TO idx_foo_renamed'];
}
@@ -921,7 +950,7 @@ protected function getGeneratesAlterTableRenameIndexUsedByForeignKeySQL()
/**
* @group DBAL-1142
*/
- public function testInitializesTsvectorTypeMapping()
+ public function testInitializesTsvectorTypeMapping() : void
{
self::assertTrue($this->platform->hasDoctrineTypeMappingFor('tsvector'));
self::assertEquals('text', $this->platform->getDoctrineTypeMapping('tsvector'));
@@ -930,7 +959,7 @@ public function testInitializesTsvectorTypeMapping()
/**
* @group DBAL-1220
*/
- public function testReturnsDisallowDatabaseConnectionsSQL()
+ public function testReturnsDisallowDatabaseConnectionsSQL() : void
{
self::assertSame(
"UPDATE pg_database SET datallowconn = 'false' WHERE datname = 'foo'",
@@ -941,7 +970,7 @@ public function testReturnsDisallowDatabaseConnectionsSQL()
/**
* @group DBAL-1220
*/
- public function testReturnsCloseActiveDatabaseConnectionsSQL()
+ public function testReturnsCloseActiveDatabaseConnectionsSQL() : void
{
self::assertSame(
"SELECT pg_terminate_backend(procpid) FROM pg_stat_activity WHERE datname = 'foo'",
@@ -952,7 +981,7 @@ public function testReturnsCloseActiveDatabaseConnectionsSQL()
/**
* @group DBAL-2436
*/
- public function testQuotesTableNameInListTableForeignKeysSQL()
+ public function testQuotesTableNameInListTableForeignKeysSQL() : void
{
self::assertStringContainsStringIgnoringCase(
"'Foo''Bar\\'",
@@ -963,7 +992,7 @@ public function testQuotesTableNameInListTableForeignKeysSQL()
/**
* @group DBAL-2436
*/
- public function testQuotesSchemaNameInListTableForeignKeysSQL()
+ public function testQuotesSchemaNameInListTableForeignKeysSQL() : void
{
self::assertStringContainsStringIgnoringCase(
"'Foo''Bar\\'",
@@ -974,7 +1003,7 @@ public function testQuotesSchemaNameInListTableForeignKeysSQL()
/**
* @group DBAL-2436
*/
- public function testQuotesTableNameInListTableConstraintsSQL()
+ public function testQuotesTableNameInListTableConstraintsSQL() : void
{
self::assertStringContainsStringIgnoringCase(
"'Foo''Bar\\'",
@@ -985,7 +1014,7 @@ public function testQuotesTableNameInListTableConstraintsSQL()
/**
* @group DBAL-2436
*/
- public function testQuotesTableNameInListTableIndexesSQL()
+ public function testQuotesTableNameInListTableIndexesSQL() : void
{
self::assertStringContainsStringIgnoringCase(
"'Foo''Bar\\'",
@@ -996,7 +1025,7 @@ public function testQuotesTableNameInListTableIndexesSQL()
/**
* @group DBAL-2436
*/
- public function testQuotesSchemaNameInListTableIndexesSQL()
+ public function testQuotesSchemaNameInListTableIndexesSQL() : void
{
self::assertStringContainsStringIgnoringCase(
"'Foo''Bar\\'",
@@ -1007,7 +1036,7 @@ public function testQuotesSchemaNameInListTableIndexesSQL()
/**
* @group DBAL-2436
*/
- public function testQuotesTableNameInListTableColumnsSQL()
+ public function testQuotesTableNameInListTableColumnsSQL() : void
{
self::assertStringContainsStringIgnoringCase(
"'Foo''Bar\\'",
@@ -1018,7 +1047,7 @@ public function testQuotesTableNameInListTableColumnsSQL()
/**
* @group DBAL-2436
*/
- public function testQuotesSchemaNameInListTableColumnsSQL()
+ public function testQuotesSchemaNameInListTableColumnsSQL() : void
{
self::assertStringContainsStringIgnoringCase(
"'Foo''Bar\\'",
@@ -1029,7 +1058,7 @@ public function testQuotesSchemaNameInListTableColumnsSQL()
/**
* @group DBAL-2436
*/
- public function testQuotesDatabaseNameInCloseActiveDatabaseConnectionsSQL()
+ public function testQuotesDatabaseNameInCloseActiveDatabaseConnectionsSQL() : void
{
self::assertStringContainsStringIgnoringCase(
"'Foo''Bar\\'",
diff --git a/tests/Doctrine/Tests/DBAL/Platforms/AbstractSQLServerPlatformTestCase.php b/tests/Doctrine/Tests/DBAL/Platforms/AbstractSQLServerPlatformTestCase.php
index db36f8c7ca6..46627bd8cf2 100644
--- a/tests/Doctrine/Tests/DBAL/Platforms/AbstractSQLServerPlatformTestCase.php
+++ b/tests/Doctrine/Tests/DBAL/Platforms/AbstractSQLServerPlatformTestCase.php
@@ -14,12 +14,15 @@
abstract class AbstractSQLServerPlatformTestCase extends AbstractPlatformTestCase
{
- public function getGenerateTableSql()
+ public function getGenerateTableSql() : string
{
return 'CREATE TABLE test (id INT IDENTITY NOT NULL, test NVARCHAR(255), PRIMARY KEY (id))';
}
- public function getGenerateTableWithMultiColumnUniqueIndexSql()
+ /**
+ * {@inheritDoc}
+ */
+ public function getGenerateTableWithMultiColumnUniqueIndexSql() : array
{
return [
'CREATE TABLE test (foo NVARCHAR(255), bar NVARCHAR(255))',
@@ -27,7 +30,10 @@ public function getGenerateTableWithMultiColumnUniqueIndexSql()
];
}
- public function getGenerateAlterTableSql()
+ /**
+ * {@inheritDoc}
+ */
+ public function getGenerateAlterTableSql() : array
{
return [
'ALTER TABLE mytable ADD quota INT',
@@ -47,14 +53,14 @@ public function getGenerateAlterTableSql()
];
}
- public function testDoesNotSupportRegexp()
+ public function testDoesNotSupportRegexp() : void
{
$this->expectException(DBALException::class);
$this->platform->getRegexpExpression();
}
- public function testGeneratesSqlSnippets()
+ public function testGeneratesSqlSnippets() : void
{
self::assertEquals('CONVERT(date, GETDATE())', $this->platform->getCurrentDateSQL());
self::assertEquals('CONVERT(time, GETDATE())', $this->platform->getCurrentTimeSQL());
@@ -63,7 +69,7 @@ public function testGeneratesSqlSnippets()
self::assertEquals('(column1 + column2 + column3)', $this->platform->getConcatExpression('column1', 'column2', 'column3'), 'Concatenation expression is not correct');
}
- public function testGeneratesTransactionsCommands()
+ public function testGeneratesTransactionsCommands() : void
{
self::assertEquals(
'SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED',
@@ -83,7 +89,7 @@ public function testGeneratesTransactionsCommands()
);
}
- public function testGeneratesDDLSnippets()
+ public function testGeneratesDDLSnippets() : void
{
$dropDatabaseExpectation = 'DROP DATABASE foobar';
@@ -93,7 +99,7 @@ public function testGeneratesDDLSnippets()
self::assertEquals('DROP TABLE foobar', $this->platform->getDropTableSQL('foobar'));
}
- public function testGeneratesTypeDeclarationForIntegers()
+ public function testGeneratesTypeDeclarationForIntegers() : void
{
self::assertEquals(
'INT',
@@ -111,7 +117,7 @@ public function testGeneratesTypeDeclarationForIntegers()
);
}
- public function testGeneratesTypeDeclarationsForStrings()
+ public function testGeneratesTypeDeclarationsForStrings() : void
{
self::assertEquals(
'NCHAR(10)',
@@ -136,47 +142,47 @@ public function testGeneratesTypeDeclarationsForStrings()
);
}
- public function testPrefersIdentityColumns()
+ public function testPrefersIdentityColumns() : void
{
self::assertTrue($this->platform->prefersIdentityColumns());
}
- public function testSupportsIdentityColumns()
+ public function testSupportsIdentityColumns() : void
{
self::assertTrue($this->platform->supportsIdentityColumns());
}
- public function testSupportsCreateDropDatabase()
+ public function testSupportsCreateDropDatabase() : void
{
self::assertTrue($this->platform->supportsCreateDropDatabase());
}
- public function testSupportsSchemas()
+ public function testSupportsSchemas() : void
{
self::assertTrue($this->platform->supportsSchemas());
}
- public function testDoesNotSupportSavePoints()
+ public function testDoesNotSupportSavePoints() : void
{
self::assertTrue($this->platform->supportsSavepoints());
}
- public function getGenerateIndexSql()
+ public function getGenerateIndexSql() : string
{
return 'CREATE INDEX my_idx ON mytable (user_name, last_login)';
}
- public function getGenerateUniqueIndexSql()
+ public function getGenerateUniqueIndexSql() : string
{
return 'CREATE UNIQUE INDEX index_name ON test (test, test2) WHERE test IS NOT NULL AND test2 IS NOT NULL';
}
- public function getGenerateForeignKeySql()
+ public function getGenerateForeignKeySql() : string
{
return 'ALTER TABLE test ADD FOREIGN KEY (fk_name_id) REFERENCES other_table (id)';
}
- public function testModifyLimitQuery()
+ public function testModifyLimitQuery() : void
{
$querySql = 'SELECT * FROM user';
$alteredSql = 'SELECT TOP 10 * FROM user';
@@ -184,7 +190,7 @@ public function testModifyLimitQuery()
$this->expectCteWithMaxRowNum($alteredSql, 10, $sql);
}
- public function testModifyLimitQueryWithEmptyOffset()
+ public function testModifyLimitQueryWithEmptyOffset() : void
{
$querySql = 'SELECT * FROM user';
$alteredSql = 'SELECT TOP 10 * FROM user';
@@ -192,7 +198,7 @@ public function testModifyLimitQueryWithEmptyOffset()
$this->expectCteWithMaxRowNum($alteredSql, 10, $sql);
}
- public function testModifyLimitQueryWithOffset()
+ public function testModifyLimitQueryWithOffset() : void
{
if (! $this->platform->supportsLimitOffset()) {
$this->markTestSkipped(sprintf('Platform "%s" does not support offsets in result limiting.', $this->platform->getName()));
@@ -205,7 +211,7 @@ public function testModifyLimitQueryWithOffset()
$this->expectCteWithMinAndMaxRowNums($alteredSql, 6, 15, $sql);
}
- public function testModifyLimitQueryWithAscOrderBy()
+ public function testModifyLimitQueryWithAscOrderBy() : void
{
$querySql = 'SELECT * FROM user ORDER BY username ASC';
$alteredSql = 'SELECT TOP 10 * FROM user ORDER BY username ASC';
@@ -214,7 +220,7 @@ public function testModifyLimitQueryWithAscOrderBy()
$this->expectCteWithMaxRowNum($alteredSql, 10, $sql);
}
- public function testModifyLimitQueryWithLowercaseOrderBy()
+ public function testModifyLimitQueryWithLowercaseOrderBy() : void
{
$querySql = 'SELECT * FROM user order by username';
$alteredSql = 'SELECT TOP 10 * FROM user order by username';
@@ -222,7 +228,7 @@ public function testModifyLimitQueryWithLowercaseOrderBy()
$this->expectCteWithMaxRowNum($alteredSql, 10, $sql);
}
- public function testModifyLimitQueryWithDescOrderBy()
+ public function testModifyLimitQueryWithDescOrderBy() : void
{
$querySql = 'SELECT * FROM user ORDER BY username DESC';
$alteredSql = 'SELECT TOP 10 * FROM user ORDER BY username DESC';
@@ -230,7 +236,7 @@ public function testModifyLimitQueryWithDescOrderBy()
$this->expectCteWithMaxRowNum($alteredSql, 10, $sql);
}
- public function testModifyLimitQueryWithMultipleOrderBy()
+ public function testModifyLimitQueryWithMultipleOrderBy() : void
{
$querySql = 'SELECT * FROM user ORDER BY username DESC, usereamil ASC';
$alteredSql = 'SELECT TOP 10 * FROM user ORDER BY username DESC, usereamil ASC';
@@ -238,7 +244,7 @@ public function testModifyLimitQueryWithMultipleOrderBy()
$this->expectCteWithMaxRowNum($alteredSql, 10, $sql);
}
- public function testModifyLimitQueryWithSubSelect()
+ public function testModifyLimitQueryWithSubSelect() : void
{
$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';
@@ -246,7 +252,7 @@ public function testModifyLimitQueryWithSubSelect()
$this->expectCteWithMaxRowNum($alteredSql, 10, $sql);
}
- public function testModifyLimitQueryWithSubSelectAndOrder()
+ public function testModifyLimitQueryWithSubSelectAndOrder() : void
{
$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';
@@ -259,7 +265,7 @@ public function testModifyLimitQueryWithSubSelectAndOrder()
$this->expectCteWithMaxRowNum($alteredSql, 10, $sql);
}
- public function testModifyLimitQueryWithSubSelectAndMultipleOrder()
+ public function testModifyLimitQueryWithSubSelectAndMultipleOrder() : void
{
if (! $this->platform->supportsLimitOffset()) {
$this->markTestSkipped(sprintf('Platform "%s" does not support offsets in result limiting.', $this->platform->getName()));
@@ -281,7 +287,7 @@ public function testModifyLimitQueryWithSubSelectAndMultipleOrder()
$this->expectCteWithMinAndMaxRowNums($alteredSql, 6, 15, $sql);
}
- public function testModifyLimitQueryWithFromColumnNames()
+ public function testModifyLimitQueryWithFromColumnNames() : void
{
$querySql = 'SELECT a.fromFoo, fromBar FROM foo';
$alteredSql = 'SELECT TOP 10 a.fromFoo, fromBar FROM foo';
@@ -292,7 +298,7 @@ public function testModifyLimitQueryWithFromColumnNames()
/**
* @group DBAL-927
*/
- public function testModifyLimitQueryWithExtraLongQuery()
+ public function testModifyLimitQueryWithExtraLongQuery() : void
{
$query = 'SELECT table1.column1, table2.column2, table3.column3, table4.column4, table5.column5, table6.column6, table7.column7, table8.column8 FROM table1, table2, table3, table4, table5, table6, table7, table8 ';
$query .= 'WHERE (table1.column1 = table2.column2) AND (table1.column1 = table3.column3) AND (table1.column1 = table4.column4) AND (table1.column1 = table5.column5) AND (table1.column1 = table6.column6) AND (table1.column1 = table7.column7) AND (table1.column1 = table8.column8) AND (table2.column2 = table3.column3) AND (table2.column2 = table4.column4) AND (table2.column2 = table5.column5) AND (table2.column2 = table6.column6) ';
@@ -311,7 +317,7 @@ public function testModifyLimitQueryWithExtraLongQuery()
/**
* @group DDC-2470
*/
- public function testModifyLimitQueryWithOrderByClause()
+ public function testModifyLimitQueryWithOrderByClause() : void
{
if (! $this->platform->supportsLimitOffset()) {
$this->markTestSkipped(sprintf('Platform "%s" does not support offsets in result limiting.', $this->platform->getName()));
@@ -327,7 +333,7 @@ public function testModifyLimitQueryWithOrderByClause()
/**
* @group DBAL-713
*/
- public function testModifyLimitQueryWithSubSelectInSelectList()
+ public function testModifyLimitQueryWithSubSelectInSelectList() : void
{
$querySql = 'SELECT ' .
'u.id, ' .
@@ -351,7 +357,7 @@ public function testModifyLimitQueryWithSubSelectInSelectList()
/**
* @group DBAL-713
*/
- public function testModifyLimitQueryWithSubSelectInSelectListAndOrderByClause()
+ public function testModifyLimitQueryWithSubSelectInSelectListAndOrderByClause() : void
{
if (! $this->platform->supportsLimitOffset()) {
$this->markTestSkipped(sprintf('Platform "%s" does not support offsets in result limiting.', $this->platform->getName()));
@@ -380,7 +386,7 @@ public function testModifyLimitQueryWithSubSelectInSelectListAndOrderByClause()
/**
* @group DBAL-834
*/
- public function testModifyLimitQueryWithAggregateFunctionInOrderByClause()
+ public function testModifyLimitQueryWithAggregateFunctionInOrderByClause() : void
{
$querySql = 'SELECT ' .
'MAX(heading_id) aliased, ' .
@@ -401,7 +407,7 @@ public function testModifyLimitQueryWithAggregateFunctionInOrderByClause()
/**
* @throws DBALException
*/
- public function testModifyLimitSubqueryWithJoinAndSubqueryOrderedByColumnFromBaseTable()
+ public function testModifyLimitSubqueryWithJoinAndSubqueryOrderedByColumnFromBaseTable() : void
{
$querySql = 'SELECT DISTINCT id_0, name_1 '
. 'FROM ('
@@ -425,7 +431,7 @@ public function testModifyLimitSubqueryWithJoinAndSubqueryOrderedByColumnFromBas
/**
* @throws DBALException
*/
- public function testModifyLimitSubqueryWithJoinAndSubqueryOrderedByColumnFromJoinTable()
+ public function testModifyLimitSubqueryWithJoinAndSubqueryOrderedByColumnFromJoinTable() : void
{
$querySql = 'SELECT DISTINCT id_0, name_1 '
. 'FROM ('
@@ -449,7 +455,7 @@ public function testModifyLimitSubqueryWithJoinAndSubqueryOrderedByColumnFromJoi
/**
* @throws DBALException
*/
- public function testModifyLimitSubqueryWithJoinAndSubqueryOrderedByColumnsFromBothTables()
+ public function testModifyLimitSubqueryWithJoinAndSubqueryOrderedByColumnsFromBothTables() : void
{
$querySql = 'SELECT DISTINCT id_0, name_1, foo_2 '
. 'FROM ('
@@ -470,7 +476,7 @@ public function testModifyLimitSubqueryWithJoinAndSubqueryOrderedByColumnsFromBo
$this->expectCteWithMaxRowNum($alteredSql, 5, $sql);
}
- public function testModifyLimitSubquerySimple()
+ public function testModifyLimitSubquerySimple() : void
{
$querySql = 'SELECT DISTINCT id_0 FROM '
. '(SELECT k0_.id AS id_0, k0_.field AS field_1 '
@@ -484,7 +490,7 @@ public function testModifyLimitSubquerySimple()
/**
* @group DDC-1360
*/
- public function testQuoteIdentifier()
+ public function testQuoteIdentifier() : void
{
self::assertEquals('[fo][o]', $this->platform->quoteIdentifier('fo]o'));
self::assertEquals('[test]', $this->platform->quoteIdentifier('test'));
@@ -494,7 +500,7 @@ public function testQuoteIdentifier()
/**
* @group DDC-1360
*/
- public function testQuoteSingleIdentifier()
+ public function testQuoteSingleIdentifier() : void
{
self::assertEquals('[fo][o]', $this->platform->quoteSingleIdentifier('fo]o'));
self::assertEquals('[test]', $this->platform->quoteSingleIdentifier('test'));
@@ -504,7 +510,7 @@ public function testQuoteSingleIdentifier()
/**
* @group DBAL-220
*/
- public function testCreateClusteredIndex()
+ public function testCreateClusteredIndex() : void
{
$idx = new Index('idx', ['id']);
$idx->addFlag('clustered');
@@ -514,7 +520,7 @@ public function testCreateClusteredIndex()
/**
* @group DBAL-220
*/
- public function testCreateNonClusteredPrimaryKeyInTable()
+ public function testCreateNonClusteredPrimaryKeyInTable() : void
{
$table = new Table('tbl');
$table->addColumn('id', 'integer');
@@ -527,25 +533,31 @@ public function testCreateNonClusteredPrimaryKeyInTable()
/**
* @group DBAL-220
*/
- public function testCreateNonClusteredPrimaryKey()
+ public function testCreateNonClusteredPrimaryKey() : void
{
$idx = new Index('idx', ['id'], false, true);
$idx->addFlag('nonclustered');
self::assertEquals('ALTER TABLE tbl ADD PRIMARY KEY NONCLUSTERED (id)', $this->platform->getCreatePrimaryKeySQL($idx, 'tbl'));
}
- public function testAlterAddPrimaryKey()
+ public function testAlterAddPrimaryKey() : void
{
$idx = new Index('idx', ['id'], false, true);
self::assertEquals('ALTER TABLE tbl ADD PRIMARY KEY (id)', $this->platform->getCreateIndexSQL($idx, 'tbl'));
}
- protected function getQuotedColumnInPrimaryKeySQL()
+ /**
+ * {@inheritDoc}
+ */
+ protected function getQuotedColumnInPrimaryKeySQL() : array
{
return ['CREATE TABLE [quoted] ([create] NVARCHAR(255) NOT NULL, PRIMARY KEY ([create]))'];
}
- protected function getQuotedColumnInIndexSQL()
+ /**
+ * {@inheritDoc}
+ */
+ protected function getQuotedColumnInIndexSQL() : array
{
return [
'CREATE TABLE [quoted] ([create] NVARCHAR(255) NOT NULL)',
@@ -553,7 +565,10 @@ protected function getQuotedColumnInIndexSQL()
];
}
- protected function getQuotedNameInIndexSQL()
+ /**
+ * {@inheritDoc}
+ */
+ protected function getQuotedNameInIndexSQL() : array
{
return [
'CREATE TABLE test (column1 NVARCHAR(255) NOT NULL)',
@@ -561,7 +576,10 @@ protected function getQuotedNameInIndexSQL()
];
}
- protected function getQuotedColumnInForeignKeySQL()
+ /**
+ * {@inheritDoc}
+ */
+ protected function getQuotedColumnInForeignKeySQL() : array
{
return [
'CREATE TABLE [quoted] ([create] NVARCHAR(255) NOT NULL, foo NVARCHAR(255) NOT NULL, [bar] NVARCHAR(255) NOT NULL)',
@@ -571,14 +589,14 @@ protected function getQuotedColumnInForeignKeySQL()
];
}
- public function testGetCreateSchemaSQL()
+ public function testGetCreateSchemaSQL() : void
{
$schemaName = 'schema';
$sql = $this->platform->getCreateSchemaSQL($schemaName);
self::assertEquals('CREATE SCHEMA ' . $schemaName, $sql);
}
- public function testCreateTableWithSchemaColumnComments()
+ public function testCreateTableWithSchemaColumnComments() : void
{
$table = new Table('testschema.test');
$table->addColumn('id', 'integer', ['comment' => 'This is a comment']);
@@ -592,7 +610,7 @@ public function testCreateTableWithSchemaColumnComments()
self::assertEquals($expectedSql, $this->platform->getCreateTableSQL($table));
}
- public function testAlterTableWithSchemaColumnComments()
+ public function testAlterTableWithSchemaColumnComments() : void
{
$tableDiff = new TableDiff('testschema.mytable');
$tableDiff->addedColumns['quota'] = new Column('quota', Type::getType('integer'), ['comment' => 'A comment']);
@@ -605,7 +623,7 @@ public function testAlterTableWithSchemaColumnComments()
self::assertEquals($expectedSql, $this->platform->getAlterTableSQL($tableDiff));
}
- public function testAlterTableWithSchemaDropColumnComments()
+ public function testAlterTableWithSchemaDropColumnComments() : void
{
$tableDiff = new TableDiff('testschema.mytable');
$tableDiff->changedColumns['quota'] = new ColumnDiff(
@@ -620,7 +638,7 @@ public function testAlterTableWithSchemaDropColumnComments()
self::assertEquals($expectedSql, $this->platform->getAlterTableSQL($tableDiff));
}
- public function testAlterTableWithSchemaUpdateColumnComments()
+ public function testAlterTableWithSchemaUpdateColumnComments() : void
{
$tableDiff = new TableDiff('testschema.mytable');
$tableDiff->changedColumns['quota'] = new ColumnDiff(
@@ -636,9 +654,11 @@ public function testAlterTableWithSchemaUpdateColumnComments()
}
/**
+ * {@inheritDoc}
+ *
* @group DBAL-543
*/
- public function getCreateTableColumnCommentsSQL()
+ public function getCreateTableColumnCommentsSQL() : array
{
return [
'CREATE TABLE test (id INT NOT NULL, PRIMARY KEY (id))',
@@ -647,9 +667,11 @@ public function getCreateTableColumnCommentsSQL()
}
/**
+ * {@inheritDoc}
+ *
* @group DBAL-543
*/
- public function getAlterTableColumnCommentsSQL()
+ public function getAlterTableColumnCommentsSQL() : array
{
return [
'ALTER TABLE mytable ADD quota INT NOT NULL',
@@ -660,9 +682,11 @@ public function getAlterTableColumnCommentsSQL()
}
/**
+ * {@inheritDoc}
+ *
* @group DBAL-543
*/
- public function getCreateTableColumnTypeCommentsSQL()
+ public function getCreateTableColumnTypeCommentsSQL() : array
{
return [
'CREATE TABLE test (id INT NOT NULL, data VARCHAR(MAX) NOT NULL, PRIMARY KEY (id))',
@@ -673,7 +697,7 @@ public function getCreateTableColumnTypeCommentsSQL()
/**
* @group DBAL-543
*/
- public function testGeneratesCreateTableSQLWithColumnComments()
+ public function testGeneratesCreateTableSQLWithColumnComments() : void
{
$table = new Table('mytable');
$table->addColumn('id', 'integer', ['autoincrement' => true]);
@@ -712,7 +736,7 @@ public function testGeneratesCreateTableSQLWithColumnComments()
* @group DBAL-543
* @group DBAL-1011
*/
- public function testGeneratesAlterTableSQLWithColumnComments()
+ public function testGeneratesAlterTableSQLWithColumnComments() : void
{
$table = new Table('mytable');
$table->addColumn('id', 'integer', ['autoincrement' => true]);
@@ -894,7 +918,7 @@ public function testGeneratesAlterTableSQLWithColumnComments()
/**
* @group DBAL-122
*/
- public function testInitializesDoctrineTypeMappings()
+ public function testInitializesDoctrineTypeMappings() : void
{
self::assertTrue($this->platform->hasDoctrineTypeMappingFor('bigint'));
self::assertSame('bigint', $this->platform->getDoctrineTypeMapping('bigint'));
@@ -972,12 +996,12 @@ public function testInitializesDoctrineTypeMappings()
self::assertSame('guid', $this->platform->getDoctrineTypeMapping('uniqueidentifier'));
}
- protected function getBinaryMaxLength()
+ protected function getBinaryMaxLength() : int
{
return 8000;
}
- public function testReturnsBinaryTypeDeclarationSQL()
+ public function testReturnsBinaryTypeDeclarationSQL() : void
{
self::assertSame('VARBINARY(255)', $this->platform->getBinaryTypeDeclarationSQL([]));
self::assertSame('VARBINARY(255)', $this->platform->getBinaryTypeDeclarationSQL(['length' => 0]));
@@ -992,24 +1016,28 @@ public function testReturnsBinaryTypeDeclarationSQL()
* @group legacy
* @expectedDeprecation Binary field length 8001 is greater than supported by the platform (8000). Reduce the field length or use a BLOB field instead.
*/
- public function testReturnsBinaryTypeLongerThanMaxDeclarationSQL()
+ public function testReturnsBinaryTypeLongerThanMaxDeclarationSQL() : void
{
self::assertSame('VARBINARY(MAX)', $this->platform->getBinaryTypeDeclarationSQL(['length' => 8001]));
self::assertSame('VARBINARY(MAX)', $this->platform->getBinaryTypeDeclarationSQL(['fixed' => true, 'length' => 8001]));
}
/**
+ * {@inheritDoc}
+ *
* @group DBAL-234
*/
- protected function getAlterTableRenameIndexSQL()
+ protected function getAlterTableRenameIndexSQL() : array
{
return ["EXEC sp_RENAME N'mytable.idx_foo', N'idx_bar', N'INDEX'"];
}
/**
+ * {@inheritDoc}
+ *
* @group DBAL-234
*/
- protected function getQuotedAlterTableRenameIndexSQL()
+ protected function getQuotedAlterTableRenameIndexSQL() : array
{
return [
"EXEC sp_RENAME N'[table].[create]', N'[select]', N'INDEX'",
@@ -1020,7 +1048,7 @@ protected function getQuotedAlterTableRenameIndexSQL()
/**
* @group DBAL-825
*/
- public function testChangeColumnsTypeWithDefaultValue()
+ public function testChangeColumnsTypeWithDefaultValue() : void
{
$tableName = 'column_def_change_type';
$table = new Table($tableName);
@@ -1062,7 +1090,7 @@ public function testChangeColumnsTypeWithDefaultValue()
/**
* {@inheritdoc}
*/
- protected function getQuotedAlterTableRenameColumnSQL()
+ protected function getQuotedAlterTableRenameColumnSQL() : array
{
return [
"sp_RENAME 'mytable.unquoted1', 'unquoted', 'COLUMN'",
@@ -1080,23 +1108,27 @@ protected function getQuotedAlterTableRenameColumnSQL()
/**
* {@inheritdoc}
*/
- protected function getQuotedAlterTableChangeColumnLengthSQL()
+ protected function getQuotedAlterTableChangeColumnLengthSQL() : array
{
$this->markTestIncomplete('Not implemented yet');
}
/**
+ * {@inheritDoc}
+ *
* @group DBAL-807
*/
- protected function getAlterTableRenameIndexInSchemaSQL()
+ protected function getAlterTableRenameIndexInSchemaSQL() : array
{
return ["EXEC sp_RENAME N'myschema.mytable.idx_foo', N'idx_bar', N'INDEX'"];
}
/**
+ * {@inheritDoc}
+ *
* @group DBAL-807
*/
- protected function getQuotedAlterTableRenameIndexInSchemaSQL()
+ protected function getQuotedAlterTableRenameIndexInSchemaSQL() : array
{
return [
"EXEC sp_RENAME N'[schema].[table].[create]', N'[select]', N'INDEX'",
@@ -1104,26 +1136,31 @@ protected function getQuotedAlterTableRenameIndexInSchemaSQL()
];
}
- protected function getQuotesDropForeignKeySQL()
+ protected function getQuotesDropForeignKeySQL() : string
{
return 'ALTER TABLE [table] DROP CONSTRAINT [select]';
}
- protected function getQuotesDropConstraintSQL()
+ protected function getQuotesDropConstraintSQL() : string
{
return 'ALTER TABLE [table] DROP CONSTRAINT [select]';
}
/**
+ * @param mixed[] $column
+ *
* @dataProvider getGeneratesIdentifierNamesInDefaultConstraintDeclarationSQL
* @group DBAL-830
*/
- public function testGeneratesIdentifierNamesInDefaultConstraintDeclarationSQL($table, $column, $expectedSql)
+ public function testGeneratesIdentifierNamesInDefaultConstraintDeclarationSQL(string $table, array $column, string $expectedSql) : void
{
self::assertSame($expectedSql, $this->platform->getDefaultConstraintDeclarationSQL($table, $column));
}
- public function getGeneratesIdentifierNamesInDefaultConstraintDeclarationSQL()
+ /**
+ * @return mixed[][]
+ */
+ public static function getGeneratesIdentifierNamesInDefaultConstraintDeclarationSQL() : iterable
{
return [
// Unquoted identifiers non-reserved keywords.
@@ -1138,15 +1175,20 @@ public function getGeneratesIdentifierNamesInDefaultConstraintDeclarationSQL()
}
/**
+ * @param string[] $expectedSql
+ *
* @dataProvider getGeneratesIdentifierNamesInCreateTableSQL
* @group DBAL-830
*/
- public function testGeneratesIdentifierNamesInCreateTableSQL($table, $expectedSql)
+ public function testGeneratesIdentifierNamesInCreateTableSQL(Table $table, array $expectedSql) : void
{
self::assertSame($expectedSql, $this->platform->getCreateTableSQL($table));
}
- public function getGeneratesIdentifierNamesInCreateTableSQL()
+ /**
+ * @return mixed[][]
+ */
+ public static function getGeneratesIdentifierNamesInCreateTableSQL() : iterable
{
return [
// Unquoted identifiers non-reserved keywords.
@@ -1185,15 +1227,20 @@ public function getGeneratesIdentifierNamesInCreateTableSQL()
}
/**
+ * @param string[] $expectedSql
+ *
* @dataProvider getGeneratesIdentifierNamesInAlterTableSQL
* @group DBAL-830
*/
- public function testGeneratesIdentifierNamesInAlterTableSQL($tableDiff, $expectedSql)
+ public function testGeneratesIdentifierNamesInAlterTableSQL(TableDiff $tableDiff, array $expectedSql) : void
{
self::assertSame($expectedSql, $this->platform->getAlterTableSQL($tableDiff));
}
- public function getGeneratesIdentifierNamesInAlterTableSQL()
+ /**
+ * @return mixed[][]
+ */
+ public static function getGeneratesIdentifierNamesInAlterTableSQL() : iterable
{
return [
// Unquoted identifiers non-reserved keywords.
@@ -1298,7 +1345,7 @@ public function getGeneratesIdentifierNamesInAlterTableSQL()
/**
* @group DBAL-423
*/
- public function testReturnsGuidTypeDeclarationSQL()
+ public function testReturnsGuidTypeDeclarationSQL() : void
{
self::assertSame('UNIQUEIDENTIFIER', $this->platform->getGuidTypeDeclarationSQL([]));
}
@@ -1306,7 +1353,7 @@ public function testReturnsGuidTypeDeclarationSQL()
/**
* {@inheritdoc}
*/
- public function getAlterTableRenameColumnSQL()
+ public function getAlterTableRenameColumnSQL() : array
{
return [
"sp_RENAME 'foo.bar', 'baz', 'COLUMN'",
@@ -1318,7 +1365,7 @@ public function getAlterTableRenameColumnSQL()
/**
* {@inheritdoc}
*/
- protected function getQuotesTableIdentifiersInAlterTableSQL()
+ protected function getQuotesTableIdentifiersInAlterTableSQL() : array
{
return [
'ALTER TABLE [foo] DROP CONSTRAINT fk1',
@@ -1340,7 +1387,7 @@ protected function getQuotesTableIdentifiersInAlterTableSQL()
/**
* {@inheritdoc}
*/
- protected function getCommentOnColumnSQL()
+ protected function getCommentOnColumnSQL() : array
{
return [
"COMMENT ON COLUMN foo.bar IS 'comment'",
@@ -1352,7 +1399,7 @@ protected function getCommentOnColumnSQL()
/**
* {@inheritdoc}
*/
- public function getReturnsForeignKeyReferentialActionSQL()
+ public static function getReturnsForeignKeyReferentialActionSQL() : iterable
{
return [
['CASCADE', 'CASCADE'],
@@ -1367,7 +1414,7 @@ public function getReturnsForeignKeyReferentialActionSQL()
/**
* {@inheritdoc}
*/
- protected function getQuotesReservedKeywordInUniqueConstraintDeclarationSQL()
+ protected function getQuotesReservedKeywordInUniqueConstraintDeclarationSQL() : string
{
return 'CONSTRAINT [select] UNIQUE (foo) WHERE foo IS NOT NULL';
}
@@ -1375,7 +1422,7 @@ protected function getQuotesReservedKeywordInUniqueConstraintDeclarationSQL()
/**
* {@inheritdoc}
*/
- protected function getQuotesReservedKeywordInIndexDeclarationSQL()
+ protected function getQuotesReservedKeywordInIndexDeclarationSQL() : string
{
return 'INDEX [select] (foo)';
}
@@ -1383,7 +1430,7 @@ protected function getQuotesReservedKeywordInIndexDeclarationSQL()
/**
* {@inheritdoc}
*/
- protected function getQuotesReservedKeywordInTruncateTableSQL()
+ protected function getQuotesReservedKeywordInTruncateTableSQL() : string
{
return 'TRUNCATE TABLE [select]';
}
@@ -1391,7 +1438,7 @@ protected function getQuotesReservedKeywordInTruncateTableSQL()
/**
* {@inheritdoc}
*/
- protected function getAlterStringToFixedStringSQL()
+ protected function getAlterStringToFixedStringSQL() : array
{
return ['ALTER TABLE mytable ALTER COLUMN name NCHAR(2) NOT NULL'];
}
@@ -1399,12 +1446,12 @@ protected function getAlterStringToFixedStringSQL()
/**
* {@inheritdoc}
*/
- protected function getGeneratesAlterTableRenameIndexUsedByForeignKeySQL()
+ protected function getGeneratesAlterTableRenameIndexUsedByForeignKeySQL() : array
{
return ["EXEC sp_RENAME N'mytable.idx_foo', N'idx_foo_renamed', N'INDEX'"];
}
- public function testModifyLimitQueryWithTopNSubQueryWithOrderBy()
+ public function testModifyLimitQueryWithTopNSubQueryWithOrderBy() : void
{
$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)';
@@ -1420,7 +1467,7 @@ public function testModifyLimitQueryWithTopNSubQueryWithOrderBy()
/**
* @group DBAL-2436
*/
- public function testQuotesTableNameInListTableColumnsSQL()
+ public function testQuotesTableNameInListTableColumnsSQL() : void
{
self::assertStringContainsStringIgnoringCase(
"'Foo''Bar\\'",
@@ -1431,7 +1478,7 @@ public function testQuotesTableNameInListTableColumnsSQL()
/**
* @group DBAL-2436
*/
- public function testQuotesSchemaNameInListTableColumnsSQL()
+ public function testQuotesSchemaNameInListTableColumnsSQL() : void
{
self::assertStringContainsStringIgnoringCase(
"'Foo''Bar\\'",
@@ -1442,7 +1489,7 @@ public function testQuotesSchemaNameInListTableColumnsSQL()
/**
* @group DBAL-2436
*/
- public function testQuotesTableNameInListTableForeignKeysSQL()
+ public function testQuotesTableNameInListTableForeignKeysSQL() : void
{
self::assertStringContainsStringIgnoringCase(
"'Foo''Bar\\'",
@@ -1453,7 +1500,7 @@ public function testQuotesTableNameInListTableForeignKeysSQL()
/**
* @group DBAL-2436
*/
- public function testQuotesSchemaNameInListTableForeignKeysSQL()
+ public function testQuotesSchemaNameInListTableForeignKeysSQL() : void
{
self::assertStringContainsStringIgnoringCase(
"'Foo''Bar\\'",
@@ -1464,7 +1511,7 @@ public function testQuotesSchemaNameInListTableForeignKeysSQL()
/**
* @group DBAL-2436
*/
- public function testQuotesTableNameInListTableIndexesSQL()
+ public function testQuotesTableNameInListTableIndexesSQL() : void
{
self::assertStringContainsStringIgnoringCase(
"'Foo''Bar\\'",
@@ -1475,7 +1522,7 @@ public function testQuotesTableNameInListTableIndexesSQL()
/**
* @group DBAL-2436
*/
- public function testQuotesSchemaNameInListTableIndexesSQL()
+ public function testQuotesSchemaNameInListTableIndexesSQL() : void
{
self::assertStringContainsStringIgnoringCase(
"'Foo''Bar\\'",
diff --git a/tests/Doctrine/Tests/DBAL/Platforms/DB2PlatformTest.php b/tests/Doctrine/Tests/DBAL/Platforms/DB2PlatformTest.php
index f1260b2d5c1..a0c1f1f4b4b 100644
--- a/tests/Doctrine/Tests/DBAL/Platforms/DB2PlatformTest.php
+++ b/tests/Doctrine/Tests/DBAL/Platforms/DB2PlatformTest.php
@@ -17,12 +17,15 @@ class DB2PlatformTest extends AbstractPlatformTestCase
/** @var DB2Platform */
protected $platform;
- public function createPlatform()
+ public function createPlatform() : AbstractPlatform
{
return new DB2Platform();
}
- public function getGenerateAlterTableSql()
+ /**
+ * {@inheritDoc}
+ */
+ public function getGenerateAlterTableSql() : array
{
return [
'ALTER TABLE mytable ALTER COLUMN baz SET DATA TYPE VARCHAR(255)',
@@ -39,22 +42,25 @@ public function getGenerateAlterTableSql()
];
}
- public function getGenerateForeignKeySql()
+ public function getGenerateForeignKeySql() : string
{
return 'ALTER TABLE test ADD FOREIGN KEY (fk_name_id) REFERENCES other_table (id)';
}
- public function getGenerateIndexSql()
+ public function getGenerateIndexSql() : string
{
return 'CREATE INDEX my_idx ON mytable (user_name, last_login)';
}
- public function getGenerateTableSql()
+ public function getGenerateTableSql() : string
{
return 'CREATE TABLE test (id INTEGER GENERATED BY DEFAULT AS IDENTITY NOT NULL, test VARCHAR(255) DEFAULT NULL, PRIMARY KEY(id))';
}
- public function getGenerateTableWithMultiColumnUniqueIndexSql()
+ /**
+ * {@inheritDoc}
+ */
+ public function getGenerateTableWithMultiColumnUniqueIndexSql() : array
{
return [
'CREATE TABLE test (foo VARCHAR(255) DEFAULT NULL, bar VARCHAR(255) DEFAULT NULL)',
@@ -62,12 +68,15 @@ public function getGenerateTableWithMultiColumnUniqueIndexSql()
];
}
- public function getGenerateUniqueIndexSql()
+ public function getGenerateUniqueIndexSql() : string
{
return 'CREATE UNIQUE INDEX index_name ON test (test, test2)';
}
- protected function getQuotedColumnInForeignKeySQL()
+ /**
+ * {@inheritDoc}
+ */
+ protected function getQuotedColumnInForeignKeySQL() : array
{
return [
'CREATE TABLE "quoted" ("create" VARCHAR(255) NOT NULL, foo VARCHAR(255) NOT NULL, "bar" VARCHAR(255) NOT NULL)',
@@ -77,7 +86,10 @@ protected function getQuotedColumnInForeignKeySQL()
];
}
- protected function getQuotedColumnInIndexSQL()
+ /**
+ * {@inheritDoc}
+ */
+ protected function getQuotedColumnInIndexSQL() : array
{
return [
'CREATE TABLE "quoted" ("create" VARCHAR(255) NOT NULL)',
@@ -85,7 +97,10 @@ protected function getQuotedColumnInIndexSQL()
];
}
- protected function getQuotedNameInIndexSQL()
+ /**
+ * {@inheritDoc}
+ */
+ protected function getQuotedNameInIndexSQL() : array
{
return [
'CREATE TABLE test (column1 VARCHAR(255) NOT NULL)',
@@ -93,22 +108,28 @@ protected function getQuotedNameInIndexSQL()
];
}
- protected function getQuotedColumnInPrimaryKeySQL()
+ /**
+ * {@inheritDoc}
+ */
+ protected function getQuotedColumnInPrimaryKeySQL() : array
{
return ['CREATE TABLE "quoted" ("create" VARCHAR(255) NOT NULL, PRIMARY KEY("create"))'];
}
- protected function getBitAndComparisonExpressionSql($value1, $value2)
+ protected function getBitAndComparisonExpressionSql(string $value1, string $value2) : string
{
return 'BITAND(' . $value1 . ', ' . $value2 . ')';
}
- protected function getBitOrComparisonExpressionSql($value1, $value2)
+ protected function getBitOrComparisonExpressionSql(string $value1, string $value2) : string
{
return 'BITOR(' . $value1 . ', ' . $value2 . ')';
}
- public function getCreateTableColumnCommentsSQL()
+ /**
+ * {@inheritDoc}
+ */
+ public function getCreateTableColumnCommentsSQL() : array
{
return [
'CREATE TABLE test (id INTEGER NOT NULL, PRIMARY KEY(id))',
@@ -116,7 +137,10 @@ public function getCreateTableColumnCommentsSQL()
];
}
- public function getAlterTableColumnCommentsSQL()
+ /**
+ * {@inheritDoc}
+ */
+ public function getAlterTableColumnCommentsSQL() : array
{
return [
'ALTER TABLE mytable ' .
@@ -128,7 +152,10 @@ public function getAlterTableColumnCommentsSQL()
];
}
- public function getCreateTableColumnTypeCommentsSQL()
+ /**
+ * {@inheritDoc}
+ */
+ public function getCreateTableColumnTypeCommentsSQL() : array
{
return [
'CREATE TABLE test (id INTEGER NOT NULL, "data" CLOB(1M) NOT NULL, PRIMARY KEY(id))',
@@ -136,12 +163,12 @@ public function getCreateTableColumnTypeCommentsSQL()
];
}
- public function testHasCorrectPlatformName()
+ public function testHasCorrectPlatformName() : void
{
self::assertEquals('db2', $this->platform->getName());
}
- public function testGeneratesCreateTableSQLWithCommonIndexes()
+ public function testGeneratesCreateTableSQLWithCommonIndexes() : void
{
$table = new Table('test');
$table->addColumn('id', 'integer');
@@ -160,7 +187,7 @@ public function testGeneratesCreateTableSQLWithCommonIndexes()
);
}
- public function testGeneratesCreateTableSQLWithForeignKeyConstraints()
+ public function testGeneratesCreateTableSQLWithForeignKeyConstraints() : void
{
$table = new Table('test');
$table->addColumn('id', 'integer');
@@ -186,7 +213,7 @@ public function testGeneratesCreateTableSQLWithForeignKeyConstraints()
);
}
- public function testGeneratesCreateTableSQLWithCheckConstraints()
+ public function testGeneratesCreateTableSQLWithCheckConstraints() : void
{
$table = new Table('test');
$table->addColumn('id', 'integer');
@@ -200,7 +227,7 @@ public function testGeneratesCreateTableSQLWithCheckConstraints()
);
}
- public function testGeneratesColumnTypesDeclarationSQL()
+ public function testGeneratesColumnTypesDeclarationSQL() : void
{
$fullColumnDef = [
'length' => 10,
@@ -232,7 +259,7 @@ public function testGeneratesColumnTypesDeclarationSQL()
self::assertEquals('TIME', $this->platform->getTimeTypeDeclarationSQL($fullColumnDef));
}
- public function testInitializesDoctrineTypeMappings()
+ public function testInitializesDoctrineTypeMappings() : void
{
$this->platform->initializeDoctrineTypeMappings();
@@ -276,7 +303,10 @@ public function testInitializesDoctrineTypeMappings()
self::assertSame('datetime', $this->platform->getDoctrineTypeMapping('timestamp'));
}
- public function getIsCommentedDoctrineType()
+ /**
+ * {@inheritDoc}
+ */
+ public function getIsCommentedDoctrineType() : array
{
$data = parent::getIsCommentedDoctrineType();
@@ -285,7 +315,7 @@ public function getIsCommentedDoctrineType()
return $data;
}
- public function testGeneratesDDLSnippets()
+ public function testGeneratesDDLSnippets() : void
{
self::assertEquals('CREATE DATABASE foobar', $this->platform->getCreateDatabaseSQL('foobar'));
self::assertEquals('DROP DATABASE foobar', $this->platform->getDropDatabaseSQL('foobar'));
@@ -298,7 +328,7 @@ public function testGeneratesDDLSnippets()
self::assertEquals('DROP VIEW fooview', $this->platform->getDropViewSQL('fooview'));
}
- public function testGeneratesCreateUnnamedPrimaryKeySQL()
+ public function testGeneratesCreateUnnamedPrimaryKeySQL() : void
{
self::assertEquals(
'ALTER TABLE foo ADD PRIMARY KEY (a, b)',
@@ -309,7 +339,7 @@ public function testGeneratesCreateUnnamedPrimaryKeySQL()
);
}
- public function testGeneratesSQLSnippets()
+ public function testGeneratesSQLSnippets() : void
{
self::assertEquals('CURRENT DATE', $this->platform->getCurrentDateSQL());
self::assertEquals('CURRENT TIME', $this->platform->getCurrentTimeSQL());
@@ -339,7 +369,7 @@ public function testGeneratesSQLSnippets()
self::assertEquals('SUBSTR(column, 5, 2)', $this->platform->getSubstringExpression('column', 5, 2));
}
- public function testModifiesLimitQuery()
+ public function testModifiesLimitQuery() : void
{
self::assertEquals(
'SELECT * FROM user',
@@ -366,47 +396,47 @@ public function testModifiesLimitQuery()
);
}
- public function testPrefersIdentityColumns()
+ public function testPrefersIdentityColumns() : void
{
self::assertTrue($this->platform->prefersIdentityColumns());
}
- public function testSupportsIdentityColumns()
+ public function testSupportsIdentityColumns() : void
{
self::assertTrue($this->platform->supportsIdentityColumns());
}
- public function testDoesNotSupportSavePoints()
+ public function testDoesNotSupportSavePoints() : void
{
self::assertFalse($this->platform->supportsSavepoints());
}
- public function testDoesNotSupportReleasePoints()
+ public function testDoesNotSupportReleasePoints() : void
{
self::assertFalse($this->platform->supportsReleaseSavepoints());
}
- public function testDoesNotSupportCreateDropDatabase()
+ public function testDoesNotSupportCreateDropDatabase() : void
{
self::assertFalse($this->platform->supportsCreateDropDatabase());
}
- public function testReturnsSQLResultCasing()
+ public function testReturnsSQLResultCasing() : void
{
self::assertSame('COL', $this->platform->getSQLResultCasing('cOl'));
}
- protected function getBinaryDefaultLength()
+ protected function getBinaryDefaultLength() : int
{
return 1;
}
- protected function getBinaryMaxLength()
+ protected function getBinaryMaxLength() : int
{
return 32704;
}
- public function testReturnsBinaryTypeDeclarationSQL()
+ public function testReturnsBinaryTypeDeclarationSQL() : void
{
self::assertSame('VARCHAR(1) FOR BIT DATA', $this->platform->getBinaryTypeDeclarationSQL([]));
self::assertSame('VARCHAR(255) FOR BIT DATA', $this->platform->getBinaryTypeDeclarationSQL(['length' => 0]));
@@ -420,24 +450,28 @@ public function testReturnsBinaryTypeDeclarationSQL()
* @group legacy
* @expectedDeprecation Binary field length 32705 is greater than supported by the platform (32704). Reduce the field length or use a BLOB field instead.
*/
- public function testReturnsBinaryTypeLongerThanMaxDeclarationSQL()
+ public function testReturnsBinaryTypeLongerThanMaxDeclarationSQL() : void
{
self::assertSame('BLOB(1M)', $this->platform->getBinaryTypeDeclarationSQL(['length' => 32705]));
self::assertSame('BLOB(1M)', $this->platform->getBinaryTypeDeclarationSQL(['fixed' => true, 'length' => 32705]));
}
/**
+ * {@inheritDoc}
+ *
* @group DBAL-234
*/
- protected function getAlterTableRenameIndexSQL()
+ protected function getAlterTableRenameIndexSQL() : array
{
return ['RENAME INDEX idx_foo TO idx_bar'];
}
/**
+ * {@inheritDoc}
+ *
* @group DBAL-234
*/
- protected function getQuotedAlterTableRenameIndexSQL()
+ protected function getQuotedAlterTableRenameIndexSQL() : array
{
return [
'RENAME INDEX "create" TO "select"',
@@ -448,7 +482,7 @@ protected function getQuotedAlterTableRenameIndexSQL()
/**
* {@inheritdoc}
*/
- protected function getQuotedAlterTableRenameColumnSQL()
+ protected function getQuotedAlterTableRenameColumnSQL() : array
{
return ['ALTER TABLE mytable ' .
'RENAME COLUMN unquoted1 TO unquoted ' .
@@ -466,23 +500,27 @@ protected function getQuotedAlterTableRenameColumnSQL()
/**
* {@inheritdoc}
*/
- protected function getQuotedAlterTableChangeColumnLengthSQL()
+ protected function getQuotedAlterTableChangeColumnLengthSQL() : array
{
$this->markTestIncomplete('Not implemented yet');
}
/**
+ * {@inheritDoc}
+ *
* @group DBAL-807
*/
- protected function getAlterTableRenameIndexInSchemaSQL()
+ protected function getAlterTableRenameIndexInSchemaSQL() : array
{
return ['RENAME INDEX myschema.idx_foo TO idx_bar'];
}
/**
+ * {@inheritDoc}
+ *
* @group DBAL-807
*/
- protected function getQuotedAlterTableRenameIndexInSchemaSQL()
+ protected function getQuotedAlterTableRenameIndexInSchemaSQL() : array
{
return [
'RENAME INDEX "schema"."create" TO "select"',
@@ -493,7 +531,7 @@ protected function getQuotedAlterTableRenameIndexInSchemaSQL()
/**
* @group DBAL-423
*/
- public function testReturnsGuidTypeDeclarationSQL()
+ public function testReturnsGuidTypeDeclarationSQL() : void
{
self::assertSame('CHAR(36)', $this->platform->getGuidTypeDeclarationSQL([]));
}
@@ -501,7 +539,7 @@ public function testReturnsGuidTypeDeclarationSQL()
/**
* {@inheritdoc}
*/
- public function getAlterTableRenameColumnSQL()
+ public function getAlterTableRenameColumnSQL() : array
{
return ['ALTER TABLE foo RENAME COLUMN bar TO baz'];
}
@@ -509,7 +547,7 @@ public function getAlterTableRenameColumnSQL()
/**
* {@inheritdoc}
*/
- protected function getQuotesTableIdentifiersInAlterTableSQL()
+ protected function getQuotesTableIdentifiersInAlterTableSQL() : array
{
return [
'ALTER TABLE "foo" DROP FOREIGN KEY fk1',
@@ -529,7 +567,7 @@ protected function getQuotesTableIdentifiersInAlterTableSQL()
/**
* {@inheritdoc}
*/
- protected function getCommentOnColumnSQL()
+ protected function getCommentOnColumnSQL() : array
{
return [
'COMMENT ON COLUMN foo.bar IS \'comment\'',
@@ -542,7 +580,7 @@ protected function getCommentOnColumnSQL()
* @group DBAL-944
* @dataProvider getGeneratesAlterColumnSQL
*/
- public function testGeneratesAlterColumnSQL($changedProperty, Column $column, $expectedSQLClause = null)
+ public function testGeneratesAlterColumnSQL(string $changedProperty, Column $column, ?string $expectedSQLClause = null) : void
{
$tableDiff = new TableDiff('foo');
$tableDiff->fromTable = new Table('foo');
@@ -560,9 +598,9 @@ public function testGeneratesAlterColumnSQL($changedProperty, Column $column, $e
}
/**
- * @return mixed[]
+ * @return mixed[][]
*/
- public function getGeneratesAlterColumnSQL()
+ public static function getGeneratesAlterColumnSQL() : iterable
{
return [
[
@@ -626,7 +664,7 @@ public function getGeneratesAlterColumnSQL()
/**
* {@inheritdoc}
*/
- protected function getQuotesReservedKeywordInUniqueConstraintDeclarationSQL()
+ protected function getQuotesReservedKeywordInUniqueConstraintDeclarationSQL() : string
{
return 'CONSTRAINT "select" UNIQUE (foo)';
}
@@ -634,7 +672,7 @@ protected function getQuotesReservedKeywordInUniqueConstraintDeclarationSQL()
/**
* {@inheritdoc}
*/
- protected function getQuotesReservedKeywordInIndexDeclarationSQL()
+ protected function getQuotesReservedKeywordInIndexDeclarationSQL() : string
{
return ''; // not supported by this platform
}
@@ -642,7 +680,7 @@ protected function getQuotesReservedKeywordInIndexDeclarationSQL()
/**
* {@inheritdoc}
*/
- protected function getQuotesReservedKeywordInTruncateTableSQL()
+ protected function getQuotesReservedKeywordInTruncateTableSQL() : string
{
return 'TRUNCATE "select" IMMEDIATE';
}
@@ -650,7 +688,7 @@ protected function getQuotesReservedKeywordInTruncateTableSQL()
/**
* {@inheritdoc}
*/
- protected function supportsInlineIndexDeclaration()
+ protected function supportsInlineIndexDeclaration() : bool
{
return false;
}
@@ -658,7 +696,7 @@ protected function supportsInlineIndexDeclaration()
/**
* {@inheritdoc}
*/
- protected function supportsCommentOnStatement()
+ protected function supportsCommentOnStatement() : bool
{
return true;
}
@@ -666,7 +704,7 @@ protected function supportsCommentOnStatement()
/**
* {@inheritdoc}
*/
- protected function getAlterStringToFixedStringSQL()
+ protected function getAlterStringToFixedStringSQL() : array
{
return [
'ALTER TABLE mytable ALTER COLUMN name SET DATA TYPE CHAR(2)',
@@ -677,7 +715,7 @@ protected function getAlterStringToFixedStringSQL()
/**
* {@inheritdoc}
*/
- protected function getGeneratesAlterTableRenameIndexUsedByForeignKeySQL()
+ protected function getGeneratesAlterTableRenameIndexUsedByForeignKeySQL() : array
{
return ['RENAME INDEX idx_foo TO idx_foo_renamed'];
}
@@ -685,7 +723,7 @@ protected function getGeneratesAlterTableRenameIndexUsedByForeignKeySQL()
/**
* @group DBAL-2436
*/
- public function testQuotesTableNameInListTableColumnsSQL()
+ public function testQuotesTableNameInListTableColumnsSQL() : void
{
self::assertStringContainsStringIgnoringCase(
"'Foo''Bar\\'",
@@ -696,7 +734,7 @@ public function testQuotesTableNameInListTableColumnsSQL()
/**
* @group DBAL-2436
*/
- public function testQuotesTableNameInListTableIndexesSQL()
+ public function testQuotesTableNameInListTableIndexesSQL() : void
{
self::assertStringContainsStringIgnoringCase(
"'Foo''Bar\\'",
@@ -707,7 +745,7 @@ public function testQuotesTableNameInListTableIndexesSQL()
/**
* @group DBAL-2436
*/
- public function testQuotesTableNameInListTableForeignKeysSQL()
+ public function testQuotesTableNameInListTableForeignKeysSQL() : void
{
self::assertStringContainsStringIgnoringCase(
"'Foo''Bar\\'",
diff --git a/tests/Doctrine/Tests/DBAL/Platforms/MariaDb1027PlatformTest.php b/tests/Doctrine/Tests/DBAL/Platforms/MariaDb1027PlatformTest.php
index 0903a511612..00b86088ad5 100644
--- a/tests/Doctrine/Tests/DBAL/Platforms/MariaDb1027PlatformTest.php
+++ b/tests/Doctrine/Tests/DBAL/Platforms/MariaDb1027PlatformTest.php
@@ -2,6 +2,7 @@
namespace Doctrine\Tests\DBAL\Platforms;
+use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Platforms\MariaDb1027Platform;
use Doctrine\DBAL\Types\Types;
@@ -10,7 +11,7 @@ class MariaDb1027PlatformTest extends AbstractMySQLPlatformTestCase
/**
* {@inheritdoc}
*/
- public function createPlatform() : MariaDb1027Platform
+ public function createPlatform() : AbstractPlatform
{
return new MariaDb1027Platform();
}
diff --git a/tests/Doctrine/Tests/DBAL/Platforms/MySQL57PlatformTest.php b/tests/Doctrine/Tests/DBAL/Platforms/MySQL57PlatformTest.php
index 90e3827566c..2557562ab95 100644
--- a/tests/Doctrine/Tests/DBAL/Platforms/MySQL57PlatformTest.php
+++ b/tests/Doctrine/Tests/DBAL/Platforms/MySQL57PlatformTest.php
@@ -2,6 +2,7 @@
namespace Doctrine\Tests\DBAL\Platforms;
+use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Platforms\MySQL57Platform;
use Doctrine\DBAL\Types\Types;
@@ -10,39 +11,43 @@ class MySQL57PlatformTest extends AbstractMySQLPlatformTestCase
/**
* {@inheritdoc}
*/
- public function createPlatform()
+ public function createPlatform() : AbstractPlatform
{
return new MySQL57Platform();
}
- public function testHasNativeJsonType()
+ public function testHasNativeJsonType() : void
{
self::assertTrue($this->platform->hasNativeJsonType());
}
- public function testReturnsJsonTypeDeclarationSQL()
+ public function testReturnsJsonTypeDeclarationSQL() : void
{
self::assertSame('JSON', $this->platform->getJsonTypeDeclarationSQL([]));
}
- public function testInitializesJsonTypeMapping()
+ public function testInitializesJsonTypeMapping() : void
{
self::assertTrue($this->platform->hasDoctrineTypeMappingFor('json'));
self::assertSame(Types::JSON, $this->platform->getDoctrineTypeMapping('json'));
}
/**
+ * @return string[]
+ *
* @group DBAL-234
*/
- protected function getAlterTableRenameIndexSQL()
+ protected function getAlterTableRenameIndexSQL() : array
{
return ['ALTER TABLE mytable RENAME INDEX idx_foo TO idx_bar'];
}
/**
+ * @return string[]
+ *
* @group DBAL-234
*/
- protected function getQuotedAlterTableRenameIndexSQL()
+ protected function getQuotedAlterTableRenameIndexSQL() : array
{
return [
'ALTER TABLE `table` RENAME INDEX `create` TO `select`',
@@ -51,17 +56,21 @@ protected function getQuotedAlterTableRenameIndexSQL()
}
/**
+ * @return string[]
+ *
* @group DBAL-807
*/
- protected function getAlterTableRenameIndexInSchemaSQL()
+ protected function getAlterTableRenameIndexInSchemaSQL() : array
{
return ['ALTER TABLE myschema.mytable RENAME INDEX idx_foo TO idx_bar'];
}
/**
+ * @return string[]
+ *
* @group DBAL-807
*/
- protected function getQuotedAlterTableRenameIndexInSchemaSQL()
+ protected function getQuotedAlterTableRenameIndexInSchemaSQL() : array
{
return [
'ALTER TABLE `schema`.`table` RENAME INDEX `create` TO `select`',
@@ -72,7 +81,7 @@ protected function getQuotedAlterTableRenameIndexInSchemaSQL()
/**
* {@inheritdoc}
*/
- protected function getGeneratesAlterTableRenameIndexUsedByForeignKeySQL()
+ protected function getGeneratesAlterTableRenameIndexUsedByForeignKeySQL() : array
{
return ['ALTER TABLE mytable RENAME INDEX idx_foo TO idx_foo_renamed'];
}
diff --git a/tests/Doctrine/Tests/DBAL/Platforms/MySqlPlatformTest.php b/tests/Doctrine/Tests/DBAL/Platforms/MySqlPlatformTest.php
index ec1f3181581..e8007baf55f 100644
--- a/tests/Doctrine/Tests/DBAL/Platforms/MySqlPlatformTest.php
+++ b/tests/Doctrine/Tests/DBAL/Platforms/MySqlPlatformTest.php
@@ -2,17 +2,18 @@
namespace Doctrine\Tests\DBAL\Platforms;
+use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Platforms\MySqlPlatform;
use Doctrine\DBAL\TransactionIsolationLevel;
class MySqlPlatformTest extends AbstractMySQLPlatformTestCase
{
- public function createPlatform()
+ public function createPlatform() : AbstractPlatform
{
return new MySqlPlatform();
}
- public function testHasCorrectDefaultTransactionIsolationLevel()
+ public function testHasCorrectDefaultTransactionIsolationLevel() : void
{
self::assertEquals(
TransactionIsolationLevel::REPEATABLE_READ,
diff --git a/tests/Doctrine/Tests/DBAL/Platforms/OraclePlatformTest.php b/tests/Doctrine/Tests/DBAL/Platforms/OraclePlatformTest.php
index 439c413d1a0..0dd4b304739 100644
--- a/tests/Doctrine/Tests/DBAL/Platforms/OraclePlatformTest.php
+++ b/tests/Doctrine/Tests/DBAL/Platforms/OraclePlatformTest.php
@@ -3,6 +3,7 @@
namespace Doctrine\Tests\DBAL\Platforms;
use Doctrine\DBAL\DBALException;
+use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Platforms\OraclePlatform;
use Doctrine\DBAL\Schema\Column;
use Doctrine\DBAL\Schema\ColumnDiff;
@@ -21,7 +22,10 @@
class OraclePlatformTest extends AbstractPlatformTestCase
{
- public static function dataValidIdentifiers()
+ /**
+ * @return mixed[][]
+ */
+ public static function dataValidIdentifiers() : iterable
{
return [
['a'],
@@ -39,7 +43,7 @@ public static function dataValidIdentifiers()
/**
* @dataProvider dataValidIdentifiers
*/
- public function testValidIdentifiers($identifier)
+ public function testValidIdentifiers(string $identifier) : void
{
$platform = $this->createPlatform();
$platform->assertValidIdentifier($identifier);
@@ -47,7 +51,10 @@ public function testValidIdentifiers($identifier)
$this->addToAssertionCount(1);
}
- public static function dataInvalidIdentifiers()
+ /**
+ * @return mixed[][]
+ */
+ public static function dataInvalidIdentifiers() : iterable
{
return [
['1'],
@@ -61,7 +68,7 @@ public static function dataInvalidIdentifiers()
/**
* @dataProvider dataInvalidIdentifiers
*/
- public function testInvalidIdentifiers($identifier)
+ public function testInvalidIdentifiers(string $identifier) : void
{
$this->expectException(DBALException::class);
@@ -69,17 +76,20 @@ public function testInvalidIdentifiers($identifier)
$platform->assertValidIdentifier($identifier);
}
- public function createPlatform()
+ public function createPlatform() : AbstractPlatform
{
return new OraclePlatform();
}
- public function getGenerateTableSql()
+ public function getGenerateTableSql() : string
{
return 'CREATE TABLE test (id NUMBER(10) NOT NULL, test VARCHAR2(255) DEFAULT NULL NULL, PRIMARY KEY(id))';
}
- public function getGenerateTableWithMultiColumnUniqueIndexSql()
+ /**
+ * @return mixed[]
+ */
+ public function getGenerateTableWithMultiColumnUniqueIndexSql() : array
{
return [
'CREATE TABLE test (foo VARCHAR2(255) DEFAULT NULL NULL, bar VARCHAR2(255) DEFAULT NULL NULL)',
@@ -87,7 +97,10 @@ public function getGenerateTableWithMultiColumnUniqueIndexSql()
];
}
- public function getGenerateAlterTableSql()
+ /**
+ * {@inheritDoc}
+ */
+ public function getGenerateAlterTableSql() : array
{
return [
'ALTER TABLE mytable ADD (quota NUMBER(10) DEFAULT NULL NULL)',
@@ -97,20 +110,20 @@ public function getGenerateAlterTableSql()
];
}
- public function testRLike()
+ public function testRLike() : void
{
$this->expectException(DBALException::class);
self::assertEquals('RLIKE', $this->platform->getRegexpExpression(), 'Regular expression operator is not correct');
}
- public function testGeneratesSqlSnippets()
+ public function testGeneratesSqlSnippets() : void
{
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()
+ public function testGeneratesTransactionsCommands() : void
{
self::assertEquals(
'SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED',
@@ -130,24 +143,24 @@ public function testGeneratesTransactionsCommands()
);
}
- public function testCreateDatabaseThrowsException()
+ public function testCreateDatabaseThrowsException() : void
{
$this->expectException(DBALException::class);
self::assertEquals('CREATE DATABASE foobar', $this->platform->getCreateDatabaseSQL('foobar'));
}
- public function testDropDatabaseThrowsException()
+ public function testDropDatabaseThrowsException() : void
{
self::assertEquals('DROP USER foobar CASCADE', $this->platform->getDropDatabaseSQL('foobar'));
}
- public function testDropTable()
+ public function testDropTable() : void
{
self::assertEquals('DROP TABLE foobar', $this->platform->getDropTableSQL('foobar'));
}
- public function testGeneratesTypeDeclarationForIntegers()
+ public function testGeneratesTypeDeclarationForIntegers() : void
{
self::assertEquals(
'NUMBER(10)',
@@ -165,7 +178,7 @@ public function testGeneratesTypeDeclarationForIntegers()
);
}
- public function testGeneratesTypeDeclarationsForStrings()
+ public function testGeneratesTypeDeclarationsForStrings() : void
{
self::assertEquals(
'CHAR(10)',
@@ -185,17 +198,17 @@ public function testGeneratesTypeDeclarationsForStrings()
);
}
- public function testPrefersIdentityColumns()
+ public function testPrefersIdentityColumns() : void
{
self::assertFalse($this->platform->prefersIdentityColumns());
}
- public function testSupportsIdentityColumns()
+ public function testSupportsIdentityColumns() : void
{
self::assertFalse($this->platform->supportsIdentityColumns());
}
- public function testSupportsSavePoints()
+ public function testSupportsSavePoints() : void
{
self::assertTrue($this->platform->supportsSavepoints());
}
@@ -203,22 +216,22 @@ public function testSupportsSavePoints()
/**
* {@inheritdoc}
*/
- protected function supportsCommentOnStatement()
+ protected function supportsCommentOnStatement() : bool
{
return true;
}
- public function getGenerateIndexSql()
+ public function getGenerateIndexSql() : string
{
return 'CREATE INDEX my_idx ON mytable (user_name, last_login)';
}
- public function getGenerateUniqueIndexSql()
+ public function getGenerateUniqueIndexSql() : string
{
return 'CREATE UNIQUE INDEX index_name ON test (test, test2)';
}
- public function getGenerateForeignKeySql()
+ public function getGenerateForeignKeySql() : string
{
return 'ALTER TABLE test ADD FOREIGN KEY (fk_name_id) REFERENCES other_table (id)';
}
@@ -229,7 +242,7 @@ public function getGenerateForeignKeySql()
* @group DBAL-1097
* @dataProvider getGeneratesAdvancedForeignKeyOptionsSQLData
*/
- public function testGeneratesAdvancedForeignKeyOptionsSQL(array $options, $expectedSql)
+ public function testGeneratesAdvancedForeignKeyOptionsSQL(array $options, string $expectedSql) : void
{
$foreignKey = new ForeignKeyConstraint(['foo'], 'foreign_table', ['bar'], null, $options);
@@ -237,9 +250,9 @@ public function testGeneratesAdvancedForeignKeyOptionsSQL(array $options, $expec
}
/**
- * @return mixed[]
+ * @return mixed[][]
*/
- public function getGeneratesAdvancedForeignKeyOptionsSQLData()
+ public static function getGeneratesAdvancedForeignKeyOptionsSQLData() : iterable
{
return [
[[], ''],
@@ -254,7 +267,7 @@ public function getGeneratesAdvancedForeignKeyOptionsSQLData()
/**
* {@inheritdoc}
*/
- public function getReturnsForeignKeyReferentialActionSQL()
+ public static function getReturnsForeignKeyReferentialActionSQL() : iterable
{
return [
['CASCADE', 'CASCADE'],
@@ -265,43 +278,43 @@ public function getReturnsForeignKeyReferentialActionSQL()
];
}
- public function testModifyLimitQuery()
+ public function testModifyLimitQuery() : void
{
$sql = $this->platform->modifyLimitQuery('SELECT * FROM user', 10, 0);
self::assertEquals('SELECT a.* FROM (SELECT * FROM user) a WHERE ROWNUM <= 10', $sql);
}
- public function testModifyLimitQueryWithEmptyOffset()
+ public function testModifyLimitQueryWithEmptyOffset() : void
{
$sql = $this->platform->modifyLimitQuery('SELECT * FROM user', 10);
self::assertEquals('SELECT a.* FROM (SELECT * FROM user) a WHERE ROWNUM <= 10', $sql);
}
- public function testModifyLimitQueryWithNonEmptyOffset()
+ public function testModifyLimitQueryWithNonEmptyOffset() : void
{
$sql = $this->platform->modifyLimitQuery('SELECT * FROM user', 10, 10);
self::assertEquals('SELECT * FROM (SELECT a.*, ROWNUM AS doctrine_rownum FROM (SELECT * FROM user) a WHERE ROWNUM <= 20) WHERE doctrine_rownum >= 11', $sql);
}
- public function testModifyLimitQueryWithEmptyLimit()
+ public function testModifyLimitQueryWithEmptyLimit() : void
{
$sql = $this->platform->modifyLimitQuery('SELECT * FROM user', null, 10);
self::assertEquals('SELECT * FROM (SELECT a.*, ROWNUM AS doctrine_rownum FROM (SELECT * FROM user) a) WHERE doctrine_rownum >= 11', $sql);
}
- public function testModifyLimitQueryWithAscOrderBy()
+ public function testModifyLimitQueryWithAscOrderBy() : void
{
$sql = $this->platform->modifyLimitQuery('SELECT * FROM user ORDER BY username ASC', 10);
self::assertEquals('SELECT a.* FROM (SELECT * FROM user ORDER BY username ASC) a WHERE ROWNUM <= 10', $sql);
}
- public function testModifyLimitQueryWithDescOrderBy()
+ public function testModifyLimitQueryWithDescOrderBy() : void
{
$sql = $this->platform->modifyLimitQuery('SELECT * FROM user ORDER BY username DESC', 10);
self::assertEquals('SELECT a.* FROM (SELECT * FROM user ORDER BY username DESC) a WHERE ROWNUM <= 10', $sql);
}
- public function testGenerateTableWithAutoincrement()
+ public function testGenerateTableWithAutoincrement() : void
{
$columnName = strtoupper('id' . uniqid());
$tableName = strtoupper('table' . uniqid());
@@ -335,7 +348,7 @@ public function testGenerateTableWithAutoincrement()
];
$statements = $this->platform->getCreateTableSQL($table);
//strip all the whitespace from the statements
- array_walk($statements, static function (&$value) {
+ array_walk($statements, static function (&$value) : void {
$value = preg_replace('/\s+/', ' ', $value);
});
foreach ($targets as $key => $sql) {
@@ -344,7 +357,10 @@ public function testGenerateTableWithAutoincrement()
}
}
- public function getCreateTableColumnCommentsSQL()
+ /**
+ * {@inheritDoc}
+ */
+ public function getCreateTableColumnCommentsSQL() : array
{
return [
'CREATE TABLE test (id NUMBER(10) NOT NULL, PRIMARY KEY(id))',
@@ -352,7 +368,10 @@ public function getCreateTableColumnCommentsSQL()
];
}
- public function getCreateTableColumnTypeCommentsSQL()
+ /**
+ * {@inheritDoc}
+ */
+ public function getCreateTableColumnTypeCommentsSQL() : array
{
return [
'CREATE TABLE test (id NUMBER(10) NOT NULL, data CLOB NOT NULL, PRIMARY KEY(id))',
@@ -360,7 +379,10 @@ public function getCreateTableColumnTypeCommentsSQL()
];
}
- public function getAlterTableColumnCommentsSQL()
+ /**
+ * {@inheritDoc}
+ */
+ public function getAlterTableColumnCommentsSQL() : array
{
return [
'ALTER TABLE mytable ADD (quota NUMBER(10) NOT NULL)',
@@ -370,24 +392,30 @@ public function getAlterTableColumnCommentsSQL()
];
}
- public function getBitAndComparisonExpressionSql($value1, $value2)
+ public function getBitAndComparisonExpressionSql(string $value1, string $value2) : string
{
return 'BITAND(' . $value1 . ', ' . $value2 . ')';
}
- public function getBitOrComparisonExpressionSql($value1, $value2)
+ public function getBitOrComparisonExpressionSql(string $value1, string $value2) : string
{
return '(' . $value1 . '-' .
$this->getBitAndComparisonExpressionSql($value1, $value2)
. '+' . $value2 . ')';
}
- protected function getQuotedColumnInPrimaryKeySQL()
+ /**
+ * @return mixed[]
+ */
+ protected function getQuotedColumnInPrimaryKeySQL() : array
{
return ['CREATE TABLE "quoted" ("create" VARCHAR2(255) NOT NULL, PRIMARY KEY("create"))'];
}
- protected function getQuotedColumnInIndexSQL()
+ /**
+ * @return mixed[]
+ */
+ protected function getQuotedColumnInIndexSQL() : array
{
return [
'CREATE TABLE "quoted" ("create" VARCHAR2(255) NOT NULL)',
@@ -395,7 +423,10 @@ protected function getQuotedColumnInIndexSQL()
];
}
- protected function getQuotedNameInIndexSQL()
+ /**
+ * @return mixed[]
+ */
+ protected function getQuotedNameInIndexSQL() : array
{
return [
'CREATE TABLE test (column1 VARCHAR2(255) NOT NULL)',
@@ -403,7 +434,10 @@ protected function getQuotedNameInIndexSQL()
];
}
- protected function getQuotedColumnInForeignKeySQL()
+ /**
+ * @return mixed[]
+ */
+ protected function getQuotedColumnInForeignKeySQL() : array
{
return [
'CREATE TABLE "quoted" ("create" VARCHAR2(255) NOT NULL, foo VARCHAR2(255) NOT NULL, "bar" VARCHAR2(255) NOT NULL)',
@@ -417,7 +451,7 @@ protected function getQuotedColumnInForeignKeySQL()
* @group DBAL-472
* @group DBAL-1001
*/
- public function testAlterTableNotNULL()
+ public function testAlterTableNotNULL() : void
{
$tableDiff = new TableDiff('mytable');
$tableDiff->changedColumns['foo'] = new ColumnDiff(
@@ -455,7 +489,7 @@ public function testAlterTableNotNULL()
/**
* @group DBAL-2555
*/
- public function testInitializesDoctrineTypeMappings()
+ public function testInitializesDoctrineTypeMappings() : void
{
self::assertTrue($this->platform->hasDoctrineTypeMappingFor('long raw'));
self::assertSame('blob', $this->platform->getDoctrineTypeMapping('long raw'));
@@ -467,12 +501,12 @@ public function testInitializesDoctrineTypeMappings()
self::assertSame('date', $this->platform->getDoctrineTypeMapping('date'));
}
- protected function getBinaryMaxLength()
+ protected function getBinaryMaxLength() : int
{
return 2000;
}
- public function testReturnsBinaryTypeDeclarationSQL()
+ public function testReturnsBinaryTypeDeclarationSQL() : void
{
self::assertSame('RAW(255)', $this->platform->getBinaryTypeDeclarationSQL([]));
self::assertSame('RAW(2000)', $this->platform->getBinaryTypeDeclarationSQL(['length' => 0]));
@@ -487,13 +521,13 @@ public function testReturnsBinaryTypeDeclarationSQL()
* @group legacy
* @expectedDeprecation Binary field length 2001 is greater than supported by the platform (2000). Reduce the field length or use a BLOB field instead.
*/
- public function testReturnsBinaryTypeLongerThanMaxDeclarationSQL()
+ public function testReturnsBinaryTypeLongerThanMaxDeclarationSQL() : void
{
self::assertSame('BLOB', $this->platform->getBinaryTypeDeclarationSQL(['length' => 2001]));
self::assertSame('BLOB', $this->platform->getBinaryTypeDeclarationSQL(['fixed' => true, 'length' => 2001]));
}
- public function testDoesNotPropagateUnnecessaryTableAlterationOnBinaryType()
+ public function testDoesNotPropagateUnnecessaryTableAlterationOnBinaryType() : void
{
$table1 = new Table('mytable');
$table1->addColumn('column_varbinary', 'binary');
@@ -513,7 +547,7 @@ public function testDoesNotPropagateUnnecessaryTableAlterationOnBinaryType()
/**
* @group DBAL-563
*/
- public function testUsesSequenceEmulatedIdentityColumns()
+ public function testUsesSequenceEmulatedIdentityColumns() : void
{
self::assertTrue($this->platform->usesSequenceEmulatedIdentityColumns());
}
@@ -522,7 +556,7 @@ public function testUsesSequenceEmulatedIdentityColumns()
* @group DBAL-563
* @group DBAL-831
*/
- public function testReturnsIdentitySequenceName()
+ public function testReturnsIdentitySequenceName() : void
{
self::assertSame('MYTABLE_SEQ', $this->platform->getIdentitySequenceName('mytable', 'mycolumn'));
self::assertSame('"mytable_SEQ"', $this->platform->getIdentitySequenceName('"mytable"', 'mycolumn'));
@@ -534,13 +568,16 @@ public function testReturnsIdentitySequenceName()
* @dataProvider dataCreateSequenceWithCache
* @group DBAL-139
*/
- public function testCreateSequenceWithCache($cacheSize, $expectedSql)
+ public function testCreateSequenceWithCache(int $cacheSize, string $expectedSql) : void
{
$sequence = new Sequence('foo', 1, 1, $cacheSize);
self::assertStringContainsString($expectedSql, $this->platform->getCreateSequenceSQL($sequence));
}
- public function dataCreateSequenceWithCache()
+ /**
+ * @return mixed[][]
+ */
+ public static function dataCreateSequenceWithCache() : iterable
{
return [
[1, 'NOCACHE'],
@@ -550,17 +587,21 @@ public function dataCreateSequenceWithCache()
}
/**
+ * {@inheritDoc}
+ *
* @group DBAL-234
*/
- protected function getAlterTableRenameIndexSQL()
+ protected function getAlterTableRenameIndexSQL() : array
{
return ['ALTER INDEX idx_foo RENAME TO idx_bar'];
}
/**
+ * {@inheritDoc}
+ *
* @group DBAL-234
*/
- protected function getQuotedAlterTableRenameIndexSQL()
+ protected function getQuotedAlterTableRenameIndexSQL() : array
{
return [
'ALTER INDEX "create" RENAME TO "select"',
@@ -571,7 +612,7 @@ protected function getQuotedAlterTableRenameIndexSQL()
/**
* {@inheritdoc}
*/
- protected function getQuotedAlterTableRenameColumnSQL()
+ protected function getQuotedAlterTableRenameColumnSQL() : array
{
return [
'ALTER TABLE mytable RENAME COLUMN unquoted1 TO unquoted',
@@ -589,23 +630,27 @@ protected function getQuotedAlterTableRenameColumnSQL()
/**
* {@inheritdoc}
*/
- protected function getQuotedAlterTableChangeColumnLengthSQL()
+ protected function getQuotedAlterTableChangeColumnLengthSQL() : array
{
$this->markTestIncomplete('Not implemented yet');
}
/**
+ * {@inheritDoc}
+ *
* @group DBAL-807
*/
- protected function getAlterTableRenameIndexInSchemaSQL()
+ protected function getAlterTableRenameIndexInSchemaSQL() : array
{
return ['ALTER INDEX myschema.idx_foo RENAME TO idx_bar'];
}
/**
+ * {@inheritDoc}
+ *
* @group DBAL-807
*/
- protected function getQuotedAlterTableRenameIndexInSchemaSQL()
+ protected function getQuotedAlterTableRenameIndexInSchemaSQL() : array
{
return [
'ALTER INDEX "schema"."create" RENAME TO "select"',
@@ -613,7 +658,7 @@ protected function getQuotedAlterTableRenameIndexInSchemaSQL()
];
}
- protected function getQuotesDropForeignKeySQL()
+ protected function getQuotesDropForeignKeySQL() : string
{
return 'ALTER TABLE "table" DROP CONSTRAINT "select"';
}
@@ -621,7 +666,7 @@ protected function getQuotesDropForeignKeySQL()
/**
* @group DBAL-423
*/
- public function testReturnsGuidTypeDeclarationSQL()
+ public function testReturnsGuidTypeDeclarationSQL() : void
{
self::assertSame('CHAR(36)', $this->platform->getGuidTypeDeclarationSQL([]));
}
@@ -629,21 +674,26 @@ public function testReturnsGuidTypeDeclarationSQL()
/**
* {@inheritdoc}
*/
- public function getAlterTableRenameColumnSQL()
+ public function getAlterTableRenameColumnSQL() : array
{
return ['ALTER TABLE foo RENAME COLUMN bar TO baz'];
}
/**
+ * @param string[] $expectedSql
+ *
* @dataProvider getReturnsDropAutoincrementSQL
* @group DBAL-831
*/
- public function testReturnsDropAutoincrementSQL($table, $expectedSql)
+ public function testReturnsDropAutoincrementSQL(string $table, array $expectedSql) : void
{
self::assertSame($expectedSql, $this->platform->getDropAutoincrementSql($table));
}
- public function getReturnsDropAutoincrementSQL()
+ /**
+ * @return mixed[][]
+ */
+ public static function getReturnsDropAutoincrementSQL() : iterable
{
return [
[
@@ -676,7 +726,7 @@ public function getReturnsDropAutoincrementSQL()
/**
* {@inheritdoc}
*/
- protected function getQuotesTableIdentifiersInAlterTableSQL()
+ protected function getQuotesTableIdentifiersInAlterTableSQL() : array
{
return [
'ALTER TABLE "foo" DROP CONSTRAINT fk1',
@@ -694,7 +744,7 @@ protected function getQuotesTableIdentifiersInAlterTableSQL()
/**
* {@inheritdoc}
*/
- protected function getCommentOnColumnSQL()
+ protected function getCommentOnColumnSQL() : array
{
return [
'COMMENT ON COLUMN foo.bar IS \'comment\'',
@@ -706,7 +756,7 @@ protected function getCommentOnColumnSQL()
/**
* @group DBAL-1004
*/
- public function testAltersTableColumnCommentWithExplicitlyQuotedIdentifiers()
+ public function testAltersTableColumnCommentWithExplicitlyQuotedIdentifiers() : void
{
$table1 = new Table('"foo"', [new Column('"bar"', Type::getType('integer'))]);
$table2 = new Table('"foo"', [new Column('"bar"', Type::getType('integer'), ['comment' => 'baz'])]);
@@ -722,7 +772,7 @@ public function testAltersTableColumnCommentWithExplicitlyQuotedIdentifiers()
);
}
- public function testQuotedTableNames()
+ public function testQuotedTableNames() : void
{
$table = new Table('"test"');
$table->addColumn('"id"', 'integer', ['autoincrement' => true]);
@@ -766,7 +816,7 @@ public function testQuotedTableNames()
* @dataProvider getReturnsGetListTableColumnsSQL
* @group DBAL-831
*/
- public function testReturnsGetListTableColumnsSQL($database, $expectedSql)
+ public function testReturnsGetListTableColumnsSQL(?string $database, string $expectedSql) : void
{
// 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
@@ -774,7 +824,10 @@ public function testReturnsGetListTableColumnsSQL($database, $expectedSql)
self::assertEquals($expectedSql, $this->platform->getListTableColumnsSQL('"test"', $database));
}
- public function getReturnsGetListTableColumnsSQL()
+ /**
+ * @return mixed[][]
+ */
+ public static function getReturnsGetListTableColumnsSQL() : iterable
{
return [
[
@@ -831,7 +884,7 @@ public function getReturnsGetListTableColumnsSQL()
/**
* {@inheritdoc}
*/
- protected function getQuotesReservedKeywordInUniqueConstraintDeclarationSQL()
+ protected function getQuotesReservedKeywordInUniqueConstraintDeclarationSQL() : string
{
return 'CONSTRAINT "select" UNIQUE (foo)';
}
@@ -839,7 +892,7 @@ protected function getQuotesReservedKeywordInUniqueConstraintDeclarationSQL()
/**
* {@inheritdoc}
*/
- protected function getQuotesReservedKeywordInIndexDeclarationSQL()
+ protected function getQuotesReservedKeywordInIndexDeclarationSQL() : string
{
return 'INDEX "select" (foo)';
}
@@ -847,7 +900,7 @@ protected function getQuotesReservedKeywordInIndexDeclarationSQL()
/**
* {@inheritdoc}
*/
- protected function getQuotesReservedKeywordInTruncateTableSQL()
+ protected function getQuotesReservedKeywordInTruncateTableSQL() : string
{
return 'TRUNCATE TABLE "select"';
}
@@ -855,7 +908,7 @@ protected function getQuotesReservedKeywordInTruncateTableSQL()
/**
* {@inheritdoc}
*/
- protected function getAlterStringToFixedStringSQL()
+ protected function getAlterStringToFixedStringSQL() : array
{
return ['ALTER TABLE mytable MODIFY (name CHAR(2) DEFAULT NULL)'];
}
@@ -863,7 +916,7 @@ protected function getAlterStringToFixedStringSQL()
/**
* {@inheritdoc}
*/
- protected function getGeneratesAlterTableRenameIndexUsedByForeignKeySQL()
+ protected function getGeneratesAlterTableRenameIndexUsedByForeignKeySQL() : array
{
return ['ALTER INDEX idx_foo RENAME TO idx_foo_renamed'];
}
@@ -871,7 +924,7 @@ protected function getGeneratesAlterTableRenameIndexUsedByForeignKeySQL()
/**
* @group DBAL-2436
*/
- public function testQuotesDatabaseNameInListSequencesSQL()
+ public function testQuotesDatabaseNameInListSequencesSQL() : void
{
self::assertStringContainsStringIgnoringCase(
"'Foo''Bar\\'",
@@ -882,7 +935,7 @@ public function testQuotesDatabaseNameInListSequencesSQL()
/**
* @group DBAL-2436
*/
- public function testQuotesTableNameInListTableIndexesSQL()
+ public function testQuotesTableNameInListTableIndexesSQL() : void
{
self::assertStringContainsStringIgnoringCase(
"'Foo''Bar\\'",
@@ -893,7 +946,7 @@ public function testQuotesTableNameInListTableIndexesSQL()
/**
* @group DBAL-2436
*/
- public function testQuotesTableNameInListTableForeignKeysSQL()
+ public function testQuotesTableNameInListTableForeignKeysSQL() : void
{
self::assertStringContainsStringIgnoringCase(
"'Foo''Bar\\'",
@@ -904,7 +957,7 @@ public function testQuotesTableNameInListTableForeignKeysSQL()
/**
* @group DBAL-2436
*/
- public function testQuotesTableNameInListTableConstraintsSQL()
+ public function testQuotesTableNameInListTableConstraintsSQL() : void
{
self::assertStringContainsStringIgnoringCase(
"'Foo''Bar\\'",
@@ -915,7 +968,7 @@ public function testQuotesTableNameInListTableConstraintsSQL()
/**
* @group DBAL-2436
*/
- public function testQuotesTableNameInListTableColumnsSQL()
+ public function testQuotesTableNameInListTableColumnsSQL() : void
{
self::assertStringContainsStringIgnoringCase(
"'Foo''Bar\\'",
@@ -926,7 +979,7 @@ public function testQuotesTableNameInListTableColumnsSQL()
/**
* @group DBAL-2436
*/
- public function testQuotesDatabaseNameInListTableColumnsSQL()
+ public function testQuotesDatabaseNameInListTableColumnsSQL() : void
{
self::assertStringContainsStringIgnoringCase(
"'Foo''Bar\\'",
diff --git a/tests/Doctrine/Tests/DBAL/Platforms/PostgreSQL100PlatformTest.php b/tests/Doctrine/Tests/DBAL/Platforms/PostgreSQL100PlatformTest.php
index df30fc471f0..8eb58c98e72 100644
--- a/tests/Doctrine/Tests/DBAL/Platforms/PostgreSQL100PlatformTest.php
+++ b/tests/Doctrine/Tests/DBAL/Platforms/PostgreSQL100PlatformTest.php
@@ -4,6 +4,7 @@
namespace Doctrine\Tests\DBAL\Platforms;
+use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Platforms\PostgreSQL100Platform;
class PostgreSQL100PlatformTest extends PostgreSQL94PlatformTest
@@ -11,7 +12,7 @@ class PostgreSQL100PlatformTest extends PostgreSQL94PlatformTest
/**
* {@inheritdoc}
*/
- public function createPlatform() : PostgreSQL100Platform
+ public function createPlatform() : AbstractPlatform
{
return new PostgreSQL100Platform();
}
diff --git a/tests/Doctrine/Tests/DBAL/Platforms/PostgreSQL91PlatformTest.php b/tests/Doctrine/Tests/DBAL/Platforms/PostgreSQL91PlatformTest.php
index ec62ac8b026..3ed82529e08 100644
--- a/tests/Doctrine/Tests/DBAL/Platforms/PostgreSQL91PlatformTest.php
+++ b/tests/Doctrine/Tests/DBAL/Platforms/PostgreSQL91PlatformTest.php
@@ -2,12 +2,13 @@
namespace Doctrine\Tests\DBAL\Platforms;
+use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Platforms\PostgreSQL91Platform;
use Doctrine\DBAL\Schema\Table;
class PostgreSQL91PlatformTest extends PostgreSqlPlatformTest
{
- public function createPlatform()
+ public function createPlatform() : AbstractPlatform
{
return new PostgreSQL91Platform();
}
diff --git a/tests/Doctrine/Tests/DBAL/Platforms/PostgreSQL92PlatformTest.php b/tests/Doctrine/Tests/DBAL/Platforms/PostgreSQL92PlatformTest.php
index 123425b3879..7fbedd494be 100644
--- a/tests/Doctrine/Tests/DBAL/Platforms/PostgreSQL92PlatformTest.php
+++ b/tests/Doctrine/Tests/DBAL/Platforms/PostgreSQL92PlatformTest.php
@@ -2,6 +2,7 @@
namespace Doctrine\Tests\DBAL\Platforms;
+use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Platforms\PostgreSQL92Platform;
use Doctrine\DBAL\Types\Types;
@@ -10,7 +11,7 @@ class PostgreSQL92PlatformTest extends AbstractPostgreSqlPlatformTestCase
/**
* {@inheritdoc}
*/
- public function createPlatform()
+ public function createPlatform() : AbstractPlatform
{
return new PostgreSQL92Platform();
}
@@ -18,7 +19,7 @@ public function createPlatform()
/**
* @group DBAL-553
*/
- public function testHasNativeJsonType()
+ public function testHasNativeJsonType() : void
{
self::assertTrue($this->platform->hasNativeJsonType());
}
@@ -26,12 +27,12 @@ public function testHasNativeJsonType()
/**
* @group DBAL-553
*/
- public function testReturnsJsonTypeDeclarationSQL()
+ public function testReturnsJsonTypeDeclarationSQL() : void
{
self::assertSame('JSON', $this->platform->getJsonTypeDeclarationSQL([]));
}
- public function testReturnsSmallIntTypeDeclarationSQL()
+ public function testReturnsSmallIntTypeDeclarationSQL() : void
{
self::assertSame(
'SMALLSERIAL',
@@ -52,7 +53,7 @@ public function testReturnsSmallIntTypeDeclarationSQL()
/**
* @group DBAL-553
*/
- public function testInitializesJsonTypeMapping()
+ public function testInitializesJsonTypeMapping() : void
{
self::assertTrue($this->platform->hasDoctrineTypeMappingFor('json'));
self::assertEquals(Types::JSON, $this->platform->getDoctrineTypeMapping('json'));
@@ -61,7 +62,7 @@ public function testInitializesJsonTypeMapping()
/**
* @group DBAL-1220
*/
- public function testReturnsCloseActiveDatabaseConnectionsSQL()
+ public function testReturnsCloseActiveDatabaseConnectionsSQL() : void
{
self::assertSame(
"SELECT pg_terminate_backend(pid) FROM pg_stat_activity WHERE datname = 'foo'",
diff --git a/tests/Doctrine/Tests/DBAL/Platforms/PostgreSQL94PlatformTest.php b/tests/Doctrine/Tests/DBAL/Platforms/PostgreSQL94PlatformTest.php
index 9643bdb5fd7..179e005b2f9 100644
--- a/tests/Doctrine/Tests/DBAL/Platforms/PostgreSQL94PlatformTest.php
+++ b/tests/Doctrine/Tests/DBAL/Platforms/PostgreSQL94PlatformTest.php
@@ -2,6 +2,7 @@
namespace Doctrine\Tests\DBAL\Platforms;
+use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Platforms\PostgreSQL94Platform;
use Doctrine\DBAL\Types\Types;
@@ -10,19 +11,19 @@ class PostgreSQL94PlatformTest extends PostgreSQL92PlatformTest
/**
* {@inheritdoc}
*/
- public function createPlatform()
+ public function createPlatform() : AbstractPlatform
{
return new PostgreSQL94Platform();
}
- public function testReturnsJsonTypeDeclarationSQL()
+ public function testReturnsJsonTypeDeclarationSQL() : void
{
parent::testReturnsJsonTypeDeclarationSQL();
self::assertSame('JSON', $this->platform->getJsonTypeDeclarationSQL(['jsonb' => false]));
self::assertSame('JSONB', $this->platform->getJsonTypeDeclarationSQL(['jsonb' => true]));
}
- public function testInitializesJsonTypeMapping()
+ public function testInitializesJsonTypeMapping() : void
{
parent::testInitializesJsonTypeMapping();
self::assertTrue($this->platform->hasDoctrineTypeMappingFor('jsonb'));
diff --git a/tests/Doctrine/Tests/DBAL/Platforms/PostgreSqlPlatformTest.php b/tests/Doctrine/Tests/DBAL/Platforms/PostgreSqlPlatformTest.php
index b45a152ab0a..41fb1564ec8 100644
--- a/tests/Doctrine/Tests/DBAL/Platforms/PostgreSqlPlatformTest.php
+++ b/tests/Doctrine/Tests/DBAL/Platforms/PostgreSqlPlatformTest.php
@@ -2,16 +2,17 @@
namespace Doctrine\Tests\DBAL\Platforms;
+use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Platforms\PostgreSqlPlatform;
class PostgreSqlPlatformTest extends AbstractPostgreSqlPlatformTestCase
{
- public function createPlatform()
+ public function createPlatform() : AbstractPlatform
{
return new PostgreSqlPlatform();
}
- public function testSupportsPartialIndexes()
+ public function testSupportsPartialIndexes() : void
{
self::assertTrue($this->platform->supportsPartialIndexes());
}
diff --git a/tests/Doctrine/Tests/DBAL/Platforms/ReservedKeywordsValidatorTest.php b/tests/Doctrine/Tests/DBAL/Platforms/ReservedKeywordsValidatorTest.php
index b0c49ae6bb9..8d07f62274d 100644
--- a/tests/Doctrine/Tests/DBAL/Platforms/ReservedKeywordsValidatorTest.php
+++ b/tests/Doctrine/Tests/DBAL/Platforms/ReservedKeywordsValidatorTest.php
@@ -17,7 +17,7 @@ protected function setUp() : void
$this->validator = new ReservedKeywordsValidator([new MySQLKeywords()]);
}
- public function testReservedTableName()
+ public function testReservedTableName() : void
{
$table = new Table('TABLE');
$this->validator->acceptTable($table);
@@ -28,7 +28,7 @@ public function testReservedTableName()
);
}
- public function testReservedColumnName()
+ public function testReservedColumnName() : void
{
$table = new Table('TABLE');
$column = $table->addColumn('table', 'string');
diff --git a/tests/Doctrine/Tests/DBAL/Platforms/SQLAnywhere11PlatformTest.php b/tests/Doctrine/Tests/DBAL/Platforms/SQLAnywhere11PlatformTest.php
index 7e91777d6ef..bf3f7372df3 100644
--- a/tests/Doctrine/Tests/DBAL/Platforms/SQLAnywhere11PlatformTest.php
+++ b/tests/Doctrine/Tests/DBAL/Platforms/SQLAnywhere11PlatformTest.php
@@ -2,6 +2,7 @@
namespace Doctrine\Tests\DBAL\Platforms;
+use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Platforms\SQLAnywhere11Platform;
class SQLAnywhere11PlatformTest extends SQLAnywherePlatformTest
@@ -9,17 +10,17 @@ class SQLAnywhere11PlatformTest extends SQLAnywherePlatformTest
/** @var SQLAnywhere11Platform */
protected $platform;
- public function createPlatform()
+ public function createPlatform() : AbstractPlatform
{
return new SQLAnywhere11Platform();
}
- public function testDoesNotSupportRegexp()
+ public function testDoesNotSupportRegexp() : void
{
$this->markTestSkipped('This version of the platform now supports regular expressions.');
}
- public function testGeneratesRegularExpressionSQLSnippet()
+ public function testGeneratesRegularExpressionSQLSnippet() : void
{
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 7cbb2c69bb8..e60f6b1c7f1 100644
--- a/tests/Doctrine/Tests/DBAL/Platforms/SQLAnywhere12PlatformTest.php
+++ b/tests/Doctrine/Tests/DBAL/Platforms/SQLAnywhere12PlatformTest.php
@@ -2,6 +2,7 @@
namespace Doctrine\Tests\DBAL\Platforms;
+use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Platforms\SQLAnywhere12Platform;
use Doctrine\DBAL\Schema\Index;
use Doctrine\DBAL\Schema\Sequence;
@@ -11,22 +12,22 @@ class SQLAnywhere12PlatformTest extends SQLAnywhere11PlatformTest
/** @var SQLAnywhere12Platform */
protected $platform;
- public function createPlatform()
+ public function createPlatform() : AbstractPlatform
{
return new SQLAnywhere12Platform();
}
- public function testDoesNotSupportSequences()
+ public function testDoesNotSupportSequences() : void
{
$this->markTestSkipped('This version of the platform now supports sequences.');
}
- public function testSupportsSequences()
+ public function testSupportsSequences() : void
{
self::assertTrue($this->platform->supportsSequences());
}
- public function testGeneratesSequenceSqlCommands()
+ public function testGeneratesSequenceSqlCommands() : void
{
$sequence = new Sequence('myseq', 20, 1);
self::assertEquals(
@@ -55,7 +56,7 @@ public function testGeneratesSequenceSqlCommands()
);
}
- public function testGeneratesDateTimeTzColumnTypeDeclarationSQL()
+ public function testGeneratesDateTimeTzColumnTypeDeclarationSQL() : void
{
self::assertEquals(
'TIMESTAMP WITH TIME ZONE',
@@ -68,18 +69,18 @@ public function testGeneratesDateTimeTzColumnTypeDeclarationSQL()
);
}
- public function testHasCorrectDateTimeTzFormatString()
+ public function testHasCorrectDateTimeTzFormatString() : void
{
self::assertEquals('Y-m-d H:i:s.uP', $this->platform->getDateTimeTzFormatString());
}
- public function testInitializesDateTimeTzTypeMapping()
+ public function testInitializesDateTimeTzTypeMapping() : void
{
self::assertTrue($this->platform->hasDoctrineTypeMappingFor('timestamp with time zone'));
self::assertEquals('datetime', $this->platform->getDoctrineTypeMapping('timestamp with time zone'));
}
- public function testGeneratesCreateIndexWithAdvancedPlatformOptionsSQL()
+ public function testGeneratesCreateIndexWithAdvancedPlatformOptionsSQL() : void
{
self::assertEquals(
'CREATE VIRTUAL UNIQUE CLUSTERED INDEX fooindex ON footable (a, b) WITH NULLS NOT DISTINCT FOR OLAP WORKLOAD',
diff --git a/tests/Doctrine/Tests/DBAL/Platforms/SQLAnywhere16PlatformTest.php b/tests/Doctrine/Tests/DBAL/Platforms/SQLAnywhere16PlatformTest.php
index 9692ffb1f76..a6a0018a06e 100644
--- a/tests/Doctrine/Tests/DBAL/Platforms/SQLAnywhere16PlatformTest.php
+++ b/tests/Doctrine/Tests/DBAL/Platforms/SQLAnywhere16PlatformTest.php
@@ -2,17 +2,18 @@
namespace Doctrine\Tests\DBAL\Platforms;
+use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Platforms\SQLAnywhere16Platform;
use Doctrine\DBAL\Schema\Index;
class SQLAnywhere16PlatformTest extends SQLAnywhere12PlatformTest
{
- public function createPlatform()
+ public function createPlatform() : AbstractPlatform
{
return new SQLAnywhere16Platform();
}
- public function testGeneratesCreateIndexWithAdvancedPlatformOptionsSQL()
+ public function testGeneratesCreateIndexWithAdvancedPlatformOptionsSQL() : void
{
self::assertEquals(
'CREATE UNIQUE INDEX fooindex ON footable (a, b) WITH NULLS DISTINCT',
@@ -61,7 +62,7 @@ public function testGeneratesCreateIndexWithAdvancedPlatformOptionsSQL()
parent::testGeneratesCreateIndexWithAdvancedPlatformOptionsSQL();
}
- public function testThrowsExceptionOnInvalidWithNullsNotDistinctIndexOptions()
+ public function testThrowsExceptionOnInvalidWithNullsNotDistinctIndexOptions() : void
{
$this->expectException('UnexpectedValueException');
diff --git a/tests/Doctrine/Tests/DBAL/Platforms/SQLAnywherePlatformTest.php b/tests/Doctrine/Tests/DBAL/Platforms/SQLAnywherePlatformTest.php
index 767fb268408..0efa23b19c6 100644
--- a/tests/Doctrine/Tests/DBAL/Platforms/SQLAnywherePlatformTest.php
+++ b/tests/Doctrine/Tests/DBAL/Platforms/SQLAnywherePlatformTest.php
@@ -27,12 +27,15 @@ class SQLAnywherePlatformTest extends AbstractPlatformTestCase
/** @var SQLAnywherePlatform */
protected $platform;
- public function createPlatform()
+ public function createPlatform() : AbstractPlatform
{
return new SQLAnywherePlatform();
}
- public function getGenerateAlterTableSql()
+ /**
+ * {@inheritDoc}
+ */
+ public function getGenerateAlterTableSql() : array
{
return [
"ALTER TABLE mytable ADD quota INT DEFAULT NULL, DROP foo, ALTER baz VARCHAR(1) DEFAULT 'def' NOT NULL, ALTER bloo BIT DEFAULT '0' NOT NULL",
@@ -40,22 +43,25 @@ public function getGenerateAlterTableSql()
];
}
- public function getGenerateForeignKeySql()
+ public function getGenerateForeignKeySql() : string
{
return 'ALTER TABLE test ADD FOREIGN KEY (fk_name_id) REFERENCES other_table (id)';
}
- public function getGenerateIndexSql()
+ public function getGenerateIndexSql() : string
{
return 'CREATE INDEX my_idx ON mytable (user_name, last_login)';
}
- public function getGenerateTableSql()
+ public function getGenerateTableSql() : string
{
return 'CREATE TABLE test (id INT IDENTITY NOT NULL, test VARCHAR(255) DEFAULT NULL, PRIMARY KEY (id))';
}
- public function getGenerateTableWithMultiColumnUniqueIndexSql()
+ /**
+ * {@inheritDoc}
+ */
+ public function getGenerateTableWithMultiColumnUniqueIndexSql() : array
{
return [
'CREATE TABLE test (foo VARCHAR(255) DEFAULT NULL, bar VARCHAR(255) DEFAULT NULL)',
@@ -63,17 +69,23 @@ public function getGenerateTableWithMultiColumnUniqueIndexSql()
];
}
- public function getGenerateUniqueIndexSql()
+ public function getGenerateUniqueIndexSql() : string
{
return 'CREATE UNIQUE INDEX index_name ON test (test, test2)';
}
- protected function getQuotedColumnInForeignKeySQL()
+ /**
+ * {@inheritDoc}
+ */
+ protected function getQuotedColumnInForeignKeySQL() : array
{
return ['CREATE TABLE "quoted" ("create" VARCHAR(255) NOT NULL, foo VARCHAR(255) NOT NULL, "bar" VARCHAR(255) NOT NULL, CONSTRAINT FK_WITH_RESERVED_KEYWORD FOREIGN KEY ("create", foo, "bar") REFERENCES "foreign" ("create", bar, "foo-bar"), CONSTRAINT FK_WITH_NON_RESERVED_KEYWORD FOREIGN KEY ("create", foo, "bar") REFERENCES foo ("create", bar, "foo-bar"), CONSTRAINT FK_WITH_INTENDED_QUOTATION FOREIGN KEY ("create", foo, "bar") REFERENCES "foo-bar" ("create", bar, "foo-bar"))'];
}
- protected function getQuotedColumnInIndexSQL()
+ /**
+ * {@inheritDoc}
+ */
+ protected function getQuotedColumnInIndexSQL() : array
{
return [
'CREATE TABLE "quoted" ("create" VARCHAR(255) NOT NULL)',
@@ -81,7 +93,10 @@ protected function getQuotedColumnInIndexSQL()
];
}
- protected function getQuotedNameInIndexSQL()
+ /**
+ * {@inheritDoc}
+ */
+ protected function getQuotedNameInIndexSQL() : array
{
return [
'CREATE TABLE test (column1 VARCHAR(255) NOT NULL)',
@@ -89,12 +104,18 @@ protected function getQuotedNameInIndexSQL()
];
}
- protected function getQuotedColumnInPrimaryKeySQL()
+ /**
+ * {@inheritDoc}
+ */
+ protected function getQuotedColumnInPrimaryKeySQL() : array
{
return ['CREATE TABLE "quoted" ("create" VARCHAR(255) NOT NULL, PRIMARY KEY ("create"))'];
}
- public function getCreateTableColumnCommentsSQL()
+ /**
+ * {@inheritDoc}
+ */
+ public function getCreateTableColumnCommentsSQL() : array
{
return [
'CREATE TABLE test (id INT NOT NULL, PRIMARY KEY (id))',
@@ -102,7 +123,10 @@ public function getCreateTableColumnCommentsSQL()
];
}
- public function getAlterTableColumnCommentsSQL()
+ /**
+ * {@inheritDoc}
+ */
+ public function getAlterTableColumnCommentsSQL() : array
{
return [
'ALTER TABLE mytable ADD quota INT NOT NULL',
@@ -112,7 +136,10 @@ public function getAlterTableColumnCommentsSQL()
];
}
- public function getCreateTableColumnTypeCommentsSQL()
+ /**
+ * {@inheritDoc}
+ */
+ public function getCreateTableColumnTypeCommentsSQL() : array
{
return [
'CREATE TABLE test (id INT NOT NULL, data TEXT NOT NULL, PRIMARY KEY (id))',
@@ -120,12 +147,12 @@ public function getCreateTableColumnTypeCommentsSQL()
];
}
- public function testHasCorrectPlatformName()
+ public function testHasCorrectPlatformName() : void
{
self::assertEquals('sqlanywhere', $this->platform->getName());
}
- public function testGeneratesCreateTableSQLWithCommonIndexes()
+ public function testGeneratesCreateTableSQLWithCommonIndexes() : void
{
$table = new Table('test');
$table->addColumn('id', 'integer');
@@ -144,7 +171,7 @@ public function testGeneratesCreateTableSQLWithCommonIndexes()
);
}
- public function testGeneratesCreateTableSQLWithForeignKeyConstraints()
+ public function testGeneratesCreateTableSQLWithForeignKeyConstraints() : void
{
$table = new Table('test');
$table->addColumn('id', 'integer');
@@ -169,7 +196,7 @@ public function testGeneratesCreateTableSQLWithForeignKeyConstraints()
);
}
- public function testGeneratesCreateTableSQLWithCheckConstraints()
+ public function testGeneratesCreateTableSQLWithCheckConstraints() : void
{
$table = new Table('test');
$table->addColumn('id', 'integer');
@@ -183,7 +210,7 @@ public function testGeneratesCreateTableSQLWithCheckConstraints()
);
}
- public function testGeneratesTableAlterationWithRemovedColumnCommentSql()
+ public function testGeneratesTableAlterationWithRemovedColumnCommentSql() : void
{
$table = new Table('mytable');
$table->addColumn('foo', 'string', ['comment' => 'foo comment']);
@@ -203,9 +230,11 @@ public function testGeneratesTableAlterationWithRemovedColumnCommentSql()
}
/**
+ * @param int|bool|null $lockMode
+ *
* @dataProvider getLockHints
*/
- public function testAppendsLockHint($lockMode, $lockHint)
+ public function testAppendsLockHint($lockMode, string $lockHint) : void
{
$fromClause = 'FROM users';
$expectedResult = $fromClause . $lockHint;
@@ -213,7 +242,10 @@ public function testAppendsLockHint($lockMode, $lockHint)
self::assertSame($expectedResult, $this->platform->appendLockHint($fromClause, $lockMode));
}
- public function getLockHints()
+ /**
+ * @return mixed[][]
+ */
+ public static function getLockHints() : iterable
{
return [
[null, ''],
@@ -226,12 +258,12 @@ public function getLockHints()
];
}
- public function testHasCorrectMaxIdentifierLength()
+ public function testHasCorrectMaxIdentifierLength() : void
{
self::assertEquals(128, $this->platform->getMaxIdentifierLength());
}
- public function testFixesSchemaElementNames()
+ public function testFixesSchemaElementNames() : void
{
$maxIdentifierLength = $this->platform->getMaxIdentifierLength();
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
@@ -253,7 +285,7 @@ public function testFixesSchemaElementNames()
);
}
- public function testGeneratesColumnTypesDeclarationSQL()
+ public function testGeneratesColumnTypesDeclarationSQL() : void
{
$fullColumnDef = [
'length' => 10,
@@ -283,12 +315,12 @@ public function testGeneratesColumnTypesDeclarationSQL()
self::assertEquals(32767, $this->platform->getVarcharMaxLength());
}
- public function testHasNativeGuidType()
+ public function testHasNativeGuidType() : void
{
self::assertTrue($this->platform->hasNativeGuidType());
}
- public function testGeneratesDDLSnippets()
+ public function testGeneratesDDLSnippets() : void
{
self::assertEquals("CREATE DATABASE 'foobar'", $this->platform->getCreateDatabaseSQL('foobar'));
self::assertEquals("CREATE DATABASE 'foobar'", $this->platform->getCreateDatabaseSQL('"foobar"'));
@@ -311,7 +343,7 @@ public function testGeneratesDDLSnippets()
self::assertEquals('DROP VIEW fooview', $this->platform->getDropViewSQL('fooview'));
}
- public function testGeneratesPrimaryKeyDeclarationSQL()
+ public function testGeneratesPrimaryKeyDeclarationSQL() : void
{
self::assertEquals(
'CONSTRAINT pk PRIMARY KEY CLUSTERED (a, b)',
@@ -328,14 +360,14 @@ public function testGeneratesPrimaryKeyDeclarationSQL()
);
}
- public function testCannotGeneratePrimaryKeyDeclarationSQLWithEmptyColumns()
+ public function testCannotGeneratePrimaryKeyDeclarationSQLWithEmptyColumns() : void
{
$this->expectException(InvalidArgumentException::class);
$this->platform->getPrimaryKeyDeclarationSQL(new Index('pk', [], true, true));
}
- public function testGeneratesCreateUnnamedPrimaryKeySQL()
+ public function testGeneratesCreateUnnamedPrimaryKeySQL() : void
{
self::assertEquals(
'ALTER TABLE foo ADD PRIMARY KEY CLUSTERED (a, b)',
@@ -353,7 +385,7 @@ public function testGeneratesCreateUnnamedPrimaryKeySQL()
);
}
- public function testGeneratesUniqueConstraintDeclarationSQL()
+ public function testGeneratesUniqueConstraintDeclarationSQL() : void
{
self::assertEquals(
'CONSTRAINT unique_constraint UNIQUE CLUSTERED (a, b)',
@@ -368,14 +400,14 @@ public function testGeneratesUniqueConstraintDeclarationSQL()
);
}
- public function testCannotGenerateUniqueConstraintDeclarationSQLWithEmptyColumns()
+ public function testCannotGenerateUniqueConstraintDeclarationSQLWithEmptyColumns() : void
{
$this->expectException(InvalidArgumentException::class);
$this->platform->getUniqueConstraintDeclarationSQL('constr', new Index('constr', [], true));
}
- public function testGeneratesForeignKeyConstraintsWithAdvancedPlatformOptionsSQL()
+ public function testGeneratesForeignKeyConstraintsWithAdvancedPlatformOptionsSQL() : void
{
self::assertEquals(
'CONSTRAINT fk ' .
@@ -402,7 +434,7 @@ public function testGeneratesForeignKeyConstraintsWithAdvancedPlatformOptionsSQL
);
}
- public function testGeneratesForeignKeyMatchClausesSQL()
+ public function testGeneratesForeignKeyMatchClausesSQL() : void
{
self::assertEquals('SIMPLE', $this->platform->getForeignKeyMatchClauseSQL(1));
self::assertEquals('FULL', $this->platform->getForeignKeyMatchClauseSQL(2));
@@ -410,46 +442,46 @@ public function testGeneratesForeignKeyMatchClausesSQL()
self::assertEquals('UNIQUE FULL', $this->platform->getForeignKeyMatchClauseSQL(130));
}
- public function testCannotGenerateInvalidForeignKeyMatchClauseSQL()
+ public function testCannotGenerateInvalidForeignKeyMatchClauseSQL() : void
{
$this->expectException(InvalidArgumentException::class);
$this->platform->getForeignKeyMatchCLauseSQL(3);
}
- public function testCannotGenerateForeignKeyConstraintSQLWithEmptyLocalColumns()
+ public function testCannotGenerateForeignKeyConstraintSQLWithEmptyLocalColumns() : void
{
$this->expectException(InvalidArgumentException::class);
$this->platform->getForeignKeyDeclarationSQL(new ForeignKeyConstraint([], 'foreign_tbl', ['c', 'd']));
}
- public function testCannotGenerateForeignKeyConstraintSQLWithEmptyForeignColumns()
+ public function testCannotGenerateForeignKeyConstraintSQLWithEmptyForeignColumns() : void
{
$this->expectException(InvalidArgumentException::class);
$this->platform->getForeignKeyDeclarationSQL(new ForeignKeyConstraint(['a', 'b'], 'foreign_tbl', []));
}
- public function testCannotGenerateForeignKeyConstraintSQLWithEmptyForeignTableName()
+ public function testCannotGenerateForeignKeyConstraintSQLWithEmptyForeignTableName() : void
{
$this->expectException(InvalidArgumentException::class);
$this->platform->getForeignKeyDeclarationSQL(new ForeignKeyConstraint(['a', 'b'], '', ['c', 'd']));
}
- public function testCannotGenerateCommonIndexWithCreateConstraintSQL()
+ public function testCannotGenerateCommonIndexWithCreateConstraintSQL() : void
{
$this->expectException(InvalidArgumentException::class);
$this->platform->getCreateConstraintSQL(new Index('fooindex', []), new Table('footable'));
}
- public function testCannotGenerateCustomConstraintWithCreateConstraintSQL()
+ public function testCannotGenerateCustomConstraintWithCreateConstraintSQL() : void
{
$this->expectException(InvalidArgumentException::class);
$this->platform->getCreateConstraintSQL($this->createMock(Constraint::class), 'footable');
}
- public function testGeneratesCreateIndexWithAdvancedPlatformOptionsSQL()
+ public function testGeneratesCreateIndexWithAdvancedPlatformOptionsSQL() : void
{
self::assertEquals(
'CREATE VIRTUAL UNIQUE CLUSTERED INDEX fooindex ON footable (a, b) FOR OLAP WORKLOAD',
@@ -466,14 +498,14 @@ public function testGeneratesCreateIndexWithAdvancedPlatformOptionsSQL()
);
}
- public function testDoesNotSupportIndexDeclarationInCreateAlterTableStatements()
+ public function testDoesNotSupportIndexDeclarationInCreateAlterTableStatements() : void
{
$this->expectException(DBALException::class);
$this->platform->getIndexDeclarationSQL('index', new Index('index', []));
}
- public function testGeneratesDropIndexSQL()
+ public function testGeneratesDropIndexSQL() : void
{
$index = new Index('fooindex', []);
@@ -485,21 +517,21 @@ public function testGeneratesDropIndexSQL()
));
}
- public function testCannotGenerateDropIndexSQLWithInvalidIndexParameter()
+ public function testCannotGenerateDropIndexSQLWithInvalidIndexParameter() : void
{
$this->expectException(InvalidArgumentException::class);
$this->platform->getDropIndexSQL(['index'], 'table');
}
- public function testCannotGenerateDropIndexSQLWithInvalidTableParameter()
+ public function testCannotGenerateDropIndexSQLWithInvalidTableParameter() : void
{
$this->expectException(InvalidArgumentException::class);
$this->platform->getDropIndexSQL('index', ['table']);
}
- public function testGeneratesSQLSnippets()
+ public function testGeneratesSQLSnippets() : void
{
self::assertEquals('STRING(column1, "string1", column2, "string2")', $this->platform->getConcatExpression(
'column1',
@@ -573,14 +605,14 @@ public function testGeneratesSQLSnippets()
);
}
- public function testDoesNotSupportRegexp()
+ public function testDoesNotSupportRegexp() : void
{
$this->expectException(DBALException::class);
$this->platform->getRegexpExpression();
}
- public function testHasCorrectDateTimeTzFormatString()
+ public function testHasCorrectDateTimeTzFormatString() : void
{
// 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
@@ -588,7 +620,7 @@ public function testHasCorrectDateTimeTzFormatString()
self::assertEquals($this->platform->getDateTimeFormatString(), $this->platform->getDateTimeTzFormatString());
}
- public function testHasCorrectDefaultTransactionIsolationLevel()
+ public function testHasCorrectDefaultTransactionIsolationLevel() : void
{
self::assertEquals(
TransactionIsolationLevel::READ_UNCOMMITTED,
@@ -596,7 +628,7 @@ public function testHasCorrectDefaultTransactionIsolationLevel()
);
}
- public function testGeneratesTransactionsCommands()
+ public function testGeneratesTransactionsCommands() : void
{
self::assertEquals(
'SET TEMPORARY OPTION isolation_level = 0',
@@ -616,14 +648,14 @@ public function testGeneratesTransactionsCommands()
);
}
- public function testCannotGenerateTransactionCommandWithInvalidIsolationLevel()
+ public function testCannotGenerateTransactionCommandWithInvalidIsolationLevel() : void
{
$this->expectException(InvalidArgumentException::class);
$this->platform->getSetTransactionIsolationSQL('invalid_transaction_isolation_level');
}
- public function testModifiesLimitQuery()
+ public function testModifiesLimitQuery() : void
{
self::assertEquals(
'SELECT TOP 10 * FROM user',
@@ -631,7 +663,7 @@ public function testModifiesLimitQuery()
);
}
- public function testModifiesLimitQueryWithEmptyOffset()
+ public function testModifiesLimitQueryWithEmptyOffset() : void
{
self::assertEquals(
'SELECT TOP 10 * FROM user',
@@ -639,7 +671,7 @@ public function testModifiesLimitQueryWithEmptyOffset()
);
}
- public function testModifiesLimitQueryWithOffset()
+ public function testModifiesLimitQueryWithOffset() : void
{
self::assertEquals(
'SELECT TOP 10 START AT 6 * FROM user',
@@ -651,7 +683,7 @@ public function testModifiesLimitQueryWithOffset()
);
}
- public function testModifiesLimitQueryWithSubSelect()
+ public function testModifiesLimitQueryWithSubSelect() : void
{
self::assertEquals(
'SELECT TOP 10 * FROM (SELECT u.id as uid, u.name as uname FROM user) AS doctrine_tbl',
@@ -659,7 +691,7 @@ public function testModifiesLimitQueryWithSubSelect()
);
}
- public function testModifiesLimitQueryWithoutLimit()
+ public function testModifiesLimitQueryWithoutLimit() : void
{
self::assertEquals(
'SELECT TOP ALL START AT 11 n FROM Foo',
@@ -667,97 +699,97 @@ public function testModifiesLimitQueryWithoutLimit()
);
}
- public function testPrefersIdentityColumns()
+ public function testPrefersIdentityColumns() : void
{
self::assertTrue($this->platform->prefersIdentityColumns());
}
- public function testDoesNotPreferSequences()
+ public function testDoesNotPreferSequences() : void
{
self::assertFalse($this->platform->prefersSequences());
}
- public function testSupportsIdentityColumns()
+ public function testSupportsIdentityColumns() : void
{
self::assertTrue($this->platform->supportsIdentityColumns());
}
- public function testSupportsPrimaryConstraints()
+ public function testSupportsPrimaryConstraints() : void
{
self::assertTrue($this->platform->supportsPrimaryConstraints());
}
- public function testSupportsForeignKeyConstraints()
+ public function testSupportsForeignKeyConstraints() : void
{
self::assertTrue($this->platform->supportsForeignKeyConstraints());
}
- public function testSupportsForeignKeyOnUpdate()
+ public function testSupportsForeignKeyOnUpdate() : void
{
self::assertTrue($this->platform->supportsForeignKeyOnUpdate());
}
- public function testSupportsAlterTable()
+ public function testSupportsAlterTable() : void
{
self::assertTrue($this->platform->supportsAlterTable());
}
- public function testSupportsTransactions()
+ public function testSupportsTransactions() : void
{
self::assertTrue($this->platform->supportsTransactions());
}
- public function testSupportsSchemas()
+ public function testSupportsSchemas() : void
{
self::assertFalse($this->platform->supportsSchemas());
}
- public function testSupportsIndexes()
+ public function testSupportsIndexes() : void
{
self::assertTrue($this->platform->supportsIndexes());
}
- public function testSupportsCommentOnStatement()
+ public function testSupportsCommentOnStatement() : void
{
self::assertTrue($this->platform->supportsCommentOnStatement());
}
- public function testSupportsSavePoints()
+ public function testSupportsSavePoints() : void
{
self::assertTrue($this->platform->supportsSavepoints());
}
- public function testSupportsReleasePoints()
+ public function testSupportsReleasePoints() : void
{
self::assertTrue($this->platform->supportsReleaseSavepoints());
}
- public function testSupportsCreateDropDatabase()
+ public function testSupportsCreateDropDatabase() : void
{
self::assertTrue($this->platform->supportsCreateDropDatabase());
}
- public function testSupportsGettingAffectedRows()
+ public function testSupportsGettingAffectedRows() : void
{
self::assertTrue($this->platform->supportsGettingAffectedRows());
}
- public function testDoesNotSupportSequences()
+ public function testDoesNotSupportSequences() : void
{
self::assertFalse($this->platform->supportsSequences());
}
- public function testDoesNotSupportInlineColumnComments()
+ public function testDoesNotSupportInlineColumnComments() : void
{
self::assertFalse($this->platform->supportsInlineColumnComments());
}
- public function testCannotEmulateSchemas()
+ public function testCannotEmulateSchemas() : void
{
self::assertFalse($this->platform->canEmulateSchemas());
}
- public function testInitializesDoctrineTypeMappings()
+ public function testInitializesDoctrineTypeMappings() : void
{
self::assertTrue($this->platform->hasDoctrineTypeMappingFor('integer'));
self::assertSame('integer', $this->platform->getDoctrineTypeMapping('integer'));
@@ -769,17 +801,17 @@ public function testInitializesDoctrineTypeMappings()
self::assertSame('binary', $this->platform->getDoctrineTypeMapping('varbinary'));
}
- protected function getBinaryDefaultLength()
+ protected function getBinaryDefaultLength() : int
{
return 1;
}
- protected function getBinaryMaxLength()
+ protected function getBinaryMaxLength() : int
{
return 32767;
}
- public function testReturnsBinaryTypeDeclarationSQL()
+ public function testReturnsBinaryTypeDeclarationSQL() : void
{
self::assertSame('VARBINARY(1)', $this->platform->getBinaryTypeDeclarationSQL([]));
self::assertSame('VARBINARY(1)', $this->platform->getBinaryTypeDeclarationSQL(['length' => 0]));
@@ -794,24 +826,28 @@ public function testReturnsBinaryTypeDeclarationSQL()
* @group legacy
* @expectedDeprecation Binary field length 32768 is greater than supported by the platform (32767). Reduce the field length or use a BLOB field instead.
*/
- public function testReturnsBinaryTypeLongerThanMaxDeclarationSQL()
+ public function testReturnsBinaryTypeLongerThanMaxDeclarationSQL() : void
{
self::assertSame('LONG BINARY', $this->platform->getBinaryTypeDeclarationSQL(['length' => 32768]));
self::assertSame('LONG BINARY', $this->platform->getBinaryTypeDeclarationSQL(['fixed' => true, 'length' => 32768]));
}
/**
+ * {@inheritDoc}
+ *
* @group DBAL-234
*/
- protected function getAlterTableRenameIndexSQL()
+ protected function getAlterTableRenameIndexSQL() : array
{
return ['ALTER INDEX idx_foo ON mytable RENAME TO idx_bar'];
}
/**
+ * {@inheritDoc}
+ *
* @group DBAL-234
*/
- protected function getQuotedAlterTableRenameIndexSQL()
+ protected function getQuotedAlterTableRenameIndexSQL() : array
{
return [
'ALTER INDEX "create" ON "table" RENAME TO "select"',
@@ -822,7 +858,7 @@ protected function getQuotedAlterTableRenameIndexSQL()
/**
* {@inheritdoc}
*/
- protected function getQuotedAlterTableRenameColumnSQL()
+ protected function getQuotedAlterTableRenameColumnSQL() : array
{
return [
'ALTER TABLE mytable RENAME unquoted1 TO unquoted',
@@ -840,23 +876,27 @@ protected function getQuotedAlterTableRenameColumnSQL()
/**
* {@inheritdoc}
*/
- protected function getQuotedAlterTableChangeColumnLengthSQL()
+ protected function getQuotedAlterTableChangeColumnLengthSQL() : array
{
$this->markTestIncomplete('Not implemented yet');
}
/**
+ * {@inheritDoc}
+ *
* @group DBAL-807
*/
- protected function getAlterTableRenameIndexInSchemaSQL()
+ protected function getAlterTableRenameIndexInSchemaSQL() : array
{
return ['ALTER INDEX idx_foo ON myschema.mytable RENAME TO idx_bar'];
}
/**
+ * {@inheritDoc}
+ *
* @group DBAL-807
*/
- protected function getQuotedAlterTableRenameIndexInSchemaSQL()
+ protected function getQuotedAlterTableRenameIndexInSchemaSQL() : array
{
return [
'ALTER INDEX "create" ON "schema"."table" RENAME TO "select"',
@@ -867,7 +907,7 @@ protected function getQuotedAlterTableRenameIndexInSchemaSQL()
/**
* @group DBAL-423
*/
- public function testReturnsGuidTypeDeclarationSQL()
+ public function testReturnsGuidTypeDeclarationSQL() : void
{
self::assertSame('UNIQUEIDENTIFIER', $this->platform->getGuidTypeDeclarationSQL([]));
}
@@ -875,7 +915,7 @@ public function testReturnsGuidTypeDeclarationSQL()
/**
* {@inheritdoc}
*/
- public function getAlterTableRenameColumnSQL()
+ public function getAlterTableRenameColumnSQL() : array
{
return ['ALTER TABLE foo RENAME bar TO baz'];
}
@@ -883,7 +923,7 @@ public function getAlterTableRenameColumnSQL()
/**
* {@inheritdoc}
*/
- protected function getQuotesTableIdentifiersInAlterTableSQL()
+ protected function getQuotesTableIdentifiersInAlterTableSQL() : array
{
return [
'ALTER TABLE "foo" DROP FOREIGN KEY fk1',
@@ -899,7 +939,7 @@ protected function getQuotesTableIdentifiersInAlterTableSQL()
/**
* {@inheritdoc}
*/
- protected function getCommentOnColumnSQL()
+ protected function getCommentOnColumnSQL() : array
{
return [
'COMMENT ON COLUMN foo.bar IS \'comment\'',
@@ -911,7 +951,7 @@ protected function getCommentOnColumnSQL()
/**
* @group DBAL-1004
*/
- public function testAltersTableColumnCommentWithExplicitlyQuotedIdentifiers()
+ public function testAltersTableColumnCommentWithExplicitlyQuotedIdentifiers() : void
{
$table1 = new Table('"foo"', [new Column('"bar"', Type::getType('integer'))]);
$table2 = new Table('"foo"', [new Column('"bar"', Type::getType('integer'), ['comment' => 'baz'])]);
@@ -930,7 +970,7 @@ public function testAltersTableColumnCommentWithExplicitlyQuotedIdentifiers()
/**
* {@inheritdoc}
*/
- public function getReturnsForeignKeyReferentialActionSQL()
+ public static function getReturnsForeignKeyReferentialActionSQL() : iterable
{
return [
['CASCADE', 'CASCADE'],
@@ -945,7 +985,7 @@ public function getReturnsForeignKeyReferentialActionSQL()
/**
* {@inheritdoc}
*/
- protected function getQuotesReservedKeywordInUniqueConstraintDeclarationSQL()
+ protected function getQuotesReservedKeywordInUniqueConstraintDeclarationSQL() : string
{
return 'CONSTRAINT "select" UNIQUE (foo)';
}
@@ -953,7 +993,7 @@ protected function getQuotesReservedKeywordInUniqueConstraintDeclarationSQL()
/**
* {@inheritdoc}
*/
- protected function getQuotesReservedKeywordInIndexDeclarationSQL()
+ protected function getQuotesReservedKeywordInIndexDeclarationSQL() : string
{
return ''; // not supported by this platform
}
@@ -961,7 +1001,7 @@ protected function getQuotesReservedKeywordInIndexDeclarationSQL()
/**
* {@inheritdoc}
*/
- protected function getQuotesReservedKeywordInTruncateTableSQL()
+ protected function getQuotesReservedKeywordInTruncateTableSQL() : string
{
return 'TRUNCATE TABLE "select"';
}
@@ -969,7 +1009,7 @@ protected function getQuotesReservedKeywordInTruncateTableSQL()
/**
* {@inheritdoc}
*/
- protected function supportsInlineIndexDeclaration()
+ protected function supportsInlineIndexDeclaration() : bool
{
return false;
}
@@ -977,7 +1017,7 @@ protected function supportsInlineIndexDeclaration()
/**
* {@inheritdoc}
*/
- protected function getAlterStringToFixedStringSQL()
+ protected function getAlterStringToFixedStringSQL() : array
{
return ['ALTER TABLE mytable ALTER name CHAR(2) NOT NULL'];
}
@@ -985,7 +1025,7 @@ protected function getAlterStringToFixedStringSQL()
/**
* {@inheritdoc}
*/
- protected function getGeneratesAlterTableRenameIndexUsedByForeignKeySQL()
+ protected function getGeneratesAlterTableRenameIndexUsedByForeignKeySQL() : array
{
return ['ALTER INDEX idx_foo ON mytable RENAME TO idx_foo_renamed'];
}
@@ -993,7 +1033,7 @@ protected function getGeneratesAlterTableRenameIndexUsedByForeignKeySQL()
/**
* @group DBAL-2436
*/
- public function testQuotesSchemaNameInListTableColumnsSQL()
+ public function testQuotesSchemaNameInListTableColumnsSQL() : void
{
self::assertStringContainsStringIgnoringCase(
"'Foo''Bar\\'",
@@ -1004,7 +1044,7 @@ public function testQuotesSchemaNameInListTableColumnsSQL()
/**
* @group DBAL-2436
*/
- public function testQuotesTableNameInListTableConstraintsSQL()
+ public function testQuotesTableNameInListTableConstraintsSQL() : void
{
self::assertStringContainsStringIgnoringCase("'Foo''Bar\\'", $this->platform->getListTableConstraintsSQL("Foo'Bar\\"), '', true);
}
@@ -1012,7 +1052,7 @@ public function testQuotesTableNameInListTableConstraintsSQL()
/**
* @group DBAL-2436
*/
- public function testQuotesSchemaNameInListTableConstraintsSQL()
+ public function testQuotesSchemaNameInListTableConstraintsSQL() : void
{
self::assertStringContainsStringIgnoringCase(
"'Foo''Bar\\'",
@@ -1023,7 +1063,7 @@ public function testQuotesSchemaNameInListTableConstraintsSQL()
/**
* @group DBAL-2436
*/
- public function testQuotesTableNameInListTableForeignKeysSQL()
+ public function testQuotesTableNameInListTableForeignKeysSQL() : void
{
self::assertStringContainsStringIgnoringCase(
"'Foo''Bar\\'",
@@ -1034,7 +1074,7 @@ public function testQuotesTableNameInListTableForeignKeysSQL()
/**
* @group DBAL-2436
*/
- public function testQuotesSchemaNameInListTableForeignKeysSQL()
+ public function testQuotesSchemaNameInListTableForeignKeysSQL() : void
{
self::assertStringContainsStringIgnoringCase(
"'Foo''Bar\\'",
@@ -1045,7 +1085,7 @@ public function testQuotesSchemaNameInListTableForeignKeysSQL()
/**
* @group DBAL-2436
*/
- public function testQuotesTableNameInListTableIndexesSQL()
+ public function testQuotesTableNameInListTableIndexesSQL() : void
{
self::assertStringContainsStringIgnoringCase(
"'Foo''Bar\\'",
@@ -1056,7 +1096,7 @@ public function testQuotesTableNameInListTableIndexesSQL()
/**
* @group DBAL-2436
*/
- public function testQuotesSchemaNameInListTableIndexesSQL()
+ public function testQuotesSchemaNameInListTableIndexesSQL() : void
{
self::assertStringContainsStringIgnoringCase(
"'Foo''Bar\\'",
diff --git a/tests/Doctrine/Tests/DBAL/Platforms/SQLAzurePlatformTest.php b/tests/Doctrine/Tests/DBAL/Platforms/SQLAzurePlatformTest.php
index 8aa6bc0cda3..65b5e85f219 100644
--- a/tests/Doctrine/Tests/DBAL/Platforms/SQLAzurePlatformTest.php
+++ b/tests/Doctrine/Tests/DBAL/Platforms/SQLAzurePlatformTest.php
@@ -19,7 +19,7 @@ protected function setUp() : void
$this->platform = new SQLAzurePlatform();
}
- public function testCreateFederatedOnTable()
+ public function testCreateFederatedOnTable() : void
{
$table = new Table('tbl');
$table->addColumn('id', 'integer');
diff --git a/tests/Doctrine/Tests/DBAL/Platforms/SQLServer2008PlatformTest.php b/tests/Doctrine/Tests/DBAL/Platforms/SQLServer2008PlatformTest.php
index 3083ab7b606..60abcad7c06 100644
--- a/tests/Doctrine/Tests/DBAL/Platforms/SQLServer2008PlatformTest.php
+++ b/tests/Doctrine/Tests/DBAL/Platforms/SQLServer2008PlatformTest.php
@@ -2,16 +2,17 @@
namespace Doctrine\Tests\DBAL\Platforms;
+use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Platforms\SQLServer2008Platform;
class SQLServer2008PlatformTest extends AbstractSQLServerPlatformTestCase
{
- public function createPlatform()
+ public function createPlatform() : AbstractPlatform
{
return new SQLServer2008Platform();
}
- public function testGeneratesTypeDeclarationForDateTimeTz()
+ public function testGeneratesTypeDeclarationForDateTimeTz() : void
{
self::assertEquals('DATETIMEOFFSET(6)', $this->platform->getDateTimeTzTypeDeclarationSQL([]));
}
diff --git a/tests/Doctrine/Tests/DBAL/Platforms/SQLServer2012PlatformTest.php b/tests/Doctrine/Tests/DBAL/Platforms/SQLServer2012PlatformTest.php
index 91f8cfe2dc2..18a8a0ef1d2 100644
--- a/tests/Doctrine/Tests/DBAL/Platforms/SQLServer2012PlatformTest.php
+++ b/tests/Doctrine/Tests/DBAL/Platforms/SQLServer2012PlatformTest.php
@@ -3,27 +3,28 @@
namespace Doctrine\Tests\DBAL\Platforms;
use Doctrine\DBAL\DBALException;
+use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Platforms\SQLServer2012Platform;
use Doctrine\DBAL\Schema\Sequence;
class SQLServer2012PlatformTest extends AbstractSQLServerPlatformTestCase
{
- public function createPlatform()
+ public function createPlatform() : AbstractPlatform
{
return new SQLServer2012Platform();
}
- public function testSupportsSequences()
+ public function testSupportsSequences() : void
{
self::assertTrue($this->platform->supportsSequences());
}
- public function testDoesNotPreferSequences()
+ public function testDoesNotPreferSequences() : void
{
self::assertFalse($this->platform->prefersSequences());
}
- public function testGeneratesSequenceSqlCommands()
+ public function testGeneratesSequenceSqlCommands() : void
{
$sequence = new Sequence('myseq', 20, 1);
self::assertEquals(
@@ -44,55 +45,55 @@ public function testGeneratesSequenceSqlCommands()
);
}
- public function testModifyLimitQuery()
+ public function testModifyLimitQuery() : void
{
$sql = $this->platform->modifyLimitQuery('SELECT * FROM user', 10, 0);
self::assertEquals('SELECT * FROM user ORDER BY (SELECT 0) OFFSET 0 ROWS FETCH NEXT 10 ROWS ONLY', $sql);
}
- public function testModifyLimitQueryWithEmptyOffset()
+ public function testModifyLimitQueryWithEmptyOffset() : void
{
$sql = $this->platform->modifyLimitQuery('SELECT * FROM user', 10);
self::assertEquals('SELECT * FROM user ORDER BY (SELECT 0) OFFSET 0 ROWS FETCH NEXT 10 ROWS ONLY', $sql);
}
- public function testModifyLimitQueryWithOffset()
+ public function testModifyLimitQueryWithOffset() : void
{
$sql = $this->platform->modifyLimitQuery('SELECT * FROM user ORDER BY username DESC', 10, 5);
self::assertEquals('SELECT * FROM user ORDER BY username DESC OFFSET 5 ROWS FETCH NEXT 10 ROWS ONLY', $sql);
}
- public function testModifyLimitQueryWithAscOrderBy()
+ public function testModifyLimitQueryWithAscOrderBy() : void
{
$sql = $this->platform->modifyLimitQuery('SELECT * FROM user ORDER BY username ASC', 10);
self::assertEquals('SELECT * FROM user ORDER BY username ASC OFFSET 0 ROWS FETCH NEXT 10 ROWS ONLY', $sql);
}
- public function testModifyLimitQueryWithLowercaseOrderBy()
+ public function testModifyLimitQueryWithLowercaseOrderBy() : void
{
$sql = $this->platform->modifyLimitQuery('SELECT * FROM user order by username', 10);
self::assertEquals('SELECT * FROM user order by username OFFSET 0 ROWS FETCH NEXT 10 ROWS ONLY', $sql);
}
- public function testModifyLimitQueryWithDescOrderBy()
+ public function testModifyLimitQueryWithDescOrderBy() : void
{
$sql = $this->platform->modifyLimitQuery('SELECT * FROM user ORDER BY username DESC', 10);
self::assertEquals('SELECT * FROM user ORDER BY username DESC OFFSET 0 ROWS FETCH NEXT 10 ROWS ONLY', $sql);
}
- public function testModifyLimitQueryWithMultipleOrderBy()
+ public function testModifyLimitQueryWithMultipleOrderBy() : void
{
$sql = $this->platform->modifyLimitQuery('SELECT * FROM user ORDER BY username DESC, usereamil ASC', 10);
self::assertEquals('SELECT * FROM user ORDER BY username DESC, usereamil ASC OFFSET 0 ROWS FETCH NEXT 10 ROWS ONLY', $sql);
}
- public function testModifyLimitQueryWithSubSelect()
+ public function testModifyLimitQueryWithSubSelect() : void
{
$sql = $this->platform->modifyLimitQuery('SELECT * FROM (SELECT u.id as uid, u.name as uname) dctrn_result', 10);
self::assertEquals('SELECT * FROM (SELECT u.id as uid, u.name as uname) dctrn_result ORDER BY (SELECT 0) OFFSET 0 ROWS FETCH NEXT 10 ROWS ONLY', $sql);
}
- public function testModifyLimitQueryWithSubSelectAndOrder()
+ public function testModifyLimitQueryWithSubSelectAndOrder() : void
{
$sql = $this->platform->modifyLimitQuery('SELECT * FROM (SELECT u.id as uid, u.name as uname) dctrn_result ORDER BY uname DESC', 10);
self::assertEquals('SELECT * FROM (SELECT u.id as uid, u.name as uname) dctrn_result ORDER BY uname DESC OFFSET 0 ROWS FETCH NEXT 10 ROWS ONLY', $sql);
@@ -101,7 +102,7 @@ public function testModifyLimitQueryWithSubSelectAndOrder()
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()
+ public function testModifyLimitQueryWithSubSelectAndMultipleOrder() : void
{
$sql = $this->platform->modifyLimitQuery('SELECT * FROM (SELECT u.id as uid, u.name as uname) dctrn_result ORDER BY uname DESC, uid ASC', 10, 5);
self::assertEquals('SELECT * FROM (SELECT u.id as uid, u.name as uname) dctrn_result ORDER BY uname DESC, uid ASC OFFSET 5 ROWS FETCH NEXT 10 ROWS ONLY', $sql);
@@ -113,7 +114,7 @@ public function testModifyLimitQueryWithSubSelectAndMultipleOrder()
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()
+ public function testModifyLimitQueryWithFromColumnNames() : void
{
$sql = $this->platform->modifyLimitQuery('SELECT a.fromFoo, fromBar FROM foo', 10);
self::assertEquals('SELECT a.fromFoo, fromBar FROM foo ORDER BY (SELECT 0) OFFSET 0 ROWS FETCH NEXT 10 ROWS ONLY', $sql);
@@ -122,7 +123,7 @@ public function testModifyLimitQueryWithFromColumnNames()
/**
* @group DBAL-927
*/
- public function testModifyLimitQueryWithExtraLongQuery()
+ public function testModifyLimitQueryWithExtraLongQuery() : void
{
$query = 'SELECT table1.column1, table2.column2, table3.column3, table4.column4, table5.column5, table6.column6, table7.column7, table8.column8 FROM table1, table2, table3, table4, table5, table6, table7, table8 ';
$query .= 'WHERE (table1.column1 = table2.column2) AND (table1.column1 = table3.column3) AND (table1.column1 = table4.column4) AND (table1.column1 = table5.column5) AND (table1.column1 = table6.column6) AND (table1.column1 = table7.column7) AND (table1.column1 = table8.column8) AND (table2.column2 = table3.column3) AND (table2.column2 = table4.column4) AND (table2.column2 = table5.column5) AND (table2.column2 = table6.column6) ';
@@ -143,7 +144,7 @@ public function testModifyLimitQueryWithExtraLongQuery()
/**
* @group DDC-2470
*/
- public function testModifyLimitQueryWithOrderByClause()
+ public function testModifyLimitQueryWithOrderByClause() : void
{
$sql = 'SELECT m0_.NOMBRE AS NOMBRE0, m0_.FECHAINICIO AS FECHAINICIO1, m0_.FECHAFIN AS FECHAFIN2 FROM MEDICION m0_ WITH (NOLOCK) INNER JOIN ESTUDIO e1_ ON m0_.ESTUDIO_ID = e1_.ID INNER JOIN CLIENTE c2_ ON e1_.CLIENTE_ID = c2_.ID INNER JOIN USUARIO u3_ ON c2_.ID = u3_.CLIENTE_ID WHERE u3_.ID = ? ORDER BY m0_.FECHAINICIO DESC';
$expected = 'SELECT m0_.NOMBRE AS NOMBRE0, m0_.FECHAINICIO AS FECHAINICIO1, m0_.FECHAFIN AS FECHAFIN2 FROM MEDICION m0_ WITH (NOLOCK) INNER JOIN ESTUDIO e1_ ON m0_.ESTUDIO_ID = e1_.ID INNER JOIN CLIENTE c2_ ON e1_.CLIENTE_ID = c2_.ID INNER JOIN USUARIO u3_ ON c2_.ID = u3_.CLIENTE_ID WHERE u3_.ID = ? ORDER BY m0_.FECHAINICIO DESC OFFSET 5 ROWS FETCH NEXT 10 ROWS ONLY';
@@ -155,7 +156,7 @@ public function testModifyLimitQueryWithOrderByClause()
/**
* @group DBAL-713
*/
- public function testModifyLimitQueryWithSubSelectInSelectList()
+ public function testModifyLimitQueryWithSubSelectInSelectList() : void
{
$sql = $this->platform->modifyLimitQuery(
'SELECT ' .
@@ -185,7 +186,7 @@ public function testModifyLimitQueryWithSubSelectInSelectList()
/**
* @group DBAL-713
*/
- public function testModifyLimitQueryWithSubSelectInSelectListAndOrderByClause()
+ public function testModifyLimitQueryWithSubSelectInSelectListAndOrderByClause() : void
{
$sql = $this->platform->modifyLimitQuery(
'SELECT ' .
@@ -217,7 +218,7 @@ public function testModifyLimitQueryWithSubSelectInSelectListAndOrderByClause()
/**
* @group DBAL-834
*/
- public function testModifyLimitQueryWithAggregateFunctionInOrderByClause()
+ public function testModifyLimitQueryWithAggregateFunctionInOrderByClause() : void
{
$sql = $this->platform->modifyLimitQuery(
'SELECT ' .
@@ -242,7 +243,7 @@ public function testModifyLimitQueryWithAggregateFunctionInOrderByClause()
);
}
- public function testModifyLimitQueryWithFromSubquery()
+ public function testModifyLimitQueryWithFromSubquery() : void
{
$sql = $this->platform->modifyLimitQuery('SELECT DISTINCT id_0 FROM (SELECT k0_.id AS id_0 FROM key_measure k0_ WHERE (k0_.id_zone in(2))) dctrn_result', 10);
@@ -251,7 +252,7 @@ public function testModifyLimitQueryWithFromSubquery()
self::assertEquals($sql, $expected);
}
- public function testModifyLimitQueryWithFromSubqueryAndOrder()
+ public function testModifyLimitQueryWithFromSubqueryAndOrder() : void
{
$sql = $this->platform->modifyLimitQuery('SELECT DISTINCT id_0, value_1 FROM (SELECT k0_.id AS id_0, k0_.value AS value_1 FROM key_measure k0_ WHERE (k0_.id_zone in(2))) dctrn_result ORDER BY value_1 DESC', 10);
@@ -260,7 +261,7 @@ public function testModifyLimitQueryWithFromSubqueryAndOrder()
self::assertEquals($sql, $expected);
}
- public function testModifyLimitQueryWithComplexOrderByExpression()
+ public function testModifyLimitQueryWithComplexOrderByExpression() : void
{
$sql = $this->platform->modifyLimitQuery('SELECT * FROM table ORDER BY (table.x * table.y) DESC', 10);
@@ -272,7 +273,7 @@ public function testModifyLimitQueryWithComplexOrderByExpression()
/**
* @throws DBALException
*/
- public function testModifyLimitSubqueryWithJoinAndSubqueryOrderedByColumnFromBaseTable()
+ public function testModifyLimitSubqueryWithJoinAndSubqueryOrderedByColumnFromBaseTable() : void
{
$querySql = 'SELECT DISTINCT id_0, name_1 '
. 'FROM ('
@@ -295,7 +296,7 @@ public function testModifyLimitSubqueryWithJoinAndSubqueryOrderedByColumnFromBas
/**
* @throws DBALException
*/
- public function testModifyLimitSubqueryWithJoinAndSubqueryOrderedByColumnFromJoinTable()
+ public function testModifyLimitSubqueryWithJoinAndSubqueryOrderedByColumnFromJoinTable() : void
{
$querySql = 'SELECT DISTINCT id_0, name_1 '
. 'FROM ('
@@ -318,7 +319,7 @@ public function testModifyLimitSubqueryWithJoinAndSubqueryOrderedByColumnFromJoi
/**
* @throws DBALException
*/
- public function testModifyLimitSubqueryWithJoinAndSubqueryOrderedByColumnsFromBothTables()
+ public function testModifyLimitSubqueryWithJoinAndSubqueryOrderedByColumnsFromBothTables() : void
{
$querySql = 'SELECT DISTINCT id_0, name_1, foo_2 '
. 'FROM ('
@@ -338,7 +339,7 @@ public function testModifyLimitSubqueryWithJoinAndSubqueryOrderedByColumnsFromBo
self::assertEquals($alteredSql, $sql);
}
- public function testModifyLimitSubquerySimple()
+ public function testModifyLimitSubquerySimple() : void
{
$querySql = 'SELECT DISTINCT id_0 FROM '
. '(SELECT k0_.id AS id_0, k0_.field AS field_1 '
@@ -349,7 +350,7 @@ public function testModifyLimitSubquerySimple()
self::assertEquals($alteredSql, $sql);
}
- public function testModifyLimitQueryWithTopNSubQueryWithOrderBy()
+ public function testModifyLimitQueryWithTopNSubQueryWithOrderBy() : void
{
$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';
@@ -362,7 +363,7 @@ public function testModifyLimitQueryWithTopNSubQueryWithOrderBy()
self::assertEquals($expectedSql, $sql);
}
- public function testModifyLimitQueryWithNewlineBeforeOrderBy()
+ public function testModifyLimitQueryWithNewlineBeforeOrderBy() : void
{
$querySql = "SELECT * FROM test\nORDER BY col DESC";
$expectedSql = "SELECT * FROM test\nORDER BY col DESC OFFSET 0 ROWS FETCH NEXT 10 ROWS ONLY";
diff --git a/tests/Doctrine/Tests/DBAL/Platforms/SQLServerPlatformTest.php b/tests/Doctrine/Tests/DBAL/Platforms/SQLServerPlatformTest.php
index ed2842813aa..77cf7b17b41 100644
--- a/tests/Doctrine/Tests/DBAL/Platforms/SQLServerPlatformTest.php
+++ b/tests/Doctrine/Tests/DBAL/Platforms/SQLServerPlatformTest.php
@@ -3,20 +3,23 @@
namespace Doctrine\Tests\DBAL\Platforms;
use Doctrine\DBAL\LockMode;
+use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Platforms\SQLServerPlatform;
class SQLServerPlatformTest extends AbstractSQLServerPlatformTestCase
{
- public function createPlatform()
+ public function createPlatform() : AbstractPlatform
{
return new SQLServerPlatform();
}
/**
+ * @param int|bool|null $lockMode
+ *
* @group DDC-2310
* @dataProvider getLockHints
*/
- public function testAppendsLockHint($lockMode, $lockHint)
+ public function testAppendsLockHint($lockMode, string $lockHint) : void
{
$fromClause = 'FROM users';
$expectedResult = $fromClause . $lockHint;
@@ -28,12 +31,15 @@ public function testAppendsLockHint($lockMode, $lockHint)
* @group DBAL-2408
* @dataProvider getModifyLimitQueries
*/
- public function testScrubInnerOrderBy($query, $limit, $offset, $expectedResult)
+ public function testScrubInnerOrderBy(string $query, int $limit, ?int $offset, string $expectedResult) : void
{
self::assertSame($expectedResult, $this->platform->modifyLimitQuery($query, $limit, $offset));
}
- public function getLockHints()
+ /**
+ * @return mixed[][]
+ */
+ public static function getLockHints() : iterable
{
return [
[null, ''],
@@ -46,7 +52,10 @@ public function getLockHints()
];
}
- public function getModifyLimitQueries()
+ /**
+ * @return mixed[][]
+ */
+ public static function getModifyLimitQueries() : iterable
{
return [
// Test re-ordered query with correctly-scrubbed ORDER BY clause
diff --git a/tests/Doctrine/Tests/DBAL/Platforms/SqlitePlatformTest.php b/tests/Doctrine/Tests/DBAL/Platforms/SqlitePlatformTest.php
index 26cc4d304eb..d645b218cb8 100644
--- a/tests/Doctrine/Tests/DBAL/Platforms/SqlitePlatformTest.php
+++ b/tests/Doctrine/Tests/DBAL/Platforms/SqlitePlatformTest.php
@@ -3,6 +3,7 @@
namespace Doctrine\Tests\DBAL\Platforms;
use Doctrine\DBAL\DBALException;
+use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Platforms\SqlitePlatform;
use Doctrine\DBAL\Schema\Column;
use Doctrine\DBAL\Schema\Table;
@@ -12,17 +13,20 @@
class SqlitePlatformTest extends AbstractPlatformTestCase
{
- public function createPlatform()
+ public function createPlatform() : AbstractPlatform
{
return new SqlitePlatform();
}
- public function getGenerateTableSql()
+ public function getGenerateTableSql() : string
{
return 'CREATE TABLE test (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, test VARCHAR(255) DEFAULT NULL)';
}
- public function getGenerateTableWithMultiColumnUniqueIndexSql()
+ /**
+ * {@inheritDoc}
+ */
+ public function getGenerateTableWithMultiColumnUniqueIndexSql() : array
{
return [
'CREATE TABLE test (foo VARCHAR(255) DEFAULT NULL, bar VARCHAR(255) DEFAULT NULL)',
@@ -30,14 +34,14 @@ public function getGenerateTableWithMultiColumnUniqueIndexSql()
];
}
- public function testGeneratesSqlSnippets()
+ public function testGeneratesSqlSnippets() : void
{
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()
+ public function testGeneratesTransactionCommands() : void
{
self::assertEquals(
'PRAGMA read_uncommitted = 0',
@@ -57,12 +61,12 @@ public function testGeneratesTransactionCommands()
);
}
- public function testPrefersIdentityColumns()
+ public function testPrefersIdentityColumns() : void
{
self::assertTrue($this->platform->prefersIdentityColumns());
}
- public function testIgnoresUnsignedIntegerDeclarationForAutoIncrementalIntegers()
+ public function testIgnoresUnsignedIntegerDeclarationForAutoIncrementalIntegers() : void
{
self::assertSame(
'INTEGER PRIMARY KEY AUTOINCREMENT',
@@ -74,7 +78,7 @@ public function testIgnoresUnsignedIntegerDeclarationForAutoIncrementalIntegers(
* @group DBAL-752
* @group DBAL-924
*/
- public function testGeneratesTypeDeclarationForTinyIntegers()
+ public function testGeneratesTypeDeclarationForTinyIntegers() : void
{
self::assertEquals(
'TINYINT',
@@ -104,7 +108,7 @@ public function testGeneratesTypeDeclarationForTinyIntegers()
* @group DBAL-752
* @group DBAL-924
*/
- public function testGeneratesTypeDeclarationForSmallIntegers()
+ public function testGeneratesTypeDeclarationForSmallIntegers() : void
{
self::assertEquals(
'SMALLINT',
@@ -138,7 +142,7 @@ public function testGeneratesTypeDeclarationForSmallIntegers()
* @group DBAL-752
* @group DBAL-924
*/
- public function testGeneratesTypeDeclarationForMediumIntegers()
+ public function testGeneratesTypeDeclarationForMediumIntegers() : void
{
self::assertEquals(
'MEDIUMINT',
@@ -168,7 +172,7 @@ public function testGeneratesTypeDeclarationForMediumIntegers()
);
}
- public function testGeneratesTypeDeclarationForIntegers()
+ public function testGeneratesTypeDeclarationForIntegers() : void
{
self::assertEquals(
'INTEGER',
@@ -202,7 +206,7 @@ public function testGeneratesTypeDeclarationForIntegers()
* @group DBAL-752
* @group DBAL-924
*/
- public function testGeneratesTypeDeclarationForBigIntegers()
+ public function testGeneratesTypeDeclarationForBigIntegers() : void
{
self::assertEquals(
'BIGINT',
@@ -232,7 +236,7 @@ public function testGeneratesTypeDeclarationForBigIntegers()
);
}
- public function testGeneratesTypeDeclarationForStrings()
+ public function testGeneratesTypeDeclarationForStrings() : void
{
self::assertEquals(
'CHAR(10)',
@@ -252,54 +256,57 @@ public function testGeneratesTypeDeclarationForStrings()
);
}
- public function getGenerateIndexSql()
+ public function getGenerateIndexSql() : string
{
return 'CREATE INDEX my_idx ON mytable (user_name, last_login)';
}
- public function getGenerateUniqueIndexSql()
+ public function getGenerateUniqueIndexSql() : string
{
return 'CREATE UNIQUE INDEX index_name ON test (test, test2)';
}
- public function testGeneratesForeignKeyCreationSql()
+ public function testGeneratesForeignKeyCreationSql() : void
{
$this->expectException(DBALException::class);
parent::testGeneratesForeignKeyCreationSql();
}
- public function testGeneratesConstraintCreationSql()
+ public function testGeneratesConstraintCreationSql() : void
{
$this->expectException(DBALException::class);
parent::testGeneratesConstraintCreationSql();
}
- public function getGenerateForeignKeySql()
+ public function getGenerateForeignKeySql() : string
{
return null;
}
- public function testModifyLimitQuery()
+ public function testModifyLimitQuery() : void
{
$sql = $this->platform->modifyLimitQuery('SELECT * FROM user', 10, 0);
self::assertEquals('SELECT * FROM user LIMIT 10', $sql);
}
- public function testModifyLimitQueryWithEmptyOffset()
+ public function testModifyLimitQueryWithEmptyOffset() : void
{
$sql = $this->platform->modifyLimitQuery('SELECT * FROM user', 10);
self::assertEquals('SELECT * FROM user LIMIT 10', $sql);
}
- public function testModifyLimitQueryWithOffsetAndEmptyLimit()
+ public function testModifyLimitQueryWithOffsetAndEmptyLimit() : void
{
$sql = $this->platform->modifyLimitQuery('SELECT * FROM user', null, 10);
self::assertEquals('SELECT * FROM user LIMIT -1 OFFSET 10', $sql);
}
- public function getGenerateAlterTableSql()
+ /**
+ * {@inheritDoc}
+ */
+ public function getGenerateAlterTableSql() : array
{
return [
'CREATE TEMPORARY TABLE __temp__mytable AS SELECT id, bar, bloo FROM mytable',
@@ -314,7 +321,7 @@ public function getGenerateAlterTableSql()
/**
* @group DDC-1845
*/
- public function testGenerateTableSqlShouldNotAutoQuotePrimaryKey()
+ public function testGenerateTableSqlShouldNotAutoQuotePrimaryKey() : void
{
$table = new Table('test');
$table->addColumn('"like"', 'integer', ['notnull' => true, 'autoincrement' => true]);
@@ -327,7 +334,7 @@ public function testGenerateTableSqlShouldNotAutoQuotePrimaryKey()
);
}
- public function testAlterTableAddColumns()
+ public function testAlterTableAddColumns() : void
{
$diff = new TableDiff('user');
$diff->addedColumns['foo'] = new Column('foo', Type::getType('string'));
@@ -351,8 +358,10 @@ public function testAlterTableAddComplexColumns(TableDiff $diff) : void
$this->platform->getAlterTableSQL($diff);
}
- /** @return mixed[] */
- public function complexDiffProvider() : array
+ /**
+ * @return mixed[][]
+ */
+ public static function complexDiffProvider() : iterable
{
$date = new TableDiff('user');
$date->addedColumns['time'] = new Column('time', Type::getType('date'), ['default' => 'CURRENT_DATE']);
@@ -366,7 +375,7 @@ public function complexDiffProvider() : array
];
}
- public function testCreateTableWithDeferredForeignKeys()
+ public function testCreateTableWithDeferredForeignKeys() : void
{
$table = new Table('user');
$table->addColumn('id', 'integer');
@@ -394,7 +403,7 @@ public function testCreateTableWithDeferredForeignKeys()
self::assertEquals($sql, $this->platform->getCreateTableSQL($table));
}
- public function testAlterTable()
+ public function testAlterTable() : void
{
$table = new Table('user');
$table->addColumn('id', 'integer');
@@ -438,12 +447,18 @@ public function testAlterTable()
self::assertEquals($sql, $this->platform->getAlterTableSQL($diff));
}
- protected function getQuotedColumnInPrimaryKeySQL()
+ /**
+ * {@inheritDoc}
+ */
+ protected function getQuotedColumnInPrimaryKeySQL() : array
{
return ['CREATE TABLE "quoted" ("create" VARCHAR(255) NOT NULL, PRIMARY KEY("create"))'];
}
- protected function getQuotedColumnInIndexSQL()
+ /**
+ * {@inheritDoc}
+ */
+ protected function getQuotedColumnInIndexSQL() : array
{
return [
'CREATE TABLE "quoted" ("create" VARCHAR(255) NOT NULL)',
@@ -451,7 +466,10 @@ protected function getQuotedColumnInIndexSQL()
];
}
- protected function getQuotedNameInIndexSQL()
+ /**
+ * {@inheritDoc}
+ */
+ protected function getQuotedNameInIndexSQL() : array
{
return [
'CREATE TABLE test (column1 VARCHAR(255) NOT NULL)',
@@ -459,7 +477,10 @@ protected function getQuotedNameInIndexSQL()
];
}
- protected function getQuotedColumnInForeignKeySQL()
+ /**
+ * {@inheritDoc}
+ */
+ protected function getQuotedColumnInForeignKeySQL() : array
{
return [
'CREATE TABLE "quoted" (' .
@@ -470,17 +491,17 @@ protected function getQuotedColumnInForeignKeySQL()
];
}
- protected function getBinaryDefaultLength()
+ protected function getBinaryDefaultLength() : int
{
return 0;
}
- protected function getBinaryMaxLength()
+ protected function getBinaryMaxLength() : int
{
return 0;
}
- public function testReturnsBinaryTypeDeclarationSQL()
+ public function testReturnsBinaryTypeDeclarationSQL() : void
{
self::assertSame('BLOB', $this->platform->getBinaryTypeDeclarationSQL([]));
self::assertSame('BLOB', $this->platform->getBinaryTypeDeclarationSQL(['length' => 0]));
@@ -492,9 +513,11 @@ public function testReturnsBinaryTypeDeclarationSQL()
}
/**
+ * {@inheritDoc}
+ *
* @group DBAL-234
*/
- protected function getAlterTableRenameIndexSQL()
+ protected function getAlterTableRenameIndexSQL() : array
{
return [
'CREATE TEMPORARY TABLE __temp__mytable AS SELECT id FROM mytable',
@@ -507,9 +530,11 @@ protected function getAlterTableRenameIndexSQL()
}
/**
+ * {@inheritDoc}
+ *
* @group DBAL-234
*/
- protected function getQuotedAlterTableRenameIndexSQL()
+ protected function getQuotedAlterTableRenameIndexSQL() : array
{
return [
'CREATE TEMPORARY TABLE __temp__table AS SELECT id FROM "table"',
@@ -525,7 +550,7 @@ protected function getQuotedAlterTableRenameIndexSQL()
/**
* {@inheritdoc}
*/
- protected function getQuotedAlterTableRenameColumnSQL()
+ protected function getQuotedAlterTableRenameColumnSQL() : array
{
return [
'CREATE TEMPORARY TABLE __temp__mytable AS SELECT unquoted1, unquoted2, unquoted3, "create", "table", "select", "quoted1", "quoted2", "quoted3" FROM mytable',
@@ -548,7 +573,7 @@ protected function getQuotedAlterTableRenameColumnSQL()
/**
* {@inheritdoc}
*/
- protected function getQuotedAlterTableChangeColumnLengthSQL()
+ protected function getQuotedAlterTableChangeColumnLengthSQL() : array
{
return [
'CREATE TEMPORARY TABLE __temp__mytable AS SELECT unquoted1, unquoted2, unquoted3, "create", "table", "select" FROM mytable',
@@ -568,7 +593,7 @@ protected function getQuotedAlterTableChangeColumnLengthSQL()
/**
* @group DBAL-807
*/
- public function testAlterTableRenameIndexInSchema()
+ public function testAlterTableRenameIndexInSchema() : void
{
$this->markTestIncomplete(
'Test currently produces broken SQL due to SQLLitePlatform::getAlterTable being broken ' .
@@ -579,7 +604,7 @@ public function testAlterTableRenameIndexInSchema()
/**
* @group DBAL-807
*/
- public function testQuotesAlterTableRenameIndexInSchema()
+ public function testQuotesAlterTableRenameIndexInSchema() : void
{
$this->markTestIncomplete(
'Test currently produces broken SQL due to SQLLitePlatform::getAlterTable being broken ' .
@@ -590,7 +615,7 @@ public function testQuotesAlterTableRenameIndexInSchema()
/**
* @group DBAL-423
*/
- public function testReturnsGuidTypeDeclarationSQL()
+ public function testReturnsGuidTypeDeclarationSQL() : void
{
self::assertSame('CHAR(36)', $this->platform->getGuidTypeDeclarationSQL([]));
}
@@ -598,7 +623,7 @@ public function testReturnsGuidTypeDeclarationSQL()
/**
* {@inheritdoc}
*/
- public function getAlterTableRenameColumnSQL()
+ public function getAlterTableRenameColumnSQL() : array
{
return [
'CREATE TEMPORARY TABLE __temp__foo AS SELECT bar FROM foo',
@@ -613,7 +638,7 @@ public function getAlterTableRenameColumnSQL()
/**
* {@inheritdoc}
*/
- protected function getQuotesTableIdentifiersInAlterTableSQL()
+ protected function getQuotesTableIdentifiersInAlterTableSQL() : array
{
return [
'DROP INDEX IDX_8C736521A81E660E',
@@ -635,7 +660,7 @@ protected function getQuotesTableIdentifiersInAlterTableSQL()
/**
* {@inheritdoc}
*/
- protected function getCommentOnColumnSQL()
+ protected function getCommentOnColumnSQL() : array
{
return [
'COMMENT ON COLUMN foo.bar IS \'comment\'',
@@ -644,22 +669,22 @@ protected function getCommentOnColumnSQL()
];
}
- protected function getInlineColumnCommentDelimiter()
+ protected static function getInlineColumnCommentDelimiter() : string
{
return "\n";
}
- protected function getInlineColumnRegularCommentSQL()
+ protected static function getInlineColumnRegularCommentSQL() : string
{
return "--Regular comment\n";
}
- protected function getInlineColumnCommentRequiringEscapingSQL()
+ protected static function getInlineColumnCommentRequiringEscapingSQL() : string
{
return "--Using inline comment delimiter \n-- works\n";
}
- protected function getInlineColumnEmptyCommentSQL()
+ protected static function getInlineColumnEmptyCommentSQL() : string
{
return "--\n";
}
@@ -667,7 +692,7 @@ protected function getInlineColumnEmptyCommentSQL()
/**
* {@inheritdoc}
*/
- protected function getQuotesReservedKeywordInUniqueConstraintDeclarationSQL()
+ protected function getQuotesReservedKeywordInUniqueConstraintDeclarationSQL() : string
{
return 'CONSTRAINT "select" UNIQUE (foo)';
}
@@ -675,7 +700,7 @@ protected function getQuotesReservedKeywordInUniqueConstraintDeclarationSQL()
/**
* {@inheritdoc}
*/
- protected function getQuotesReservedKeywordInIndexDeclarationSQL()
+ protected function getQuotesReservedKeywordInIndexDeclarationSQL() : string
{
return 'INDEX "select" (foo)';
}
@@ -683,7 +708,7 @@ protected function getQuotesReservedKeywordInIndexDeclarationSQL()
/**
* {@inheritdoc}
*/
- protected function getQuotesReservedKeywordInTruncateTableSQL()
+ protected function getQuotesReservedKeywordInTruncateTableSQL() : string
{
return 'DELETE FROM "select"';
}
@@ -691,7 +716,7 @@ protected function getQuotesReservedKeywordInTruncateTableSQL()
/**
* {@inheritdoc}
*/
- protected function getAlterStringToFixedStringSQL()
+ protected function getAlterStringToFixedStringSQL() : array
{
return [
'CREATE TEMPORARY TABLE __temp__mytable AS SELECT name FROM mytable',
@@ -705,7 +730,7 @@ protected function getAlterStringToFixedStringSQL()
/**
* {@inheritdoc}
*/
- protected function getGeneratesAlterTableRenameIndexUsedByForeignKeySQL()
+ protected function getGeneratesAlterTableRenameIndexUsedByForeignKeySQL() : array
{
return [
'DROP INDEX idx_foo',
@@ -723,7 +748,7 @@ protected function getGeneratesAlterTableRenameIndexUsedByForeignKeySQL()
/**
* @group DBAL-2436
*/
- public function testQuotesTableNameInListTableConstraintsSQL()
+ public function testQuotesTableNameInListTableConstraintsSQL() : void
{
self::assertStringContainsStringIgnoringCase(
"'Foo''Bar\\'",
@@ -734,7 +759,7 @@ public function testQuotesTableNameInListTableConstraintsSQL()
/**
* @group DBAL-2436
*/
- public function testQuotesTableNameInListTableColumnsSQL()
+ public function testQuotesTableNameInListTableColumnsSQL() : void
{
self::assertStringContainsStringIgnoringCase(
"'Foo''Bar\\'",
@@ -745,7 +770,7 @@ public function testQuotesTableNameInListTableColumnsSQL()
/**
* @group DBAL-2436
*/
- public function testQuotesTableNameInListTableIndexesSQL()
+ public function testQuotesTableNameInListTableIndexesSQL() : void
{
self::assertStringContainsStringIgnoringCase(
"'Foo''Bar\\'",
@@ -756,7 +781,7 @@ public function testQuotesTableNameInListTableIndexesSQL()
/**
* @group DBAL-2436
*/
- public function testQuotesTableNameInListTableForeignKeysSQL()
+ public function testQuotesTableNameInListTableForeignKeysSQL() : void
{
self::assertStringContainsStringIgnoringCase(
"'Foo''Bar\\'",
@@ -764,12 +789,12 @@ public function testQuotesTableNameInListTableForeignKeysSQL()
);
}
- public function testDateAddStaticNumberOfDays()
+ public function testDateAddStaticNumberOfDays() : void
{
self::assertSame("DATE(rentalBeginsOn,'+12 DAY')", $this->platform->getDateAddDaysExpression('rentalBeginsOn', 12));
}
- public function testDateAddNumberOfDaysFromColumn()
+ public function testDateAddNumberOfDaysFromColumn() : void
{
self::assertSame("DATE(rentalBeginsOn,'+' || duration || ' DAY')", $this->platform->getDateAddDaysExpression('rentalBeginsOn', 'duration'));
}
diff --git a/tests/Doctrine/Tests/DBAL/Portability/StatementTest.php b/tests/Doctrine/Tests/DBAL/Portability/StatementTest.php
index 4d0c066d618..c8e40214eb0 100644
--- a/tests/Doctrine/Tests/DBAL/Portability/StatementTest.php
+++ b/tests/Doctrine/Tests/DBAL/Portability/StatementTest.php
@@ -36,7 +36,7 @@ protected function setUp() : void
/**
* @group DBAL-726
*/
- public function testBindParam()
+ public function testBindParam() : void
{
$column = 'mycolumn';
$variable = 'myvalue';
@@ -51,7 +51,7 @@ public function testBindParam()
self::assertTrue($this->stmt->bindParam($column, $variable, $type, $length));
}
- public function testBindValue()
+ public function testBindValue() : void
{
$param = 'myparam';
$value = 'myvalue';
@@ -65,7 +65,7 @@ public function testBindValue()
self::assertTrue($this->stmt->bindValue($param, $value, $type));
}
- public function testCloseCursor()
+ public function testCloseCursor() : void
{
$this->wrappedStmt->expects($this->once())
->method('closeCursor')
@@ -74,7 +74,7 @@ public function testCloseCursor()
self::assertTrue($this->stmt->closeCursor());
}
- public function testColumnCount()
+ public function testColumnCount() : void
{
$columnCount = 666;
@@ -85,7 +85,7 @@ public function testColumnCount()
self::assertSame($columnCount, $this->stmt->columnCount());
}
- public function testErrorCode()
+ public function testErrorCode() : void
{
$errorCode = '666';
@@ -96,7 +96,7 @@ public function testErrorCode()
self::assertSame($errorCode, $this->stmt->errorCode());
}
- public function testErrorInfo()
+ public function testErrorInfo() : void
{
$errorInfo = ['666', 'Evil error.'];
@@ -107,7 +107,7 @@ public function testErrorInfo()
self::assertSame($errorInfo, $this->stmt->errorInfo());
}
- public function testExecute()
+ public function testExecute() : void
{
$params = [
'foo',
@@ -122,7 +122,7 @@ public function testExecute()
self::assertTrue($this->stmt->execute($params));
}
- public function testSetFetchMode()
+ public function testSetFetchMode() : void
{
$fetchMode = FetchMode::CUSTOM_OBJECT;
$arg1 = 'MyClass';
@@ -141,7 +141,7 @@ public function testSetFetchMode()
self::assertSame($fetchMode, $re->getValue($this->stmt));
}
- public function testGetIterator()
+ public function testGetIterator() : void
{
$this->wrappedStmt->expects($this->exactly(3))
->method('fetch')
@@ -150,7 +150,7 @@ public function testGetIterator()
self::assertSame(['foo', 'bar'], iterator_to_array($this->stmt->getIterator()));
}
- public function testRowCount()
+ public function testRowCount() : void
{
$rowCount = 666;
@@ -171,10 +171,7 @@ protected function createConnection()
->getMock();
}
- /**
- * @return Statement
- */
- protected function createStatement(DriverStatement $wrappedStatement, Connection $connection)
+ protected function createStatement(DriverStatement $wrappedStatement, Connection $connection) : Statement
{
return new Statement($wrappedStatement, $connection);
}
diff --git a/tests/Doctrine/Tests/DBAL/Query/Expression/CompositeExpressionTest.php b/tests/Doctrine/Tests/DBAL/Query/Expression/CompositeExpressionTest.php
index 512dfb08224..0a8492f795f 100644
--- a/tests/Doctrine/Tests/DBAL/Query/Expression/CompositeExpressionTest.php
+++ b/tests/Doctrine/Tests/DBAL/Query/Expression/CompositeExpressionTest.php
@@ -10,7 +10,7 @@
*/
class CompositeExpressionTest extends DbalTestCase
{
- public function testCount()
+ public function testCount() : void
{
$expr = new CompositeExpression(CompositeExpression::TYPE_OR, ['u.group_id = 1']);
@@ -21,7 +21,7 @@ public function testCount()
self::assertCount(2, $expr);
}
- public function testAdd()
+ public function testAdd() : void
{
$expr = new CompositeExpression(CompositeExpression::TYPE_OR, ['u.group_id = 1']);
@@ -45,16 +45,21 @@ public function testAdd()
}
/**
+ * @param string[]|CompositeExpression[] $parts
+ *
* @dataProvider provideDataForConvertToString
*/
- public function testCompositeUsageAndGeneration($type, $parts, $expects)
+ public function testCompositeUsageAndGeneration(string $type, array $parts, string $expects) : void
{
$expr = new CompositeExpression($type, $parts);
self::assertEquals($expects, (string) $expr);
}
- public function provideDataForConvertToString()
+ /**
+ * @return mixed[][]
+ */
+ public static function provideDataForConvertToString() : iterable
{
return [
[
diff --git a/tests/Doctrine/Tests/DBAL/Query/Expression/ExpressionBuilderTest.php b/tests/Doctrine/Tests/DBAL/Query/Expression/ExpressionBuilderTest.php
index d419f8d5fd4..817007d67d6 100644
--- a/tests/Doctrine/Tests/DBAL/Query/Expression/ExpressionBuilderTest.php
+++ b/tests/Doctrine/Tests/DBAL/Query/Expression/ExpressionBuilderTest.php
@@ -27,9 +27,11 @@ protected function setUp() : void
}
/**
+ * @param string[]|CompositeExpression[] $parts
+ *
* @dataProvider provideDataForAndX
*/
- public function testAndX($parts, $expected)
+ public function testAndX(array $parts, string $expected) : void
{
$composite = $this->expr->andX();
@@ -40,7 +42,10 @@ public function testAndX($parts, $expected)
self::assertEquals($expected, (string) $composite);
}
- public function provideDataForAndX()
+ /**
+ * @return mixed[][]
+ */
+ public static function provideDataForAndX() : iterable
{
return [
[
@@ -83,9 +88,11 @@ public function provideDataForAndX()
}
/**
+ * @param string[]|CompositeExpression[] $parts
+ *
* @dataProvider provideDataForOrX
*/
- public function testOrX($parts, $expected)
+ public function testOrX(array $parts, string $expected) : void
{
$composite = $this->expr->orX();
@@ -96,7 +103,10 @@ public function testOrX($parts, $expected)
self::assertEquals($expected, (string) $composite);
}
- public function provideDataForOrX()
+ /**
+ * @return mixed[][]
+ */
+ public static function provideDataForOrX() : iterable
{
return [
[
@@ -141,14 +151,17 @@ public function provideDataForOrX()
/**
* @dataProvider provideDataForComparison
*/
- public function testComparison($leftExpr, $operator, $rightExpr, $expected)
+ public function testComparison(string $leftExpr, string $operator, string $rightExpr, string $expected) : void
{
$part = $this->expr->comparison($leftExpr, $operator, $rightExpr);
self::assertEquals($expected, (string) $part);
}
- public function provideDataForComparison()
+ /**
+ * @return mixed[][]
+ */
+ public static function provideDataForComparison() : iterable
{
return [
['u.user_id', ExpressionBuilder::EQ, '1', 'u.user_id = 1'],
@@ -160,72 +173,72 @@ public function provideDataForComparison()
];
}
- public function testEq()
+ public function testEq() : void
{
self::assertEquals('u.user_id = 1', $this->expr->eq('u.user_id', '1'));
}
- public function testNeq()
+ public function testNeq() : void
{
self::assertEquals('u.user_id <> 1', $this->expr->neq('u.user_id', '1'));
}
- public function testLt()
+ public function testLt() : void
{
self::assertEquals('u.salary < 10000', $this->expr->lt('u.salary', '10000'));
}
- public function testLte()
+ public function testLte() : void
{
self::assertEquals('u.salary <= 10000', $this->expr->lte('u.salary', '10000'));
}
- public function testGt()
+ public function testGt() : void
{
self::assertEquals('u.salary > 10000', $this->expr->gt('u.salary', '10000'));
}
- public function testGte()
+ public function testGte() : void
{
self::assertEquals('u.salary >= 10000', $this->expr->gte('u.salary', '10000'));
}
- public function testIsNull()
+ public function testIsNull() : void
{
self::assertEquals('u.deleted IS NULL', $this->expr->isNull('u.deleted'));
}
- public function testIsNotNull()
+ public function testIsNotNull() : void
{
self::assertEquals('u.updated IS NOT NULL', $this->expr->isNotNull('u.updated'));
}
- public function testIn()
+ public function testIn() : void
{
self::assertEquals('u.groups IN (1, 3, 4, 7)', $this->expr->in('u.groups', [1, 3, 4, 7]));
}
- public function testInWithPlaceholder()
+ public function testInWithPlaceholder() : void
{
self::assertEquals('u.groups IN (?)', $this->expr->in('u.groups', '?'));
}
- public function testNotIn()
+ public function testNotIn() : void
{
self::assertEquals('u.groups NOT IN (1, 3, 4, 7)', $this->expr->notIn('u.groups', [1, 3, 4, 7]));
}
- public function testNotInWithPlaceholder()
+ public function testNotInWithPlaceholder() : void
{
self::assertEquals('u.groups NOT IN (:values)', $this->expr->notIn('u.groups', ':values'));
}
- public function testLikeWithoutEscape()
+ public function testLikeWithoutEscape() : void
{
self::assertEquals("a.song LIKE 'a virgin'", $this->expr->like('a.song', "'a virgin'"));
}
- public function testLikeWithEscape()
+ public function testLikeWithEscape() : void
{
self::assertEquals(
"a.song LIKE 'a virgin' ESCAPE '💩'",
@@ -233,7 +246,7 @@ public function testLikeWithEscape()
);
}
- public function testNotLikeWithoutEscape()
+ public function testNotLikeWithoutEscape() : void
{
self::assertEquals(
"s.last_words NOT LIKE 'this'",
@@ -241,7 +254,7 @@ public function testNotLikeWithoutEscape()
);
}
- public function testNotLikeWithEscape()
+ public function testNotLikeWithEscape() : void
{
self::assertEquals(
"p.description NOT LIKE '20💩%' ESCAPE '💩'",
diff --git a/tests/Doctrine/Tests/DBAL/Query/QueryBuilderTest.php b/tests/Doctrine/Tests/DBAL/Query/QueryBuilderTest.php
index b6d4d090374..610abc319a9 100644
--- a/tests/Doctrine/Tests/DBAL/Query/QueryBuilderTest.php
+++ b/tests/Doctrine/Tests/DBAL/Query/QueryBuilderTest.php
@@ -31,7 +31,7 @@ protected function setUp() : void
/**
* @group DBAL-2291
*/
- public function testSimpleSelectWithoutFrom()
+ public function testSimpleSelectWithoutFrom() : void
{
$qb = new QueryBuilder($this->conn);
@@ -40,7 +40,7 @@ public function testSimpleSelectWithoutFrom()
self::assertEquals('SELECT some_function()', (string) $qb);
}
- public function testSimpleSelect()
+ public function testSimpleSelect() : void
{
$qb = new QueryBuilder($this->conn);
@@ -50,7 +50,7 @@ public function testSimpleSelect()
self::assertEquals('SELECT u.id FROM users u', (string) $qb);
}
- public function testSelectWithSimpleWhere()
+ public function testSelectWithSimpleWhere() : void
{
$qb = new QueryBuilder($this->conn);
$expr = $qb->expr();
@@ -62,7 +62,7 @@ public function testSelectWithSimpleWhere()
self::assertEquals('SELECT u.id FROM users u WHERE u.nickname = ?', (string) $qb);
}
- public function testSelectWithLeftJoin()
+ public function testSelectWithLeftJoin() : void
{
$qb = new QueryBuilder($this->conn);
$expr = $qb->expr();
@@ -74,7 +74,7 @@ public function testSelectWithLeftJoin()
self::assertEquals('SELECT u.*, p.* FROM users u LEFT JOIN phones p ON p.user_id = u.id', (string) $qb);
}
- public function testSelectWithJoin()
+ public function testSelectWithJoin() : void
{
$qb = new QueryBuilder($this->conn);
$expr = $qb->expr();
@@ -86,7 +86,7 @@ public function testSelectWithJoin()
self::assertEquals('SELECT u.*, p.* FROM users u INNER JOIN phones p ON p.user_id = u.id', (string) $qb);
}
- public function testSelectWithInnerJoin()
+ public function testSelectWithInnerJoin() : void
{
$qb = new QueryBuilder($this->conn);
$expr = $qb->expr();
@@ -98,7 +98,7 @@ public function testSelectWithInnerJoin()
self::assertEquals('SELECT u.*, p.* FROM users u INNER JOIN phones p ON p.user_id = u.id', (string) $qb);
}
- public function testSelectWithRightJoin()
+ public function testSelectWithRightJoin() : void
{
$qb = new QueryBuilder($this->conn);
$expr = $qb->expr();
@@ -110,7 +110,7 @@ public function testSelectWithRightJoin()
self::assertEquals('SELECT u.*, p.* FROM users u RIGHT JOIN phones p ON p.user_id = u.id', (string) $qb);
}
- public function testSelectWithAndWhereConditions()
+ public function testSelectWithAndWhereConditions() : void
{
$qb = new QueryBuilder($this->conn);
$expr = $qb->expr();
@@ -123,7 +123,7 @@ public function testSelectWithAndWhereConditions()
self::assertEquals('SELECT u.*, p.* FROM users u WHERE (u.username = ?) AND (u.name = ?)', (string) $qb);
}
- public function testSelectWithOrWhereConditions()
+ public function testSelectWithOrWhereConditions() : void
{
$qb = new QueryBuilder($this->conn);
$expr = $qb->expr();
@@ -136,7 +136,7 @@ public function testSelectWithOrWhereConditions()
self::assertEquals('SELECT u.*, p.* FROM users u WHERE (u.username = ?) OR (u.name = ?)', (string) $qb);
}
- public function testSelectWithOrOrWhereConditions()
+ public function testSelectWithOrOrWhereConditions() : void
{
$qb = new QueryBuilder($this->conn);
$expr = $qb->expr();
@@ -149,7 +149,7 @@ public function testSelectWithOrOrWhereConditions()
self::assertEquals('SELECT u.*, p.* FROM users u WHERE (u.username = ?) OR (u.name = ?)', (string) $qb);
}
- public function testSelectWithAndOrWhereConditions()
+ public function testSelectWithAndOrWhereConditions() : void
{
$qb = new QueryBuilder($this->conn);
$expr = $qb->expr();
@@ -164,7 +164,7 @@ public function testSelectWithAndOrWhereConditions()
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()
+ public function testSelectGroupBy() : void
{
$qb = new QueryBuilder($this->conn);
$expr = $qb->expr();
@@ -176,7 +176,7 @@ public function testSelectGroupBy()
self::assertEquals('SELECT u.*, p.* FROM users u GROUP BY u.id', (string) $qb);
}
- public function testSelectEmptyGroupBy()
+ public function testSelectEmptyGroupBy() : void
{
$qb = new QueryBuilder($this->conn);
$expr = $qb->expr();
@@ -188,7 +188,7 @@ public function testSelectEmptyGroupBy()
self::assertEquals('SELECT u.*, p.* FROM users u', (string) $qb);
}
- public function testSelectEmptyAddGroupBy()
+ public function testSelectEmptyAddGroupBy() : void
{
$qb = new QueryBuilder($this->conn);
$expr = $qb->expr();
@@ -200,7 +200,7 @@ public function testSelectEmptyAddGroupBy()
self::assertEquals('SELECT u.*, p.* FROM users u', (string) $qb);
}
- public function testSelectAddGroupBy()
+ public function testSelectAddGroupBy() : void
{
$qb = new QueryBuilder($this->conn);
$expr = $qb->expr();
@@ -213,7 +213,7 @@ public function testSelectAddGroupBy()
self::assertEquals('SELECT u.*, p.* FROM users u GROUP BY u.id, u.foo', (string) $qb);
}
- public function testSelectAddGroupBys()
+ public function testSelectAddGroupBys() : void
{
$qb = new QueryBuilder($this->conn);
$expr = $qb->expr();
@@ -226,7 +226,7 @@ public function testSelectAddGroupBys()
self::assertEquals('SELECT u.*, p.* FROM users u GROUP BY u.id, u.foo, u.bar', (string) $qb);
}
- public function testSelectHaving()
+ public function testSelectHaving() : void
{
$qb = new QueryBuilder($this->conn);
$expr = $qb->expr();
@@ -239,7 +239,7 @@ public function testSelectHaving()
self::assertEquals('SELECT u.*, p.* FROM users u GROUP BY u.id HAVING u.name = ?', (string) $qb);
}
- public function testSelectAndHaving()
+ public function testSelectAndHaving() : void
{
$qb = new QueryBuilder($this->conn);
$expr = $qb->expr();
@@ -252,7 +252,7 @@ public function testSelectAndHaving()
self::assertEquals('SELECT u.*, p.* FROM users u GROUP BY u.id HAVING u.name = ?', (string) $qb);
}
- public function testSelectHavingAndHaving()
+ public function testSelectHavingAndHaving() : void
{
$qb = new QueryBuilder($this->conn);
$expr = $qb->expr();
@@ -266,7 +266,7 @@ public function testSelectHavingAndHaving()
self::assertEquals('SELECT u.*, p.* FROM users u GROUP BY u.id HAVING (u.name = ?) AND (u.username = ?)', (string) $qb);
}
- public function testSelectHavingOrHaving()
+ public function testSelectHavingOrHaving() : void
{
$qb = new QueryBuilder($this->conn);
$expr = $qb->expr();
@@ -280,7 +280,7 @@ public function testSelectHavingOrHaving()
self::assertEquals('SELECT u.*, p.* FROM users u GROUP BY u.id HAVING (u.name = ?) OR (u.username = ?)', (string) $qb);
}
- public function testSelectOrHavingOrHaving()
+ public function testSelectOrHavingOrHaving() : void
{
$qb = new QueryBuilder($this->conn);
$expr = $qb->expr();
@@ -294,7 +294,7 @@ public function testSelectOrHavingOrHaving()
self::assertEquals('SELECT u.*, p.* FROM users u GROUP BY u.id HAVING (u.name = ?) OR (u.username = ?)', (string) $qb);
}
- public function testSelectHavingAndOrHaving()
+ public function testSelectHavingAndOrHaving() : void
{
$qb = new QueryBuilder($this->conn);
$expr = $qb->expr();
@@ -309,7 +309,7 @@ public function testSelectHavingAndOrHaving()
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()
+ public function testSelectOrderBy() : void
{
$qb = new QueryBuilder($this->conn);
$expr = $qb->expr();
@@ -321,7 +321,7 @@ public function testSelectOrderBy()
self::assertEquals('SELECT u.*, p.* FROM users u ORDER BY u.name ASC', (string) $qb);
}
- public function testSelectAddOrderBy()
+ public function testSelectAddOrderBy() : void
{
$qb = new QueryBuilder($this->conn);
$expr = $qb->expr();
@@ -334,7 +334,7 @@ public function testSelectAddOrderBy()
self::assertEquals('SELECT u.*, p.* FROM users u ORDER BY u.name ASC, u.username DESC', (string) $qb);
}
- public function testSelectAddAddOrderBy()
+ public function testSelectAddAddOrderBy() : void
{
$qb = new QueryBuilder($this->conn);
$expr = $qb->expr();
@@ -347,7 +347,7 @@ public function testSelectAddAddOrderBy()
self::assertEquals('SELECT u.*, p.* FROM users u ORDER BY u.name ASC, u.username DESC', (string) $qb);
}
- public function testEmptySelect()
+ public function testEmptySelect() : void
{
$qb = new QueryBuilder($this->conn);
$qb2 = $qb->select();
@@ -356,7 +356,7 @@ public function testEmptySelect()
self::assertEquals(QueryBuilder::SELECT, $qb->getType());
}
- public function testSelectAddSelect()
+ public function testSelectAddSelect() : void
{
$qb = new QueryBuilder($this->conn);
$expr = $qb->expr();
@@ -368,7 +368,7 @@ public function testSelectAddSelect()
self::assertEquals('SELECT u.*, p.* FROM users u', (string) $qb);
}
- public function testEmptyAddSelect()
+ public function testEmptyAddSelect() : void
{
$qb = new QueryBuilder($this->conn);
$qb2 = $qb->addSelect();
@@ -377,7 +377,7 @@ public function testEmptyAddSelect()
self::assertEquals(QueryBuilder::SELECT, $qb->getType());
}
- public function testSelectMultipleFrom()
+ public function testSelectMultipleFrom() : void
{
$qb = new QueryBuilder($this->conn);
$expr = $qb->expr();
@@ -390,7 +390,7 @@ public function testSelectMultipleFrom()
self::assertEquals('SELECT u.*, p.* FROM users u, phonenumbers p', (string) $qb);
}
- public function testUpdate()
+ public function testUpdate() : void
{
$qb = new QueryBuilder($this->conn);
$qb->update('users', 'u')
@@ -401,7 +401,7 @@ public function testUpdate()
self::assertEquals('UPDATE users u SET u.foo = ?, u.bar = ?', (string) $qb);
}
- public function testUpdateWithoutAlias()
+ public function testUpdateWithoutAlias() : void
{
$qb = new QueryBuilder($this->conn);
$qb->update('users')
@@ -411,7 +411,7 @@ public function testUpdateWithoutAlias()
self::assertEquals('UPDATE users SET foo = ?, bar = ?', (string) $qb);
}
- public function testUpdateWhere()
+ public function testUpdateWhere() : void
{
$qb = new QueryBuilder($this->conn);
$qb->update('users', 'u')
@@ -421,7 +421,7 @@ public function testUpdateWhere()
self::assertEquals('UPDATE users u SET u.foo = ? WHERE u.foo = ?', (string) $qb);
}
- public function testEmptyUpdate()
+ public function testEmptyUpdate() : void
{
$qb = new QueryBuilder($this->conn);
$qb2 = $qb->update();
@@ -430,7 +430,7 @@ public function testEmptyUpdate()
self::assertSame($qb2, $qb);
}
- public function testDelete()
+ public function testDelete() : void
{
$qb = new QueryBuilder($this->conn);
$qb->delete('users', 'u');
@@ -439,7 +439,7 @@ public function testDelete()
self::assertEquals('DELETE FROM users u', (string) $qb);
}
- public function testDeleteWithoutAlias()
+ public function testDeleteWithoutAlias() : void
{
$qb = new QueryBuilder($this->conn);
$qb->delete('users');
@@ -448,7 +448,7 @@ public function testDeleteWithoutAlias()
self::assertEquals('DELETE FROM users', (string) $qb);
}
- public function testDeleteWhere()
+ public function testDeleteWhere() : void
{
$qb = new QueryBuilder($this->conn);
$qb->delete('users', 'u')
@@ -457,7 +457,7 @@ public function testDeleteWhere()
self::assertEquals('DELETE FROM users u WHERE u.foo = ?', (string) $qb);
}
- public function testEmptyDelete()
+ public function testEmptyDelete() : void
{
$qb = new QueryBuilder($this->conn);
$qb2 = $qb->delete();
@@ -466,7 +466,7 @@ public function testEmptyDelete()
self::assertSame($qb2, $qb);
}
- public function testInsertValues()
+ public function testInsertValues() : void
{
$qb = new QueryBuilder($this->conn);
$qb->insert('users')
@@ -481,7 +481,7 @@ public function testInsertValues()
self::assertEquals('INSERT INTO users (foo, bar) VALUES(?, ?)', (string) $qb);
}
- public function testInsertReplaceValues()
+ public function testInsertReplaceValues() : void
{
$qb = new QueryBuilder($this->conn);
$qb->insert('users')
@@ -502,7 +502,7 @@ public function testInsertReplaceValues()
self::assertEquals('INSERT INTO users (bar, foo) VALUES(?, ?)', (string) $qb);
}
- public function testInsertSetValue()
+ public function testInsertSetValue() : void
{
$qb = new QueryBuilder($this->conn);
$qb->insert('users')
@@ -514,7 +514,7 @@ public function testInsertSetValue()
self::assertEquals('INSERT INTO users (foo, bar) VALUES(?, ?)', (string) $qb);
}
- public function testInsertValuesSetValue()
+ public function testInsertValuesSetValue() : void
{
$qb = new QueryBuilder($this->conn);
$qb->insert('users')
@@ -527,7 +527,7 @@ public function testInsertValuesSetValue()
self::assertEquals('INSERT INTO users (foo, bar) VALUES(?, ?)', (string) $qb);
}
- public function testEmptyInsert()
+ public function testEmptyInsert() : void
{
$qb = new QueryBuilder($this->conn);
$qb2 = $qb->insert();
@@ -536,13 +536,13 @@ public function testEmptyInsert()
self::assertSame($qb2, $qb);
}
- public function testGetConnection()
+ public function testGetConnection() : void
{
$qb = new QueryBuilder($this->conn);
self::assertSame($this->conn, $qb->getConnection());
}
- public function testGetState()
+ public function testGetState() : void
{
$qb = new QueryBuilder($this->conn);
@@ -558,7 +558,7 @@ public function testGetState()
self::assertEquals($sql1, $qb->getSQL());
}
- public function testSetMaxResults()
+ public function testSetMaxResults() : void
{
$qb = new QueryBuilder($this->conn);
$qb->setMaxResults(10);
@@ -567,7 +567,7 @@ public function testSetMaxResults()
self::assertEquals(10, $qb->getMaxResults());
}
- public function testSetFirstResult()
+ public function testSetFirstResult() : void
{
$qb = new QueryBuilder($this->conn);
$qb->setFirstResult(10);
@@ -576,7 +576,7 @@ public function testSetFirstResult()
self::assertEquals(10, $qb->getFirstResult());
}
- public function testResetQueryPart()
+ public function testResetQueryPart() : void
{
$qb = new QueryBuilder($this->conn);
@@ -587,7 +587,7 @@ public function testResetQueryPart()
self::assertEquals('SELECT u.* FROM users u', (string) $qb);
}
- public function testResetQueryParts()
+ public function testResetQueryParts() : void
{
$qb = new QueryBuilder($this->conn);
@@ -598,7 +598,7 @@ public function testResetQueryParts()
self::assertEquals('SELECT u.* FROM users u', (string) $qb);
}
- public function testCreateNamedParameter()
+ public function testCreateNamedParameter() : void
{
$qb = new QueryBuilder($this->conn);
@@ -611,7 +611,7 @@ public function testCreateNamedParameter()
self::assertEquals(ParameterType::INTEGER, $qb->getParameterType('dcValue1'));
}
- public function testCreateNamedParameterCustomPlaceholder()
+ public function testCreateNamedParameterCustomPlaceholder() : void
{
$qb = new QueryBuilder($this->conn);
@@ -624,7 +624,7 @@ public function testCreateNamedParameterCustomPlaceholder()
self::assertEquals(ParameterType::INTEGER, $qb->getParameterType('test'));
}
- public function testCreatePositionalParameter()
+ public function testCreatePositionalParameter() : void
{
$qb = new QueryBuilder($this->conn);
@@ -640,7 +640,7 @@ public function testCreatePositionalParameter()
/**
* @group DBAL-172
*/
- public function testReferenceJoinFromJoin()
+ public function testReferenceJoinFromJoin() : void
{
$qb = new QueryBuilder($this->conn);
@@ -659,7 +659,7 @@ public function testReferenceJoinFromJoin()
/**
* @group DBAL-172
*/
- public function testSelectFromMasterWithWhereOnJoinedTables()
+ public function testSelectFromMasterWithWhereOnJoinedTables() : void
{
$qb = new QueryBuilder($this->conn);
@@ -677,7 +677,7 @@ public function testSelectFromMasterWithWhereOnJoinedTables()
/**
* @group DBAL-442
*/
- public function testSelectWithMultipleFromAndJoins()
+ public function testSelectWithMultipleFromAndJoins() : void
{
$qb = new QueryBuilder($this->conn);
@@ -695,7 +695,7 @@ public function testSelectWithMultipleFromAndJoins()
/**
* @group DBAL-774
*/
- public function testSelectWithJoinsWithMultipleOnConditionsParseOrder()
+ public function testSelectWithJoinsWithMultipleOnConditionsParseOrder() : void
{
$qb = new QueryBuilder($this->conn);
@@ -720,7 +720,7 @@ public function testSelectWithJoinsWithMultipleOnConditionsParseOrder()
/**
* @group DBAL-774
*/
- public function testSelectWithMultipleFromsAndJoinsWithMultipleOnConditionsParseOrder()
+ public function testSelectWithMultipleFromsAndJoinsWithMultipleOnConditionsParseOrder() : void
{
$qb = new QueryBuilder($this->conn);
@@ -746,7 +746,7 @@ public function testSelectWithMultipleFromsAndJoinsWithMultipleOnConditionsParse
);
}
- public function testClone()
+ public function testClone() : void
{
$qb = new QueryBuilder($this->conn);
@@ -766,7 +766,7 @@ public function testClone()
self::assertNotSame($qb->getParameters(), $qb_clone->getParameters());
}
- public function testSimpleSelectWithoutTableAlias()
+ public function testSimpleSelectWithoutTableAlias() : void
{
$qb = new QueryBuilder($this->conn);
@@ -776,7 +776,7 @@ public function testSimpleSelectWithoutTableAlias()
self::assertEquals('SELECT id FROM users', (string) $qb);
}
- public function testSelectWithSimpleWhereWithoutTableAlias()
+ public function testSelectWithSimpleWhereWithoutTableAlias() : void
{
$qb = new QueryBuilder($this->conn);
@@ -787,7 +787,7 @@ public function testSelectWithSimpleWhereWithoutTableAlias()
self::assertEquals('SELECT id, name FROM users WHERE awesome=9001', (string) $qb);
}
- public function testComplexSelectWithoutTableAliases()
+ public function testComplexSelectWithoutTableAliases() : void
{
$qb = new QueryBuilder($this->conn);
@@ -802,7 +802,7 @@ public function testComplexSelectWithoutTableAliases()
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()
+ public function testComplexSelectWithSomeTableAliases() : void
{
$qb = new QueryBuilder($this->conn);
@@ -815,7 +815,7 @@ public function testComplexSelectWithSomeTableAliases()
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()
+ public function testSelectAllFromTableWithoutTableAlias() : void
{
$qb = new QueryBuilder($this->conn);
@@ -825,7 +825,7 @@ public function testSelectAllFromTableWithoutTableAlias()
self::assertEquals('SELECT users.* FROM users', (string) $qb);
}
- public function testSelectAllWithoutTableAlias()
+ public function testSelectAllWithoutTableAlias() : void
{
$qb = new QueryBuilder($this->conn);
@@ -838,7 +838,7 @@ public function testSelectAllWithoutTableAlias()
/**
* @group DBAL-959
*/
- public function testGetParameterType()
+ public function testGetParameterType() : void
{
$qb = new QueryBuilder($this->conn);
@@ -859,7 +859,7 @@ public function testGetParameterType()
/**
* @group DBAL-959
*/
- public function testGetParameterTypes()
+ public function testGetParameterTypes() : void
{
$qb = new QueryBuilder($this->conn);
@@ -886,7 +886,7 @@ public function testGetParameterTypes()
/**
* @group DBAL-1137
*/
- public function testJoinWithNonUniqueAliasThrowsException()
+ public function testJoinWithNonUniqueAliasThrowsException() : void
{
$qb = new QueryBuilder($this->conn);
diff --git a/tests/Doctrine/Tests/DBAL/SQLParserUtilsTest.php b/tests/Doctrine/Tests/DBAL/SQLParserUtilsTest.php
index 414f909f870..ea8d4dc0752 100644
--- a/tests/Doctrine/Tests/DBAL/SQLParserUtilsTest.php
+++ b/tests/Doctrine/Tests/DBAL/SQLParserUtilsTest.php
@@ -14,7 +14,10 @@
*/
class SQLParserUtilsTest extends DbalTestCase
{
- public function dataGetPlaceholderPositions()
+ /**
+ * @return mixed[][]
+ */
+ public static function dataGetPlaceholderPositions() : iterable
{
return [
// none
@@ -91,15 +94,20 @@ public function dataGetPlaceholderPositions()
}
/**
+ * @param int[] $expectedParamPos
+ *
* @dataProvider dataGetPlaceholderPositions
*/
- public function testGetPlaceholderPositions($query, $isPositional, $expectedParamPos)
+ public function testGetPlaceholderPositions(string $query, bool $isPositional, array $expectedParamPos) : void
{
$actualParamPos = SQLParserUtils::getPlaceholderPositions($query, $isPositional);
self::assertEquals($expectedParamPos, $actualParamPos);
}
- public function dataExpandListParameters()
+ /**
+ * @return mixed[][]
+ */
+ public static function dataExpandListParameters() : iterable
{
return [
// Positional: Very simple with one needle
@@ -413,18 +421,32 @@ public function dataExpandListParameters()
}
/**
+ * @param mixed[] $params
+ * @param mixed[] $types
+ * @param mixed[] $expectedParams
+ * @param mixed[] $expectedTypes
+ *
* @dataProvider dataExpandListParameters
*/
- public function testExpandListParameters($q, $p, $t, $expectedQuery, $expectedParams, $expectedTypes)
- {
- [$query, $params, $types] = SQLParserUtils::expandListParameters($q, $p, $t);
+ public function testExpandListParameters(
+ string $query,
+ array $params,
+ array $types,
+ string $expectedQuery,
+ array $expectedParams,
+ array $expectedTypes
+ ) : void {
+ [$query, $params, $types] = SQLParserUtils::expandListParameters($query, $params, $types);
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()
+ /**
+ * @return mixed[][]
+ */
+ public static function dataQueryWithMissingParameters() : iterable
{
return [
[
@@ -461,9 +483,12 @@ public function dataQueryWithMissingParameters()
}
/**
+ * @param mixed[] $params
+ * @param mixed[] $types
+ *
* @dataProvider dataQueryWithMissingParameters
*/
- public function testExceptionIsThrownForMissingParam($query, $params, $types = [])
+ public function testExceptionIsThrownForMissingParam(string $query, array $params, array $types = []) : void
{
$this->expectException(SQLParserUtilsException::class);
$this->expectExceptionMessage('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 099fb788b55..0bdaa85ef6d 100644
--- a/tests/Doctrine/Tests/DBAL/Schema/ColumnDiffTest.php
+++ b/tests/Doctrine/Tests/DBAL/Schema/ColumnDiffTest.php
@@ -13,7 +13,7 @@ class ColumnDiffTest extends TestCase
/**
* @group DBAL-1255
*/
- public function testPreservesOldColumnNameQuotation()
+ public function testPreservesOldColumnNameQuotation() : void
{
$fromColumn = new Column('"foo"', Type::getType(Types::INTEGER));
$toColumn = new Column('bar', Type::getType(Types::INTEGER));
diff --git a/tests/Doctrine/Tests/DBAL/Schema/ColumnTest.php b/tests/Doctrine/Tests/DBAL/Schema/ColumnTest.php
index 150e5263f93..0997ce26319 100644
--- a/tests/Doctrine/Tests/DBAL/Schema/ColumnTest.php
+++ b/tests/Doctrine/Tests/DBAL/Schema/ColumnTest.php
@@ -12,7 +12,7 @@
class ColumnTest extends TestCase
{
- public function testGet()
+ public function testGet() : void
{
$column = $this->createColumn();
@@ -38,7 +38,7 @@ public function testGet()
self::assertFalse($column->hasCustomSchemaOption('foo'));
}
- public function testToArray()
+ public function testToArray() : void
{
$expected = [
'name' => 'foo',
@@ -82,10 +82,7 @@ public function testOptionsShouldNotBeIgnored() : void
self::assertFalse($col2->getNotnull());
}
- /**
- * @return Column
- */
- public function createColumn()
+ public function createColumn() : Column
{
$options = [
'length' => 200,
@@ -108,7 +105,7 @@ public function createColumn()
* @group DBAL-64
* @group DBAL-830
*/
- public function testQuotedColumnName()
+ public function testQuotedColumnName() : void
{
$string = Type::getType('string');
$column = new Column('`bar`', $string, []);
@@ -132,7 +129,7 @@ public function testQuotedColumnName()
* @dataProvider getIsQuoted
* @group DBAL-830
*/
- public function testIsQuoted($columnName, $isQuoted)
+ public function testIsQuoted(string $columnName, bool $isQuoted) : void
{
$type = Type::getType('string');
$column = new Column($columnName, $type);
@@ -140,7 +137,10 @@ public function testIsQuoted($columnName, $isQuoted)
self::assertSame($isQuoted, $column->isQuoted());
}
- public function getIsQuoted()
+ /**
+ * @return mixed[][]
+ */
+ public static function getIsQuoted() : iterable
{
return [
['bar', false],
@@ -153,7 +153,7 @@ public function getIsQuoted()
/**
* @group DBAL-42
*/
- public function testColumnComment()
+ public function testColumnComment() : void
{
$column = new Column('bar', Type::getType('string'));
self::assertNull($column->getComment());
diff --git a/tests/Doctrine/Tests/DBAL/Schema/ComparatorTest.php b/tests/Doctrine/Tests/DBAL/Schema/ComparatorTest.php
index 5222a1ee548..a98f477ac4c 100644
--- a/tests/Doctrine/Tests/DBAL/Schema/ComparatorTest.php
+++ b/tests/Doctrine/Tests/DBAL/Schema/ComparatorTest.php
@@ -19,7 +19,7 @@
class ComparatorTest extends TestCase
{
- public function testCompareSame1()
+ public function testCompareSame1() : void
{
$schema1 = new Schema([
'bugdb' => new Table(
@@ -43,7 +43,7 @@ public function testCompareSame1()
self::assertEquals($expected, Comparator::compareSchemas($schema1, $schema2));
}
- public function testCompareSame2()
+ public function testCompareSame2() : void
{
$schema1 = new Schema([
'bugdb' => new Table(
@@ -69,7 +69,7 @@ public function testCompareSame2()
self::assertEquals($expected, Comparator::compareSchemas($schema1, $schema2));
}
- public function testCompareMissingTable()
+ public function testCompareMissingTable() : void
{
$schemaConfig = new SchemaConfig();
$table = new Table('bugdb', ['integerfield1' => new Column('integerfield1', Type::getType('integer'))]);
@@ -83,7 +83,7 @@ public function testCompareMissingTable()
self::assertEquals($expected, Comparator::compareSchemas($schema1, $schema2));
}
- public function testCompareNewTable()
+ public function testCompareNewTable() : void
{
$schemaConfig = new SchemaConfig();
$table = new Table('bugdb', ['integerfield1' => new Column('integerfield1', Type::getType('integer'))]);
@@ -97,7 +97,7 @@ public function testCompareNewTable()
self::assertEquals($expected, Comparator::compareSchemas($schema1, $schema2));
}
- public function testCompareOnlyAutoincrementChanged()
+ public function testCompareOnlyAutoincrementChanged() : void
{
$column1 = new Column('foo', Type::getType('integer'), ['autoincrement' => true]);
$column2 = new Column('foo', Type::getType('integer'), ['autoincrement' => false]);
@@ -108,7 +108,7 @@ public function testCompareOnlyAutoincrementChanged()
self::assertEquals(['autoincrement'], $changedProperties);
}
- public function testCompareMissingField()
+ public function testCompareMissingField() : void
{
$missingColumn = new Column('integerfield1', Type::getType('integer'));
$schema1 = new Schema([
@@ -146,7 +146,7 @@ public function testCompareMissingField()
self::assertEquals($expected, Comparator::compareSchemas($schema1, $schema2));
}
- public function testCompareNewField()
+ public function testCompareNewField() : void
{
$schema1 = new Schema([
'bugdb' => new Table(
@@ -183,7 +183,7 @@ public function testCompareNewField()
self::assertEquals($expected, Comparator::compareSchemas($schema1, $schema2));
}
- public function testCompareChangedColumnsChangeType()
+ public function testCompareChangedColumnsChangeType() : void
{
$column1 = new Column('charfield1', Type::getType('string'));
$column2 = new Column('charfield1', Type::getType('integer'));
@@ -193,7 +193,7 @@ public function testCompareChangedColumnsChangeType()
self::assertEquals([], $c->diffColumn($column1, $column1));
}
- public function testCompareChangedColumnsChangeCustomSchemaOption()
+ public function testCompareChangedColumnsChangeCustomSchemaOption() : void
{
$column1 = new Column('charfield1', Type::getType('string'));
$column2 = new Column('charfield1', Type::getType('string'));
@@ -209,7 +209,7 @@ public function testCompareChangedColumnsChangeCustomSchemaOption()
self::assertEquals([], $c->diffColumn($column1, $column1));
}
- public function testCompareChangeColumnsMultipleNewColumnsRename()
+ public function testCompareChangeColumnsMultipleNewColumnsRename() : void
{
$tableA = new Table('foo');
$tableA->addColumn('datefield1', 'datetime');
@@ -229,7 +229,7 @@ public function testCompareChangeColumnsMultipleNewColumnsRename()
self::assertCount(0, $tableDiff->changedColumns, 'Nothing should be changed as all fields old & new have diff names.');
}
- public function testCompareRemovedIndex()
+ public function testCompareRemovedIndex() : void
{
$schema1 = new Schema([
'bugdb' => new Table(
@@ -283,7 +283,7 @@ public function testCompareRemovedIndex()
self::assertEquals($expected, Comparator::compareSchemas($schema1, $schema2));
}
- public function testCompareNewIndex()
+ public function testCompareNewIndex() : void
{
$schema1 = new Schema([
'bugdb' => new Table(
@@ -335,7 +335,7 @@ public function testCompareNewIndex()
self::assertEquals($expected, Comparator::compareSchemas($schema1, $schema2));
}
- public function testCompareChangedIndex()
+ public function testCompareChangedIndex() : void
{
$schema1 = new Schema([
'bugdb' => new Table(
@@ -398,7 +398,7 @@ public function testCompareChangedIndex()
self::assertEquals($expected, Comparator::compareSchemas($schema1, $schema2));
}
- public function testCompareChangedIndexFieldPositions()
+ public function testCompareChangedIndexFieldPositions() : void
{
$schema1 = new Schema([
'bugdb' => new Table(
@@ -446,7 +446,7 @@ public function testCompareChangedIndexFieldPositions()
self::assertEquals($expected, Comparator::compareSchemas($schema1, $schema2));
}
- public function testCompareSequences()
+ public function testCompareSequences() : void
{
$seq1 = new Sequence('foo', 1, 1);
$seq2 = new Sequence('foo', 1, 2);
@@ -460,7 +460,7 @@ public function testCompareSequences()
self::assertFalse($c->diffSequence($seq1, $seq4));
}
- public function testRemovedSequence()
+ public function testRemovedSequence() : void
{
$schema1 = new Schema();
$seq = $schema1->createSequence('foo');
@@ -474,7 +474,7 @@ public function testRemovedSequence()
self::assertSame($seq, $diffSchema->removedSequences[0]);
}
- public function testAddedSequence()
+ public function testAddedSequence() : void
{
$schema1 = new Schema();
@@ -488,7 +488,7 @@ public function testAddedSequence()
self::assertSame($seq, $diffSchema->newSequences[0]);
}
- public function testTableAddForeignKey()
+ public function testTableAddForeignKey() : void
{
$tableForeign = new Table('bar');
$tableForeign->addColumn('id', 'integer');
@@ -507,7 +507,7 @@ public function testTableAddForeignKey()
self::assertCount(1, $tableDiff->addedForeignKeys);
}
- public function testTableRemoveForeignKey()
+ public function testTableRemoveForeignKey() : void
{
$tableForeign = new Table('bar');
$tableForeign->addColumn('id', 'integer');
@@ -526,7 +526,7 @@ public function testTableRemoveForeignKey()
self::assertCount(1, $tableDiff->removedForeignKeys);
}
- public function testTableUpdateForeignKey()
+ public function testTableUpdateForeignKey() : void
{
$tableForeign = new Table('bar');
$tableForeign->addColumn('id', 'integer');
@@ -546,7 +546,7 @@ public function testTableUpdateForeignKey()
self::assertCount(1, $tableDiff->changedForeignKeys);
}
- public function testMovedForeignKeyForeignTable()
+ public function testMovedForeignKeyForeignTable() : void
{
$tableForeign = new Table('bar');
$tableForeign->addColumn('id', 'integer');
@@ -569,7 +569,7 @@ public function testMovedForeignKeyForeignTable()
self::assertCount(1, $tableDiff->changedForeignKeys);
}
- public function testTablesCaseInsensitive()
+ public function testTablesCaseInsensitive() : void
{
$schemaA = new Schema();
$schemaA->createTable('foo');
@@ -589,7 +589,7 @@ public function testTablesCaseInsensitive()
self::assertSchemaTableChangeCount($diff, 1, 0, 1);
}
- public function testSequencesCaseInsensitive()
+ public function testSequencesCaseInsensitive() : void
{
$schemaA = new Schema();
$schemaA->createSequence('foo');
@@ -609,7 +609,7 @@ public function testSequencesCaseInsensitive()
self::assertSchemaSequenceChangeCount($diff, 1, 0, 1);
}
- public function testCompareColumnCompareCaseInsensitive()
+ public function testCompareColumnCompareCaseInsensitive() : void
{
$tableA = new Table('foo');
$tableA->addColumn('id', 'integer');
@@ -623,7 +623,7 @@ public function testCompareColumnCompareCaseInsensitive()
self::assertFalse($tableDiff);
}
- public function testCompareIndexBasedOnPropertiesNotName()
+ public function testCompareIndexBasedOnPropertiesNotName() : void
{
$tableA = new Table('foo');
$tableA->addColumn('id', 'integer');
@@ -644,7 +644,7 @@ public function testCompareIndexBasedOnPropertiesNotName()
);
}
- public function testCompareForeignKeyBasedOnPropertiesNotName()
+ public function testCompareForeignKeyBasedOnPropertiesNotName() : void
{
$tableA = new Table('foo');
$tableA->addColumn('id', 'integer');
@@ -660,7 +660,7 @@ public function testCompareForeignKeyBasedOnPropertiesNotName()
self::assertFalse($tableDiff);
}
- public function testCompareForeignKeyRestrictNoActionAreTheSame()
+ public function testCompareForeignKeyRestrictNoActionAreTheSame() : void
{
$fk1 = new ForeignKeyConstraint(['foo'], 'bar', ['baz'], 'fk1', ['onDelete' => 'NO ACTION']);
$fk2 = new ForeignKeyConstraint(['foo'], 'bar', ['baz'], 'fk1', ['onDelete' => 'RESTRICT']);
@@ -672,7 +672,7 @@ public function testCompareForeignKeyRestrictNoActionAreTheSame()
/**
* @group DBAL-492
*/
- public function testCompareForeignKeyNamesUnqualifiedAsNoSchemaInformationIsAvailable()
+ public function testCompareForeignKeyNamesUnqualifiedAsNoSchemaInformationIsAvailable() : void
{
$fk1 = new ForeignKeyConstraint(['foo'], 'foo.bar', ['baz'], 'fk1');
$fk2 = new ForeignKeyConstraint(['foo'], 'baz.bar', ['baz'], 'fk1');
@@ -681,7 +681,7 @@ public function testCompareForeignKeyNamesUnqualifiedAsNoSchemaInformationIsAvai
self::assertFalse($c->diffForeignKey($fk1, $fk2));
}
- public function testDetectRenameColumn()
+ public function testDetectRenameColumn() : void
{
$tableA = new Table('foo');
$tableA->addColumn('foo', 'integer');
@@ -705,7 +705,7 @@ public function testDetectRenameColumn()
*
* @group DBAL-24
*/
- public function testDetectRenameColumnAmbiguous()
+ public function testDetectRenameColumnAmbiguous() : void
{
$tableA = new Table('foo');
$tableA->addColumn('foo', 'integer');
@@ -728,7 +728,7 @@ public function testDetectRenameColumnAmbiguous()
/**
* @group DBAL-1063
*/
- public function testDetectRenameIndex()
+ public function testDetectRenameIndex() : void
{
$table1 = new Table('foo');
$table1->addColumn('foo', 'integer');
@@ -755,7 +755,7 @@ public function testDetectRenameIndex()
*
* @group DBAL-1063
*/
- public function testDetectRenameIndexAmbiguous()
+ public function testDetectRenameIndexAmbiguous() : void
{
$table1 = new Table('foo');
$table1->addColumn('foo', 'integer');
@@ -778,7 +778,7 @@ public function testDetectRenameIndexAmbiguous()
self::assertCount(0, $tableDiff->renamedIndexes);
}
- public function testDetectChangeIdentifierType()
+ public function testDetectChangeIdentifierType() : void
{
$this->markTestSkipped('DBAL-2 was reopened, this test cannot work anymore.');
@@ -798,7 +798,7 @@ public function testDetectChangeIdentifierType()
/**
* @group DBAL-105
*/
- public function testDiff()
+ public function testDiff() : void
{
$table = new Table('twitter_users');
$table->addColumn('id', 'integer', ['autoincrement' => true]);
@@ -825,7 +825,7 @@ public function testDiff()
/**
* @group DBAL-112
*/
- public function testChangedSequence()
+ public function testChangedSequence() : void
{
$schema = new Schema();
$sequence = $schema->createSequence('baz');
@@ -842,7 +842,7 @@ public function testChangedSequence()
/**
* @group DBAL-106
*/
- public function testDiffDecimalWithNullPrecision()
+ public function testDiffDecimalWithNullPrecision() : void
{
$column = new Column('foo', Type::getType('decimal'));
$column->setPrecision(null);
@@ -856,7 +856,7 @@ public function testDiffDecimalWithNullPrecision()
/**
* @group DBAL-204
*/
- public function testFqnSchemaComparison()
+ public function testFqnSchemaComparison() : void
{
$config = new SchemaConfig();
$config->setName('foo');
@@ -876,7 +876,7 @@ public function testFqnSchemaComparison()
/**
* @group DBAL-669
*/
- public function testNamespacesComparison()
+ public function testNamespacesComparison() : void
{
$config = new SchemaConfig();
$config->setName('schemaName');
@@ -903,7 +903,7 @@ public function testNamespacesComparison()
/**
* @group DBAL-204
*/
- public function testFqnSchemaComparisonDifferentSchemaNameButSameTableNoDiff()
+ public function testFqnSchemaComparisonDifferentSchemaNameButSameTableNoDiff() : void
{
$config = new SchemaConfig();
$config->setName('foo');
@@ -923,7 +923,7 @@ public function testFqnSchemaComparisonDifferentSchemaNameButSameTableNoDiff()
/**
* @group DBAL-204
*/
- public function testFqnSchemaComparisonNoSchemaSame()
+ public function testFqnSchemaComparisonNoSchemaSame() : void
{
$config = new SchemaConfig();
$config->setName('foo');
@@ -942,7 +942,7 @@ public function testFqnSchemaComparisonNoSchemaSame()
/**
* @group DDC-1657
*/
- public function testAutoIncrementSequences()
+ public function testAutoIncrementSequences() : void
{
$oldSchema = new Schema();
$table = $oldSchema->createTable('foo');
@@ -966,7 +966,7 @@ public function testAutoIncrementSequences()
*
* @group DBAL-562
*/
- public function testAutoIncrementNoSequences()
+ public function testAutoIncrementNoSequences() : void
{
$oldSchema = new Schema();
$table = $oldSchema->createTable('foo');
@@ -991,7 +991,7 @@ public function testAutoIncrementNoSequences()
* array because of the dropped table, and once on changedTables array. We
* now check that the key is present once.
*/
- public function testAvoidMultipleDropForeignKey()
+ public function testAvoidMultipleDropForeignKey() : void
{
$oldSchema = new Schema();
@@ -1024,7 +1024,7 @@ public function testAvoidMultipleDropForeignKey()
self::assertCount(1, $schemaDiff->orphanedForeignKeys);
}
- public function testCompareChangedColumn()
+ public function testCompareChangedColumn() : void
{
$oldSchema = new Schema();
@@ -1046,7 +1046,7 @@ public function testCompareChangedColumn()
self::assertEquals($expected, Comparator::compareSchemas($oldSchema, $newSchema));
}
- public function testCompareChangedBinaryColumn()
+ public function testCompareChangedBinaryColumn() : void
{
$oldSchema = new Schema();
@@ -1071,7 +1071,7 @@ public function testCompareChangedBinaryColumn()
/**
* @group DBAL-617
*/
- public function testCompareQuotedAndUnquotedForeignKeyColumns()
+ public function testCompareQuotedAndUnquotedForeignKeyColumns() : void
{
$fk1 = new ForeignKeyConstraint(['foo'], 'bar', ['baz'], 'fk1', ['onDelete' => 'NO ACTION']);
$fk2 = new ForeignKeyConstraint(['`foo`'], 'bar', ['`baz`'], 'fk1', ['onDelete' => 'NO ACTION']);
@@ -1082,33 +1082,25 @@ public function testCompareQuotedAndUnquotedForeignKeyColumns()
self::assertFalse($diff);
}
- /**
- * @param SchemaDiff $diff
- * @param int $newTableCount
- * @param int $changeTableCount
- * @param int $removeTableCount
- */
- public function assertSchemaTableChangeCount($diff, $newTableCount = 0, $changeTableCount = 0, $removeTableCount = 0)
+ public function assertSchemaTableChangeCount(SchemaDiff $diff, int $newTableCount = 0, int $changeTableCount = 0, int $removeTableCount = 0) : void
{
self::assertCount($newTableCount, $diff->newTables);
self::assertCount($changeTableCount, $diff->changedTables);
self::assertCount($removeTableCount, $diff->removedTables);
}
- /**
- * @param SchemaDiff $diff
- * @param int $newSequenceCount
- * @param int $changeSequenceCount
- * @param int $changeSequenceCount
- */
- public function assertSchemaSequenceChangeCount($diff, $newSequenceCount = 0, $changeSequenceCount = 0, $removeSequenceCount = 0)
- {
+ public function assertSchemaSequenceChangeCount(
+ SchemaDiff $diff,
+ int $newSequenceCount = 0,
+ int $changeSequenceCount = 0,
+ int $removeSequenceCount = 0
+ ) : void {
self::assertCount($newSequenceCount, $diff->newSequences, 'Expected number of new sequences is wrong.');
self::assertCount($changeSequenceCount, $diff->changedSequences, 'Expected number of changed sequences is wrong.');
self::assertCount($removeSequenceCount, $diff->removedSequences, 'Expected number of removed sequences is wrong.');
}
- public function testDiffColumnPlatformOptions()
+ public function testDiffColumnPlatformOptions() : void
{
$column1 = new Column('foo', Type::getType('string'), ['platformOptions' => ['foo' => 'foo', 'bar' => 'bar']]);
$column2 = new Column('foo', Type::getType('string'), ['platformOptions' => ['foo' => 'foo', 'foobar' => 'foobar']]);
@@ -1125,7 +1117,7 @@ public function testDiffColumnPlatformOptions()
self::assertEquals([], $comparator->diffColumn($column4, $column1));
}
- public function testComplexDiffColumn()
+ public function testComplexDiffColumn() : void
{
$column1 = new Column('foo', Type::getType('string'), [
'platformOptions' => ['foo' => 'foo'],
@@ -1145,7 +1137,7 @@ public function testComplexDiffColumn()
/**
* @group DBAL-669
*/
- public function testComparesNamespaces()
+ public function testComparesNamespaces() : void
{
$comparator = new Comparator();
$fromSchema = $this->getMockBuilder(Schema::class)
@@ -1191,7 +1183,7 @@ public function testComparesNamespaces()
self::assertEquals($expected, $comparator->compare($fromSchema, $toSchema));
}
- public function testCompareGuidColumns()
+ public function testCompareGuidColumns() : void
{
$comparator = new Comparator();
@@ -1210,7 +1202,7 @@ public function testCompareGuidColumns()
* @group DBAL-1009
* @dataProvider getCompareColumnComments
*/
- public function testCompareColumnComments($comment1, $comment2, $equals)
+ public function testCompareColumnComments(?string $comment1, ?string $comment2, bool $equals) : void
{
$column1 = new Column('foo', Type::getType('integer'), ['comment' => $comment1]);
$column2 = new Column('foo', Type::getType('integer'), ['comment' => $comment2]);
@@ -1228,7 +1220,10 @@ public function testCompareColumnComments($comment1, $comment2, $equals)
self::assertSame($expectedDiff, $actualDiff);
}
- public function getCompareColumnComments()
+ /**
+ * @return mixed[][]
+ */
+ public static function getCompareColumnComments() : iterable
{
return [
[null, null, true],
@@ -1253,7 +1248,7 @@ public function getCompareColumnComments()
];
}
- public function testForeignKeyRemovalWithRenamedLocalColumn()
+ public function testForeignKeyRemovalWithRenamedLocalColumn() : void
{
$fromSchema = new Schema([
'table1' => new Table(
diff --git a/tests/Doctrine/Tests/DBAL/Schema/DB2SchemaManagerTest.php b/tests/Doctrine/Tests/DBAL/Schema/DB2SchemaManagerTest.php
index b3f91149b32..b5744fd672d 100644
--- a/tests/Doctrine/Tests/DBAL/Schema/DB2SchemaManagerTest.php
+++ b/tests/Doctrine/Tests/DBAL/Schema/DB2SchemaManagerTest.php
@@ -39,11 +39,9 @@ protected function setUp() : void
/**
* @see https://github.com/doctrine/dbal/issues/2701
*
- * @return void
- *
* @group DBAL-2701
*/
- public function testListTableNamesFiltersAssetNamesCorrectly()
+ public function testListTableNamesFiltersAssetNamesCorrectly() : void
{
$this->conn->getConfiguration()->setFilterSchemaAssetsExpression('/^(?!T_)/');
$this->conn->expects($this->once())->method('fetchAll')->will($this->returnValue([
@@ -63,11 +61,9 @@ public function testListTableNamesFiltersAssetNamesCorrectly()
}
/**
- * @return void
- *
* @group DBAL-2701
*/
- public function testAssetFilteringSetsACallable()
+ public function testAssetFilteringSetsACallable() : void
{
$filterExpression = '/^(?!T_)/';
$this->conn->getConfiguration()->setFilterSchemaAssetsExpression($filterExpression);
@@ -93,10 +89,7 @@ public function testAssetFilteringSetsACallable()
$this->assertEquals($filterExpression, $this->conn->getConfiguration()->getFilterSchemaAssetsExpression());
}
- /**
- * @return void
- */
- public function testListTableNamesFiltersAssetNamesCorrectlyWithCallable()
+ public function testListTableNamesFiltersAssetNamesCorrectlyWithCallable() : void
{
$accepted = ['T_FOO', 'T_BAR'];
$this->conn->getConfiguration()->setSchemaAssetsFilter(static function ($assetName) use ($accepted) {
@@ -121,10 +114,7 @@ public function testListTableNamesFiltersAssetNamesCorrectlyWithCallable()
$this->assertNull($this->conn->getConfiguration()->getFilterSchemaAssetsExpression());
}
- /**
- * @return void
- */
- public function testSettingNullExpressionWillResetCallable()
+ public function testSettingNullExpressionWillResetCallable() : void
{
$accepted = ['T_FOO', 'T_BAR'];
$this->conn->getConfiguration()->setSchemaAssetsFilter(static function ($assetName) use ($accepted) {
@@ -161,10 +151,7 @@ public function testSettingNullExpressionWillResetCallable()
$this->assertNull($this->conn->getConfiguration()->getSchemaAssetsFilter());
}
- /**
- * @return void
- */
- public function testSettingNullAsCallableClearsExpression()
+ public function testSettingNullAsCallableClearsExpression() : void
{
$filterExpression = '/^(?!T_)/';
$this->conn->getConfiguration()->setFilterSchemaAssetsExpression($filterExpression);
diff --git a/tests/Doctrine/Tests/DBAL/Schema/ForeignKeyConstraintTest.php b/tests/Doctrine/Tests/DBAL/Schema/ForeignKeyConstraintTest.php
index 2c317fc5dea..f0b115ddc4f 100644
--- a/tests/Doctrine/Tests/DBAL/Schema/ForeignKeyConstraintTest.php
+++ b/tests/Doctrine/Tests/DBAL/Schema/ForeignKeyConstraintTest.php
@@ -14,7 +14,7 @@ class ForeignKeyConstraintTest extends TestCase
* @group DBAL-1062
* @dataProvider getIntersectsIndexColumnsData
*/
- public function testIntersectsIndexColumns(array $indexColumns, $expectedResult)
+ public function testIntersectsIndexColumns(array $indexColumns, bool $expectedResult) : void
{
$foreignKey = new ForeignKeyConstraint(['foo', 'bar'], 'foreign_table', ['fk_foo', 'fk_bar']);
@@ -29,9 +29,9 @@ public function testIntersectsIndexColumns(array $indexColumns, $expectedResult)
}
/**
- * @return mixed[]
+ * @return mixed[][]
*/
- public function getIntersectsIndexColumnsData()
+ public static function getIntersectsIndexColumnsData() : iterable
{
return [
[['baz'], false],
diff --git a/tests/Doctrine/Tests/DBAL/Schema/IndexTest.php b/tests/Doctrine/Tests/DBAL/Schema/IndexTest.php
index ad9e2bbbdb7..d21e676b273 100644
--- a/tests/Doctrine/Tests/DBAL/Schema/IndexTest.php
+++ b/tests/Doctrine/Tests/DBAL/Schema/IndexTest.php
@@ -7,12 +7,15 @@
class IndexTest extends TestCase
{
- public function createIndex($unique = false, $primary = false, $options = [])
+ /**
+ * @param mixed[] $options
+ */
+ private function createIndex(bool $unique = false, bool $primary = false, array $options = []) : Index
{
return new Index('foo', ['bar', 'baz'], $unique, $primary, [], $options);
}
- public function testCreateIndex()
+ public function testCreateIndex() : void
{
$idx = $this->createIndex();
self::assertEquals('foo', $idx->getName());
@@ -23,14 +26,14 @@ public function testCreateIndex()
self::assertFalse($idx->isPrimary());
}
- public function testCreatePrimary()
+ public function testCreatePrimary() : void
{
$idx = $this->createIndex(false, true);
self::assertTrue($idx->isUnique());
self::assertTrue($idx->isPrimary());
}
- public function testCreateUnique()
+ public function testCreateUnique() : void
{
$idx = $this->createIndex(true, false);
self::assertTrue($idx->isUnique());
@@ -40,7 +43,7 @@ public function testCreateUnique()
/**
* @group DBAL-50
*/
- public function testFulfilledByUnique()
+ public function testFulfilledByUnique() : void
{
$idx1 = $this->createIndex(true, false);
$idx2 = $this->createIndex(true, false);
@@ -53,7 +56,7 @@ public function testFulfilledByUnique()
/**
* @group DBAL-50
*/
- public function testFulfilledByPrimary()
+ public function testFulfilledByPrimary() : void
{
$idx1 = $this->createIndex(true, true);
$idx2 = $this->createIndex(true, true);
@@ -66,7 +69,7 @@ public function testFulfilledByPrimary()
/**
* @group DBAL-50
*/
- public function testFulfilledByIndex()
+ public function testFulfilledByIndex() : void
{
$idx1 = $this->createIndex();
$idx2 = $this->createIndex();
@@ -78,7 +81,7 @@ public function testFulfilledByIndex()
self::assertTrue($idx1->isFullfilledBy($uniq));
}
- public function testFulfilledWithPartial()
+ public function testFulfilledWithPartial() : void
{
$without = new Index('without', ['col1', 'col2'], true, false, [], []);
$partial = new Index('partial', ['col1', 'col2'], true, false, [], ['where' => 'col1 IS NULL']);
@@ -93,7 +96,7 @@ public function testFulfilledWithPartial()
self::assertTrue($another->isFullfilledBy($partial));
}
- public function testOverrulesWithPartial()
+ public function testOverrulesWithPartial() : void
{
$without = new Index('without', ['col1', 'col2'], true, false, [], []);
$partial = new Index('partial', ['col1', 'col2'], true, false, [], ['where' => 'col1 IS NULL']);
@@ -141,7 +144,7 @@ public static function indexLengthProvider() : iterable
/**
* @group DBAL-220
*/
- public function testFlags()
+ public function testFlags() : void
{
$idx1 = $this->createIndex();
self::assertFalse($idx1->hasFlag('clustered'));
@@ -160,7 +163,7 @@ public function testFlags()
/**
* @group DBAL-285
*/
- public function testIndexQuotes()
+ public function testIndexQuotes() : void
{
$index = new Index('foo', ['`bar`', '`baz`']);
@@ -172,7 +175,7 @@ public function testIndexQuotes()
self::assertFalse($index->hasColumnAtPosition('baz', 0));
}
- public function testOptions()
+ public function testOptions() : void
{
$idx1 = $this->createIndex();
self::assertFalse($idx1->hasOption('where'));
diff --git a/tests/Doctrine/Tests/DBAL/Schema/MySqlSchemaManagerTest.php b/tests/Doctrine/Tests/DBAL/Schema/MySqlSchemaManagerTest.php
index 4646700e0e7..5c8881decb4 100644
--- a/tests/Doctrine/Tests/DBAL/Schema/MySqlSchemaManagerTest.php
+++ b/tests/Doctrine/Tests/DBAL/Schema/MySqlSchemaManagerTest.php
@@ -33,7 +33,7 @@ protected function setUp() : void
$this->manager = new MySqlSchemaManager($this->conn);
}
- public function testCompositeForeignKeys()
+ public function testCompositeForeignKeys() : void
{
$this->conn->expects($this->once())->method('fetchAll')->will($this->returnValue($this->getFKDefinition()));
$fkeys = $this->manager->listTableForeignKeys('dummy');
@@ -44,7 +44,10 @@ public function testCompositeForeignKeys()
self::assertEquals(['column_1', 'column_2', 'column_3'], array_map('strtolower', $fkeys[0]->getForeignColumns()));
}
- public function getFKDefinition()
+ /**
+ * @return string[][]
+ */
+ public function getFKDefinition() : array
{
return [
[
diff --git a/tests/Doctrine/Tests/DBAL/Schema/Platforms/MySQLSchemaTest.php b/tests/Doctrine/Tests/DBAL/Schema/Platforms/MySQLSchemaTest.php
index 568a4bfa79a..4cf69f28f7c 100644
--- a/tests/Doctrine/Tests/DBAL/Schema/Platforms/MySQLSchemaTest.php
+++ b/tests/Doctrine/Tests/DBAL/Schema/Platforms/MySQLSchemaTest.php
@@ -22,7 +22,7 @@ protected function setUp() : void
$this->platform = new MySqlPlatform();
}
- public function testSwitchPrimaryKeyOrder()
+ public function testSwitchPrimaryKeyOrder() : void
{
$tableOld = new Table('test');
$tableOld->addColumn('foo_id', 'integer');
@@ -47,7 +47,7 @@ public function testSwitchPrimaryKeyOrder()
/**
* @group DBAL-132
*/
- public function testGenerateForeignKeySQL()
+ public function testGenerateForeignKeySQL() : void
{
$tableOld = new Table('test');
$tableOld->addColumn('foo_id', 'integer');
@@ -64,7 +64,7 @@ public function testGenerateForeignKeySQL()
/**
* @group DDC-1737
*/
- public function testClobNoAlterTable()
+ public function testClobNoAlterTable() : void
{
$tableOld = new Table('test');
$tableOld->addColumn('id', 'integer');
diff --git a/tests/Doctrine/Tests/DBAL/Schema/SchemaDiffTest.php b/tests/Doctrine/Tests/DBAL/Schema/SchemaDiffTest.php
index 8400e952ef6..87146c2f001 100644
--- a/tests/Doctrine/Tests/DBAL/Schema/SchemaDiffTest.php
+++ b/tests/Doctrine/Tests/DBAL/Schema/SchemaDiffTest.php
@@ -13,7 +13,7 @@
class SchemaDiffTest extends TestCase
{
- public function testSchemaDiffToSql()
+ public function testSchemaDiffToSql() : void
{
$diff = $this->createSchemaDiff();
$platform = $this->createPlatform(true);
@@ -25,7 +25,7 @@ public function testSchemaDiffToSql()
self::assertEquals($expected, $sql);
}
- public function testSchemaDiffToSaveSql()
+ public function testSchemaDiffToSaveSql() : void
{
$diff = $this->createSchemaDiff();
$platform = $this->createPlatform(false);
@@ -102,7 +102,7 @@ private function createPlatform(bool $unsafe)
return $platform;
}
- public function createSchemaDiff()
+ public function createSchemaDiff() : SchemaDiff
{
$diff = new SchemaDiff();
$diff->newNamespaces['foo_ns'] = 'foo_ns';
diff --git a/tests/Doctrine/Tests/DBAL/Schema/SchemaTest.php b/tests/Doctrine/Tests/DBAL/Schema/SchemaTest.php
index 5618feeefdb..69796236235 100644
--- a/tests/Doctrine/Tests/DBAL/Schema/SchemaTest.php
+++ b/tests/Doctrine/Tests/DBAL/Schema/SchemaTest.php
@@ -16,7 +16,7 @@
class SchemaTest extends TestCase
{
- public function testAddTable()
+ public function testAddTable() : void
{
$tableName = 'public.foo';
$table = new Table($tableName);
@@ -32,7 +32,7 @@ public function testAddTable()
self::assertTrue($schema->hasTable($tableName));
}
- public function testTableMatchingCaseInsensitive()
+ public function testTableMatchingCaseInsensitive() : void
{
$table = new Table('Foo');
@@ -45,7 +45,7 @@ public function testTableMatchingCaseInsensitive()
self::assertSame($table, $schema->getTable('Foo'));
}
- public function testGetUnknownTableThrowsException()
+ public function testGetUnknownTableThrowsException() : void
{
$this->expectException(SchemaException::class);
@@ -53,7 +53,7 @@ public function testGetUnknownTableThrowsException()
$schema->getTable('unknown');
}
- public function testCreateTableTwiceThrowsException()
+ public function testCreateTableTwiceThrowsException() : void
{
$this->expectException(SchemaException::class);
@@ -64,7 +64,7 @@ public function testCreateTableTwiceThrowsException()
$schema = new Schema($tables);
}
- public function testRenameTable()
+ public function testRenameTable() : void
{
$tableName = 'foo';
$table = new Table($tableName);
@@ -77,7 +77,7 @@ public function testRenameTable()
self::assertSame($table, $schema->getTable('bar'));
}
- public function testDropTable()
+ public function testDropTable() : void
{
$tableName = 'foo';
$table = new Table($tableName);
@@ -90,7 +90,7 @@ public function testDropTable()
self::assertFalse($schema->hasTable('foo'));
}
- public function testCreateTable()
+ public function testCreateTable() : void
{
$schema = new Schema();
@@ -103,7 +103,7 @@ public function testCreateTable()
self::assertTrue($schema->hasTable('foo'));
}
- public function testAddSequences()
+ public function testAddSequences() : void
{
$sequence = new Sequence('a_seq', 1, 1);
@@ -116,7 +116,7 @@ public function testAddSequences()
self::assertArrayHasKey('public.a_seq', $sequences);
}
- public function testSequenceAccessCaseInsensitive()
+ public function testSequenceAccessCaseInsensitive() : void
{
$sequence = new Sequence('a_Seq');
@@ -130,7 +130,7 @@ public function testSequenceAccessCaseInsensitive()
self::assertEquals($sequence, $schema->getSequence('A_SEQ'));
}
- public function testGetUnknownSequenceThrowsException()
+ public function testGetUnknownSequenceThrowsException() : void
{
$this->expectException(SchemaException::class);
@@ -138,7 +138,7 @@ public function testGetUnknownSequenceThrowsException()
$schema->getSequence('unknown');
}
- public function testCreateSequence()
+ public function testCreateSequence() : void
{
$schema = new Schema();
$sequence = $schema->createSequence('a_seq', 10, 20);
@@ -154,7 +154,7 @@ public function testCreateSequence()
self::assertArrayHasKey('public.a_seq', $sequences);
}
- public function testDropSequence()
+ public function testDropSequence() : void
{
$sequence = new Sequence('a_seq', 1, 1);
@@ -164,7 +164,7 @@ public function testDropSequence()
self::assertFalse($schema->hasSequence('a_seq'));
}
- public function testAddSequenceTwiceThrowsException()
+ public function testAddSequenceTwiceThrowsException() : void
{
$this->expectException(SchemaException::class);
@@ -173,7 +173,7 @@ public function testAddSequenceTwiceThrowsException()
$schema = new Schema([], [$sequence, $sequence]);
}
- public function testConfigMaxIdentifierLength()
+ public function testConfigMaxIdentifierLength() : void
{
$schemaConfig = new SchemaConfig();
$schemaConfig->setMaxIdentifierLength(5);
@@ -187,7 +187,7 @@ public function testConfigMaxIdentifierLength()
self::assertEquals(5, strlen($index->getName()));
}
- public function testDeepClone()
+ public function testDeepClone() : void
{
$schema = new Schema();
$sequence = $schema->createSequence('baz');
@@ -222,7 +222,7 @@ public function testDeepClone()
/**
* @group DBAL-219
*/
- public function testHasTableForQuotedAsset()
+ public function testHasTableForQuotedAsset() : void
{
$schema = new Schema();
@@ -235,7 +235,7 @@ public function testHasTableForQuotedAsset()
/**
* @group DBAL-669
*/
- public function testHasNamespace()
+ public function testHasNamespace() : void
{
$schema = new Schema();
@@ -259,7 +259,7 @@ public function testHasNamespace()
/**
* @group DBAL-669
*/
- public function testCreatesNamespace()
+ public function testCreatesNamespace() : void
{
$schema = new Schema();
@@ -285,7 +285,7 @@ public function testCreatesNamespace()
/**
* @group DBAL-669
*/
- public function testThrowsExceptionOnCreatingNamespaceTwice()
+ public function testThrowsExceptionOnCreatingNamespaceTwice() : void
{
$schema = new Schema();
@@ -299,7 +299,7 @@ public function testThrowsExceptionOnCreatingNamespaceTwice()
/**
* @group DBAL-669
*/
- public function testCreatesNamespaceThroughAddingTableImplicitly()
+ public function testCreatesNamespaceThroughAddingTableImplicitly() : void
{
$schema = new Schema();
@@ -329,7 +329,7 @@ public function testCreatesNamespaceThroughAddingTableImplicitly()
/**
* @group DBAL-669
*/
- public function testCreatesNamespaceThroughAddingSequenceImplicitly()
+ public function testCreatesNamespaceThroughAddingSequenceImplicitly() : void
{
$schema = new Schema();
@@ -359,7 +359,7 @@ public function testCreatesNamespaceThroughAddingSequenceImplicitly()
/**
* @group DBAL-669
*/
- public function testVisitsVisitor()
+ public function testVisitsVisitor() : void
{
$schema = new Schema();
$visitor = $this->createMock(Visitor::class);
@@ -405,7 +405,7 @@ public function testVisitsVisitor()
/**
* @group DBAL-669
*/
- public function testVisitsNamespaceVisitor()
+ public function testVisitsNamespaceVisitor() : void
{
$schema = new Schema();
$visitor = $this->createMock(AbstractVisitor::class);
diff --git a/tests/Doctrine/Tests/DBAL/Schema/SequenceTest.php b/tests/Doctrine/Tests/DBAL/Schema/SequenceTest.php
index b3a72017c16..d13d0a908a6 100644
--- a/tests/Doctrine/Tests/DBAL/Schema/SequenceTest.php
+++ b/tests/Doctrine/Tests/DBAL/Schema/SequenceTest.php
@@ -11,7 +11,7 @@ class SequenceTest extends DbalTestCase
/**
* @group DDC-1657
*/
- public function testIsAutoincrementFor()
+ public function testIsAutoincrementFor() : void
{
$table = new Table('foo');
$table->addColumn('id', 'integer', ['autoincrement' => true]);
@@ -26,7 +26,7 @@ public function testIsAutoincrementFor()
self::assertFalse($sequence3->isAutoIncrementsFor($table));
}
- public function testIsAutoincrementForCaseInsensitive()
+ public function testIsAutoincrementForCaseInsensitive() : void
{
$table = new Table('foo');
$table->addColumn('ID', 'integer', ['autoincrement' => true]);
diff --git a/tests/Doctrine/Tests/DBAL/Schema/SqliteSchemaManagerTest.php b/tests/Doctrine/Tests/DBAL/Schema/SqliteSchemaManagerTest.php
index 7b3031624af..3677212f240 100644
--- a/tests/Doctrine/Tests/DBAL/Schema/SqliteSchemaManagerTest.php
+++ b/tests/Doctrine/Tests/DBAL/Schema/SqliteSchemaManagerTest.php
@@ -26,7 +26,10 @@ public function testParseColumnCollation(?string $collation, string $column, str
self::assertSame($collation, $ref->invoke($manager, $column, $sql));
}
- public function getDataColumnCollation()
+ /**
+ * @return mixed[][]
+ */
+ public static function getDataColumnCollation() : iterable
{
return [
['RTRIM', 'a', 'CREATE TABLE "a" ("a" text DEFAULT "aa" COLLATE "RTRIM" NOT NULL)'],
@@ -64,7 +67,10 @@ public function testParseColumnCommentFromSQL(?string $comment, string $column,
self::assertSame($comment, $ref->invoke($manager, $column, $sql));
}
- public function getDataColumnComment()
+ /**
+ * @return mixed[][]
+ */
+ public static function getDataColumnComment() : iterable
{
return [
'Single column with no comment' => [
diff --git a/tests/Doctrine/Tests/DBAL/Schema/Synchronizer/SingleDatabaseSynchronizerTest.php b/tests/Doctrine/Tests/DBAL/Schema/Synchronizer/SingleDatabaseSynchronizerTest.php
index 80d43e0e1b4..ad24ca599a6 100644
--- a/tests/Doctrine/Tests/DBAL/Schema/Synchronizer/SingleDatabaseSynchronizerTest.php
+++ b/tests/Doctrine/Tests/DBAL/Schema/Synchronizer/SingleDatabaseSynchronizerTest.php
@@ -28,7 +28,7 @@ protected function setUp() : void
$this->synchronizer = new SingleDatabaseSynchronizer($this->conn);
}
- public function testGetCreateSchema()
+ public function testGetCreateSchema() : void
{
$schema = new Schema();
$table = $schema->createTable('test');
@@ -39,7 +39,7 @@ public function testGetCreateSchema()
self::assertEquals(['CREATE TABLE test (id INTEGER NOT NULL, PRIMARY KEY(id))'], $sql);
}
- public function testGetUpdateSchema()
+ public function testGetUpdateSchema() : void
{
$schema = new Schema();
$table = $schema->createTable('test');
@@ -50,7 +50,7 @@ public function testGetUpdateSchema()
self::assertEquals(['CREATE TABLE test (id INTEGER NOT NULL, PRIMARY KEY(id))'], $sql);
}
- public function testGetDropSchema()
+ public function testGetDropSchema() : void
{
$schema = new Schema();
$table = $schema->createTable('test');
@@ -63,7 +63,7 @@ public function testGetDropSchema()
self::assertEquals(['DROP TABLE test'], $sql);
}
- public function testGetDropAllSchema()
+ public function testGetDropAllSchema() : void
{
$schema = new Schema();
$table = $schema->createTable('test');
diff --git a/tests/Doctrine/Tests/DBAL/Schema/TableDiffTest.php b/tests/Doctrine/Tests/DBAL/Schema/TableDiffTest.php
index ae1682739c6..7ae17019f83 100644
--- a/tests/Doctrine/Tests/DBAL/Schema/TableDiffTest.php
+++ b/tests/Doctrine/Tests/DBAL/Schema/TableDiffTest.php
@@ -22,7 +22,7 @@ public function setUp() : void
/**
* @group DBAL-1013
*/
- public function testReturnsName()
+ public function testReturnsName() : void
{
$tableDiff = new TableDiff('foo');
@@ -32,7 +32,7 @@ public function testReturnsName()
/**
* @group DBAL-1016
*/
- public function testPrefersNameFromTableObject()
+ public function testPrefersNameFromTableObject() : void
{
$tableMock = $this->getMockBuilder(Table::class)
->disableOriginalConstructor()
@@ -52,7 +52,7 @@ public function testPrefersNameFromTableObject()
/**
* @group DBAL-1013
*/
- public function testReturnsNewName()
+ public function testReturnsNewName() : void
{
$tableDiff = new TableDiff('foo');
diff --git a/tests/Doctrine/Tests/DBAL/Schema/TableTest.php b/tests/Doctrine/Tests/DBAL/Schema/TableTest.php
index 154a29ad7b0..6b5145934a8 100644
--- a/tests/Doctrine/Tests/DBAL/Schema/TableTest.php
+++ b/tests/Doctrine/Tests/DBAL/Schema/TableTest.php
@@ -17,20 +17,20 @@
class TableTest extends DbalTestCase
{
- public function testCreateWithInvalidTableName()
+ public function testCreateWithInvalidTableName() : void
{
$this->expectException(DBALException::class);
new Table('');
}
- public function testGetName()
+ public function testGetName() : void
{
$table = new Table('foo', [], [], []);
self::assertEquals('foo', $table->getName());
}
- public function testColumns()
+ public function testColumns() : void
{
$type = Type::getType('integer');
$columns = [];
@@ -48,7 +48,7 @@ public function testColumns()
self::assertCount(2, $table->getColumns());
}
- public function testColumnsCaseInsensitive()
+ public function testColumnsCaseInsensitive() : void
{
$table = new Table('foo');
$column = $table->addColumn('Foo', 'integer');
@@ -62,7 +62,7 @@ public function testColumnsCaseInsensitive()
self::assertSame($column, $table->getColumn('FOO'));
}
- public function testCreateColumn()
+ public function testCreateColumn() : void
{
$type = Type::getType('integer');
@@ -74,7 +74,7 @@ public function testCreateColumn()
self::assertSame($type, $table->getColumn('bar')->getType());
}
- public function testDropColumn()
+ public function testDropColumn() : void
{
$type = Type::getType('integer');
$columns = [];
@@ -91,7 +91,7 @@ public function testDropColumn()
self::assertFalse($table->hasColumn('bar'));
}
- public function testGetUnknownColumnThrowsException()
+ public function testGetUnknownColumnThrowsException() : void
{
$this->expectException(SchemaException::class);
@@ -99,7 +99,7 @@ public function testGetUnknownColumnThrowsException()
$table->getColumn('unknown');
}
- public function testAddColumnTwiceThrowsException()
+ public function testAddColumnTwiceThrowsException() : void
{
$this->expectException(SchemaException::class);
@@ -110,7 +110,7 @@ public function testAddColumnTwiceThrowsException()
$table = new Table('foo', $columns, [], []);
}
- public function testCreateIndex()
+ public function testCreateIndex() : void
{
$type = Type::getType('integer');
$columns = [new Column('foo', $type), new Column('bar', $type), new Column('baz', $type)];
@@ -123,7 +123,7 @@ public function testCreateIndex()
self::assertTrue($table->hasIndex('foo_bar_baz_uniq'));
}
- public function testIndexCaseInsensitive()
+ public function testIndexCaseInsensitive() : void
{
$type = Type::getType('integer');
$columns = [
@@ -140,7 +140,7 @@ public function testIndexCaseInsensitive()
self::assertTrue($table->hasIndex('FOO_IDX'));
}
- public function testAddIndexes()
+ public function testAddIndexes() : void
{
$type = Type::getType('integer');
$columns = [
@@ -162,7 +162,7 @@ public function testAddIndexes()
self::assertInstanceOf(Index::class, $table->getIndex('bar_idx'));
}
- public function testGetUnknownIndexThrowsException()
+ public function testGetUnknownIndexThrowsException() : void
{
$this->expectException(SchemaException::class);
@@ -170,7 +170,7 @@ public function testGetUnknownIndexThrowsException()
$table->getIndex('unknownIndex');
}
- public function testAddTwoPrimaryThrowsException()
+ public function testAddTwoPrimaryThrowsException() : void
{
$this->expectException(SchemaException::class);
@@ -183,7 +183,7 @@ public function testAddTwoPrimaryThrowsException()
$table = new Table('foo', $columns, $indexes, []);
}
- public function testAddTwoIndexesWithSameNameThrowsException()
+ public function testAddTwoIndexesWithSameNameThrowsException() : void
{
$this->expectException(SchemaException::class);
@@ -196,7 +196,7 @@ public function testAddTwoIndexesWithSameNameThrowsException()
$table = new Table('foo', $columns, $indexes, []);
}
- public function testConstraints()
+ public function testConstraints() : void
{
$constraint = new ForeignKeyConstraint([], 'foo', []);
@@ -207,7 +207,7 @@ public function testConstraints()
self::assertSame($constraint, array_shift($constraints));
}
- public function testOptions()
+ public function testOptions() : void
{
$table = new Table('foo', [], [], [], false, ['foo' => 'bar']);
@@ -215,7 +215,7 @@ public function testOptions()
self::assertEquals('bar', $table->getOption('foo'));
}
- public function testBuilderSetPrimaryKey()
+ public function testBuilderSetPrimaryKey() : void
{
$table = new Table('foo');
@@ -228,7 +228,7 @@ public function testBuilderSetPrimaryKey()
self::assertTrue($table->getIndex('primary')->isPrimary());
}
- public function testBuilderAddUniqueIndex()
+ public function testBuilderAddUniqueIndex() : void
{
$table = new Table('foo');
@@ -240,7 +240,7 @@ public function testBuilderAddUniqueIndex()
self::assertFalse($table->getIndex('my_idx')->isPrimary());
}
- public function testBuilderAddIndex()
+ public function testBuilderAddIndex() : void
{
$table = new Table('foo');
@@ -252,7 +252,7 @@ public function testBuilderAddIndex()
self::assertFalse($table->getIndex('my_idx')->isPrimary());
}
- public function testBuilderAddIndexWithInvalidNameThrowsException()
+ public function testBuilderAddIndexWithInvalidNameThrowsException() : void
{
$this->expectException(SchemaException::class);
@@ -261,7 +261,7 @@ public function testBuilderAddIndexWithInvalidNameThrowsException()
$table->addIndex(['bar'], 'invalid name %&/');
}
- public function testBuilderAddIndexWithUnknownColumnThrowsException()
+ public function testBuilderAddIndexWithUnknownColumnThrowsException() : void
{
$this->expectException(SchemaException::class);
@@ -269,7 +269,7 @@ public function testBuilderAddIndexWithUnknownColumnThrowsException()
$table->addIndex(['bar'], 'invalidName');
}
- public function testBuilderOptions()
+ public function testBuilderOptions() : void
{
$table = new Table('foo');
$table->addOption('foo', 'bar');
@@ -277,7 +277,7 @@ public function testBuilderOptions()
self::assertEquals('bar', $table->getOption('foo'));
}
- public function testAddForeignKeyConstraintUnknownLocalColumnThrowsException()
+ public function testAddForeignKeyConstraintUnknownLocalColumnThrowsException() : void
{
$this->expectException(SchemaException::class);
@@ -290,7 +290,7 @@ public function testAddForeignKeyConstraintUnknownLocalColumnThrowsException()
$table->addForeignKeyConstraint($foreignTable, ['foo'], ['id']);
}
- public function testAddForeignKeyConstraintUnknownForeignColumnThrowsException()
+ public function testAddForeignKeyConstraintUnknownForeignColumnThrowsException() : void
{
$this->expectException(SchemaException::class);
@@ -303,7 +303,7 @@ public function testAddForeignKeyConstraintUnknownForeignColumnThrowsException()
$table->addForeignKeyConstraint($foreignTable, ['id'], ['foo']);
}
- public function testAddForeignKeyConstraint()
+ public function testAddForeignKeyConstraint() : void
{
$table = new Table('foo');
$table->addColumn('id', 'integer');
@@ -323,7 +323,7 @@ public function testAddForeignKeyConstraint()
self::assertEquals('bar', $constraint->getOption('foo'));
}
- public function testAddIndexWithCaseSensitiveColumnProblem()
+ public function testAddIndexWithCaseSensitiveColumnProblem() : void
{
$table = new Table('foo');
$table->addColumn('id', 'integer');
@@ -335,7 +335,7 @@ public function testAddIndexWithCaseSensitiveColumnProblem()
self::assertTrue($table->getIndex('my_idx')->spansColumns(['id']));
}
- public function testAddPrimaryKeyColumnsAreExplicitlySetToNotNull()
+ public function testAddPrimaryKeyColumnsAreExplicitlySetToNotNull() : void
{
$table = new Table('foo');
$column = $table->addColumn('id', 'integer', ['notnull' => false]);
@@ -350,7 +350,7 @@ public function testAddPrimaryKeyColumnsAreExplicitlySetToNotNull()
/**
* @group DDC-133
*/
- public function testAllowImplicitSchemaTableInAutogeneratedIndexNames()
+ public function testAllowImplicitSchemaTableInAutogeneratedIndexNames() : void
{
$table = new Table('foo.bar');
$table->addColumn('baz', 'integer', []);
@@ -362,7 +362,7 @@ public function testAllowImplicitSchemaTableInAutogeneratedIndexNames()
/**
* @group DBAL-50
*/
- public function testAddForeignKeyIndexImplicitly()
+ public function testAddForeignKeyIndexImplicitly() : void
{
$table = new Table('foo');
$table->addColumn('id', 'integer');
@@ -383,7 +383,7 @@ public function testAddForeignKeyIndexImplicitly()
/**
* @group DBAL-1063
*/
- public function testAddForeignKeyDoesNotCreateDuplicateIndex()
+ public function testAddForeignKeyDoesNotCreateDuplicateIndex() : void
{
$table = new Table('foo');
$table->addColumn('bar', 'integer');
@@ -402,7 +402,7 @@ public function testAddForeignKeyDoesNotCreateDuplicateIndex()
/**
* @group DBAL-1063
*/
- public function testAddForeignKeyAddsImplicitIndexIfIndexColumnsDoNotSpan()
+ public function testAddForeignKeyAddsImplicitIndexIfIndexColumnsDoNotSpan() : void
{
$table = new Table('foo');
$table->addColumn('bar', 'integer');
@@ -430,7 +430,7 @@ public function testAddForeignKeyAddsImplicitIndexIfIndexColumnsDoNotSpan()
* @group DBAL-50
* @group DBAL-1063
*/
- public function testOverrulingIndexDoesNotDropOverruledIndex()
+ public function testOverrulingIndexDoesNotDropOverruledIndex() : void
{
$table = new Table('bar');
$table->addColumn('baz', 'integer', []);
@@ -448,7 +448,7 @@ public function testOverrulingIndexDoesNotDropOverruledIndex()
/**
* @group DBAL-1063
*/
- public function testAllowsAddingDuplicateIndexesBasedOnColumns()
+ public function testAllowsAddingDuplicateIndexesBasedOnColumns() : void
{
$table = new Table('foo');
$table->addColumn('bar', 'integer');
@@ -465,7 +465,7 @@ public function testAllowsAddingDuplicateIndexesBasedOnColumns()
/**
* @group DBAL-1063
*/
- public function testAllowsAddingFulfillingIndexesBasedOnColumns()
+ public function testAllowsAddingFulfillingIndexesBasedOnColumns() : void
{
$table = new Table('foo');
$table->addColumn('bar', 'integer');
@@ -484,7 +484,7 @@ public function testAllowsAddingFulfillingIndexesBasedOnColumns()
* @group DBAL-50
* @group DBAL-1063
*/
- public function testPrimaryKeyOverrulingUniqueIndexDoesNotDropUniqueIndex()
+ public function testPrimaryKeyOverrulingUniqueIndexDoesNotDropUniqueIndex() : void
{
$table = new Table('bar');
$table->addColumn('baz', 'integer', []);
@@ -499,7 +499,7 @@ public function testPrimaryKeyOverrulingUniqueIndexDoesNotDropUniqueIndex()
self::assertTrue($table->hasIndex('idx_unique'));
}
- public function testAddingFulfillingRegularIndexOverridesImplicitForeignKeyConstraintIndex()
+ public function testAddingFulfillingRegularIndexOverridesImplicitForeignKeyConstraintIndex() : void
{
$foreignTable = new Table('foreign');
$foreignTable->addColumn('id', 'integer');
@@ -516,7 +516,7 @@ public function testAddingFulfillingRegularIndexOverridesImplicitForeignKeyConst
self::assertTrue($localTable->hasIndex('explicit_idx'));
}
- public function testAddingFulfillingUniqueIndexOverridesImplicitForeignKeyConstraintIndex()
+ public function testAddingFulfillingUniqueIndexOverridesImplicitForeignKeyConstraintIndex() : void
{
$foreignTable = new Table('foreign');
$foreignTable->addColumn('id', 'integer');
@@ -533,7 +533,7 @@ public function testAddingFulfillingUniqueIndexOverridesImplicitForeignKeyConstr
self::assertTrue($localTable->hasIndex('explicit_idx'));
}
- public function testAddingFulfillingPrimaryKeyOverridesImplicitForeignKeyConstraintIndex()
+ public function testAddingFulfillingPrimaryKeyOverridesImplicitForeignKeyConstraintIndex() : void
{
$foreignTable = new Table('foreign');
$foreignTable->addColumn('id', 'integer');
@@ -550,7 +550,7 @@ public function testAddingFulfillingPrimaryKeyOverridesImplicitForeignKeyConstra
self::assertTrue($localTable->hasIndex('explicit_idx'));
}
- public function testAddingFulfillingExplicitIndexOverridingImplicitForeignKeyConstraintIndexWithSameNameDoesNotThrowException()
+ public function testAddingFulfillingExplicitIndexOverridingImplicitForeignKeyConstraintIndexWithSameNameDoesNotThrowException() : void
{
$foreignTable = new Table('foreign');
$foreignTable->addColumn('id', 'integer');
@@ -574,7 +574,7 @@ public function testAddingFulfillingExplicitIndexOverridingImplicitForeignKeyCon
/**
* @group DBAL-64
*/
- public function testQuotedTableName()
+ public function testQuotedTableName() : void
{
$table = new Table('`bar`');
@@ -589,7 +589,7 @@ public function testQuotedTableName()
/**
* @group DBAL-79
*/
- public function testTableHasPrimaryKey()
+ public function testTableHasPrimaryKey() : void
{
$table = new Table('test');
@@ -604,7 +604,7 @@ public function testTableHasPrimaryKey()
/**
* @group DBAL-91
*/
- public function testAddIndexWithQuotedColumns()
+ public function testAddIndexWithQuotedColumns() : void
{
$table = new Table('test');
$table->addColumn('"foo"', 'integer');
@@ -617,7 +617,7 @@ public function testAddIndexWithQuotedColumns()
/**
* @group DBAL-91
*/
- public function testAddForeignKeyWithQuotedColumnsAndTable()
+ public function testAddForeignKeyWithQuotedColumnsAndTable() : void
{
$table = new Table('test');
$table->addColumn('"foo"', 'integer');
@@ -630,7 +630,7 @@ public function testAddForeignKeyWithQuotedColumnsAndTable()
/**
* @group DBAL-177
*/
- public function testQuoteSchemaPrefixed()
+ public function testQuoteSchemaPrefixed() : void
{
$table = new Table('`test`.`test`');
self::assertEquals('test.test', $table->getName());
@@ -640,7 +640,7 @@ public function testQuoteSchemaPrefixed()
/**
* @group DBAL-204
*/
- public function testFullQualifiedTableName()
+ public function testFullQualifiedTableName() : void
{
$table = new Table('`test`.`test`');
self::assertEquals('test.test', $table->getFullQualifiedName('test'));
@@ -654,7 +654,7 @@ public function testFullQualifiedTableName()
/**
* @group DBAL-224
*/
- public function testDropIndex()
+ public function testDropIndex() : void
{
$table = new Table('test');
$table->addColumn('id', 'integer');
@@ -669,7 +669,7 @@ public function testDropIndex()
/**
* @group DBAL-224
*/
- public function testDropPrimaryKey()
+ public function testDropPrimaryKey() : void
{
$table = new Table('test');
$table->addColumn('id', 'integer');
@@ -684,7 +684,7 @@ public function testDropPrimaryKey()
/**
* @group DBAL-234
*/
- public function testRenameIndex()
+ public function testRenameIndex() : void
{
$table = new Table('test');
$table->addColumn('id', 'integer');
@@ -756,7 +756,7 @@ public function testRenameIndex()
/**
* @group DBAL-2508
*/
- public function testKeepsIndexOptionsOnRenamingRegularIndex()
+ public function testKeepsIndexOptionsOnRenamingRegularIndex() : void
{
$table = new Table('foo');
$table->addColumn('id', 'integer');
@@ -770,7 +770,7 @@ public function testKeepsIndexOptionsOnRenamingRegularIndex()
/**
* @group DBAL-2508
*/
- public function testKeepsIndexOptionsOnRenamingUniqueIndex()
+ public function testKeepsIndexOptionsOnRenamingUniqueIndex() : void
{
$table = new Table('foo');
$table->addColumn('id', 'integer');
@@ -784,7 +784,7 @@ public function testKeepsIndexOptionsOnRenamingUniqueIndex()
/**
* @group DBAL-234
*/
- public function testThrowsExceptionOnRenamingNonExistingIndex()
+ public function testThrowsExceptionOnRenamingNonExistingIndex() : void
{
$table = new Table('test');
$table->addColumn('id', 'integer');
@@ -798,7 +798,7 @@ public function testThrowsExceptionOnRenamingNonExistingIndex()
/**
* @group DBAL-234
*/
- public function testThrowsExceptionOnRenamingToAlreadyExistingIndex()
+ public function testThrowsExceptionOnRenamingToAlreadyExistingIndex() : void
{
$table = new Table('test');
$table->addColumn('id', 'integer');
@@ -815,7 +815,7 @@ public function testThrowsExceptionOnRenamingToAlreadyExistingIndex()
* @dataProvider getNormalizesAssetNames
* @group DBAL-831
*/
- public function testNormalizesColumnNames($assetName)
+ public function testNormalizesColumnNames(string $assetName) : void
{
$table = new Table('test');
@@ -869,7 +869,10 @@ public function testNormalizesColumnNames($assetName)
self::assertFalse($table->hasForeignKey('foo'));
}
- public function getNormalizesAssetNames()
+ /**
+ * @return mixed[][]
+ */
+ public static function getNormalizesAssetNames() : iterable
{
return [
['foo'],
diff --git a/tests/Doctrine/Tests/DBAL/Schema/Visitor/CreateSchemaSqlCollectorTest.php b/tests/Doctrine/Tests/DBAL/Schema/Visitor/CreateSchemaSqlCollectorTest.php
index e35583182a1..b70d2193a37 100644
--- a/tests/Doctrine/Tests/DBAL/Schema/Visitor/CreateSchemaSqlCollectorTest.php
+++ b/tests/Doctrine/Tests/DBAL/Schema/Visitor/CreateSchemaSqlCollectorTest.php
@@ -48,7 +48,7 @@ protected function setUp() : void
->willReturn(['foo']);
}
- public function testAcceptsNamespace()
+ public function testAcceptsNamespace() : void
{
$this->platformMock->expects($this->at(0))
->method('supportsSchemas')
@@ -67,7 +67,7 @@ public function testAcceptsNamespace()
self::assertSame(['foo'], $this->visitor->getQueries());
}
- public function testAcceptsTable()
+ public function testAcceptsTable() : void
{
$table = $this->createTableMock();
@@ -76,7 +76,7 @@ public function testAcceptsTable()
self::assertSame(['foo'], $this->visitor->getQueries());
}
- public function testAcceptsForeignKey()
+ public function testAcceptsForeignKey() : void
{
$this->platformMock->expects($this->at(0))
->method('supportsForeignKeyConstraints')
@@ -98,7 +98,7 @@ public function testAcceptsForeignKey()
self::assertSame(['foo'], $this->visitor->getQueries());
}
- public function testAcceptsSequences()
+ public function testAcceptsSequences() : void
{
$sequence = $this->createSequenceMock();
@@ -107,7 +107,7 @@ public function testAcceptsSequences()
self::assertSame(['foo'], $this->visitor->getQueries());
}
- public function testResetsQueries()
+ public function testResetsQueries() : void
{
foreach (['supportsSchemas', 'supportsForeignKeyConstraints'] as $method) {
$this->platformMock->expects($this->any())
diff --git a/tests/Doctrine/Tests/DBAL/Schema/Visitor/DropSchemaSqlCollectorTest.php b/tests/Doctrine/Tests/DBAL/Schema/Visitor/DropSchemaSqlCollectorTest.php
index b2aff283871..ea265396333 100644
--- a/tests/Doctrine/Tests/DBAL/Schema/Visitor/DropSchemaSqlCollectorTest.php
+++ b/tests/Doctrine/Tests/DBAL/Schema/Visitor/DropSchemaSqlCollectorTest.php
@@ -10,14 +10,14 @@
use PHPUnit\Framework\TestCase;
/**
- * @covers Doctrine\DBAL\Schema\Visitor\DropSchemaSqlCollector
+ * @covers \Doctrine\DBAL\Schema\Visitor\DropSchemaSqlCollector
*/
class DropSchemaSqlCollectorTest extends TestCase
{
- public function testGetQueriesUsesAcceptedForeignKeys()
+ public function testGetQueriesUsesAcceptedForeignKeys() : void
{
- $tableOne = $this->getTableMock();
- $tableTwo = $this->getTableMock();
+ $tableOne = $this->createMock(Table::class);
+ $tableTwo = $this->createMock(Table::class);
$keyConstraintOne = $this->getStubKeyConstraint('first');
$keyConstraintTwo = $this->getStubKeyConstraint('second');
@@ -45,19 +45,9 @@ public function testGetQueriesUsesAcceptedForeignKeys()
$collector->getQueries();
}
- private function getTableMock()
+ private function getStubKeyConstraint(string $name) : ForeignKeyConstraint
{
- return $this->getMockWithoutArguments(Table::class);
- }
-
- private function getMockWithoutArguments($className)
- {
- return $this->getMockBuilder($className)->disableOriginalConstructor()->getMock();
- }
-
- private function getStubKeyConstraint($name)
- {
- $constraint = $this->getMockWithoutArguments(ForeignKeyConstraint::class);
+ $constraint = $this->createMock(ForeignKeyConstraint::class);
$constraint->expects($this->any())
->method('getName')
@@ -74,13 +64,16 @@ private function getStubKeyConstraint($name)
return $constraint;
}
- public function testGivenForeignKeyWithZeroLengthAcceptForeignKeyThrowsException()
+ public function testGivenForeignKeyWithZeroLengthAcceptForeignKeyThrowsException() : void
{
$collector = new DropSchemaSqlCollector(
$this->getMockForAbstractClass(AbstractPlatform::class)
);
$this->expectException(SchemaException::class);
- $collector->acceptForeignKey($this->getTableMock(), $this->getStubKeyConstraint(''));
+ $collector->acceptForeignKey(
+ $this->createMock(Table::class),
+ $this->getStubKeyConstraint('')
+ );
}
}
diff --git a/tests/Doctrine/Tests/DBAL/Schema/Visitor/RemoveNamespacedAssetsTest.php b/tests/Doctrine/Tests/DBAL/Schema/Visitor/RemoveNamespacedAssetsTest.php
index c3e52b0ffaf..982da52ec44 100644
--- a/tests/Doctrine/Tests/DBAL/Schema/Visitor/RemoveNamespacedAssetsTest.php
+++ b/tests/Doctrine/Tests/DBAL/Schema/Visitor/RemoveNamespacedAssetsTest.php
@@ -14,7 +14,7 @@ class RemoveNamespacedAssetsTest extends TestCase
/**
* @group DBAL-204
*/
- public function testRemoveNamespacedAssets()
+ public function testRemoveNamespacedAssets() : void
{
$config = new SchemaConfig();
$config->setName('test');
@@ -33,7 +33,7 @@ public function testRemoveNamespacedAssets()
/**
* @group DBAL-204
*/
- public function testCleanupForeignKeys()
+ public function testCleanupForeignKeys() : void
{
$config = new SchemaConfig();
$config->setName('test');
@@ -56,7 +56,7 @@ public function testCleanupForeignKeys()
/**
* @group DBAL-204
*/
- public function testCleanupForeignKeysDifferentOrder()
+ public function testCleanupForeignKeysDifferentOrder() : void
{
$config = new SchemaConfig();
$config->setName('test');
diff --git a/tests/Doctrine/Tests/DBAL/Schema/Visitor/SchemaSqlCollectorTest.php b/tests/Doctrine/Tests/DBAL/Schema/Visitor/SchemaSqlCollectorTest.php
index 4ebfd1cac54..34e2896de29 100644
--- a/tests/Doctrine/Tests/DBAL/Schema/Visitor/SchemaSqlCollectorTest.php
+++ b/tests/Doctrine/Tests/DBAL/Schema/Visitor/SchemaSqlCollectorTest.php
@@ -8,7 +8,7 @@
class SchemaSqlCollectorTest extends TestCase
{
- public function testCreateSchema()
+ public function testCreateSchema() : void
{
$platformMock = $this->getMockBuilder(MySqlPlatform::class)
->setMethods(['getCreateTableSql', 'getCreateSequenceSql', 'getCreateForeignKeySql'])
@@ -30,7 +30,7 @@ public function testCreateSchema()
self::assertEquals(['foo', 'foo', 'bar', 'baz'], $sql);
}
- public function testDropSchema()
+ public function testDropSchema() : void
{
$platformMock = $this->getMockBuilder(MySqlPlatform::class)
->setMethods(['getDropTableSql', 'getDropSequenceSql', 'getDropForeignKeySql'])
@@ -52,10 +52,7 @@ public function testDropSchema()
self::assertEquals(['fk', 'seq', 'tbl', 'tbl'], $sql);
}
- /**
- * @return Schema
- */
- public function createFixtureSchema()
+ public function createFixtureSchema() : Schema
{
$schema = new Schema();
$tableA = $schema->createTable('foo');
diff --git a/tests/Doctrine/Tests/DBAL/Sharding/PoolingShardConnectionTest.php b/tests/Doctrine/Tests/DBAL/Sharding/PoolingShardConnectionTest.php
index 4985605c60d..c782b06b919 100644
--- a/tests/Doctrine/Tests/DBAL/Sharding/PoolingShardConnectionTest.php
+++ b/tests/Doctrine/Tests/DBAL/Sharding/PoolingShardConnectionTest.php
@@ -14,7 +14,7 @@
*/
class PoolingShardConnectionTest extends TestCase
{
- public function testConnect()
+ public function testConnect() : void
{
$conn = DriverManager::getConnection([
'wrapperClass' => PoolingShardConnection::class,
@@ -48,7 +48,7 @@ public function testConnect()
self::assertFalse($conn->isConnected(2));
}
- public function testNoGlobalServerException()
+ public function testNoGlobalServerException() : void
{
$this->expectException('InvalidArgumentException');
$this->expectExceptionMessage("Connection Parameters require 'global' and 'shards' configurations.");
@@ -64,7 +64,7 @@ public function testNoGlobalServerException()
]);
}
- public function testNoShardsServersException()
+ public function testNoShardsServersException() : void
{
$this->expectException('InvalidArgumentException');
$this->expectExceptionMessage("Connection Parameters require 'global' and 'shards' configurations.");
@@ -77,7 +77,7 @@ public function testNoShardsServersException()
]);
}
- public function testNoShardsChoserException()
+ public function testNoShardsChoserException() : void
{
$this->expectException('InvalidArgumentException');
$this->expectExceptionMessage("Missing Shard Choser configuration 'shardChoser'");
@@ -93,7 +93,7 @@ public function testNoShardsChoserException()
]);
}
- public function testShardChoserWrongInstance()
+ public function testShardChoserWrongInstance() : void
{
$this->expectException('InvalidArgumentException');
$this->expectExceptionMessage("The 'shardChoser' configuration is not a valid instance of Doctrine\DBAL\Sharding\ShardChoser\ShardChoser");
@@ -110,7 +110,7 @@ public function testShardChoserWrongInstance()
]);
}
- public function testShardNonNumericId()
+ public function testShardNonNumericId() : void
{
$this->expectException('InvalidArgumentException');
$this->expectExceptionMessage('Shard Id has to be a non-negative number.');
@@ -126,7 +126,7 @@ public function testShardNonNumericId()
]);
}
- public function testShardMissingId()
+ public function testShardMissingId() : void
{
$this->expectException('InvalidArgumentException');
$this->expectExceptionMessage("Missing 'id' for one configured shard. Please specify a unique shard-id.");
@@ -142,7 +142,7 @@ public function testShardMissingId()
]);
}
- public function testDuplicateShardId()
+ public function testDuplicateShardId() : void
{
$this->expectException('InvalidArgumentException');
$this->expectExceptionMessage('Shard 1 is duplicated in the configuration.');
@@ -159,7 +159,7 @@ public function testDuplicateShardId()
]);
}
- public function testSwitchShardWithOpenTransactionException()
+ public function testSwitchShardWithOpenTransactionException() : void
{
$conn = DriverManager::getConnection([
'wrapperClass' => PoolingShardConnection::class,
@@ -178,7 +178,7 @@ public function testSwitchShardWithOpenTransactionException()
$conn->connect(1);
}
- public function testGetActiveShardId()
+ public function testGetActiveShardId() : void
{
$conn = DriverManager::getConnection([
'wrapperClass' => PoolingShardConnection::class,
@@ -202,7 +202,7 @@ public function testGetActiveShardId()
self::assertNull($conn->getActiveShardId());
}
- public function testGetParamsOverride()
+ public function testGetParamsOverride() : void
{
$conn = DriverManager::getConnection([
'wrapperClass' => PoolingShardConnection::class,
@@ -241,7 +241,7 @@ public function testGetParamsOverride()
], $conn->getParams());
}
- public function testGetHostOverride()
+ public function testGetHostOverride() : void
{
$conn = DriverManager::getConnection([
'wrapperClass' => PoolingShardConnection::class,
@@ -260,7 +260,7 @@ public function testGetHostOverride()
self::assertEquals('foo', $conn->getHost());
}
- public function testGetPortOverride()
+ public function testGetPortOverride() : void
{
$conn = DriverManager::getConnection([
'wrapperClass' => PoolingShardConnection::class,
@@ -279,7 +279,7 @@ public function testGetPortOverride()
self::assertEquals(3307, $conn->getPort());
}
- public function testGetUsernameOverride()
+ public function testGetUsernameOverride() : void
{
$conn = DriverManager::getConnection([
'wrapperClass' => PoolingShardConnection::class,
@@ -298,7 +298,7 @@ public function testGetUsernameOverride()
self::assertEquals('bar', $conn->getUsername());
}
- public function testGetPasswordOverride()
+ public function testGetPasswordOverride() : void
{
$conn = DriverManager::getConnection([
'wrapperClass' => PoolingShardConnection::class,
diff --git a/tests/Doctrine/Tests/DBAL/Sharding/PoolingShardManagerTest.php b/tests/Doctrine/Tests/DBAL/Sharding/PoolingShardManagerTest.php
index f1f6cc0e2e7..01db26773f3 100644
--- a/tests/Doctrine/Tests/DBAL/Sharding/PoolingShardManagerTest.php
+++ b/tests/Doctrine/Tests/DBAL/Sharding/PoolingShardManagerTest.php
@@ -5,11 +5,15 @@
use Doctrine\DBAL\Sharding\PoolingShardConnection;
use Doctrine\DBAL\Sharding\PoolingShardManager;
use Doctrine\DBAL\Sharding\ShardChoser\ShardChoser;
+use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
class PoolingShardManagerTest extends TestCase
{
- private function createConnectionMock()
+ /**
+ * @return PoolingShardConnection|MockObject
+ */
+ private function createConnectionMock() : PoolingShardConnection
{
return $this->getMockBuilder(PoolingShardConnection::class)
->setMethods(['connect', 'getParams', 'fetchAll'])
@@ -17,7 +21,7 @@ private function createConnectionMock()
->getMock();
}
- private function createPassthroughShardChoser()
+ private function createPassthroughShardChoser() : ShardChoser
{
$mock = $this->createMock(ShardChoser::class);
$mock->expects($this->any())
@@ -29,7 +33,7 @@ private function createPassthroughShardChoser()
return $mock;
}
- private function createStaticShardChooser()
+ private function createStaticShardChooser() : ShardChoser
{
$mock = $this->createMock(ShardChoser::class);
$mock->expects($this->any())
@@ -39,7 +43,7 @@ private function createStaticShardChooser()
return $mock;
}
- public function testSelectGlobal()
+ public function testSelectGlobal() : void
{
$conn = $this->createConnectionMock();
$conn->expects($this->once())->method('connect')->with($this->equalTo(0));
@@ -50,7 +54,7 @@ public function testSelectGlobal()
self::assertNull($shardManager->getCurrentDistributionValue());
}
- public function testSelectShard()
+ public function testSelectShard() : void
{
$shardId = 10;
$conn = $this->createConnectionMock();
@@ -63,7 +67,7 @@ public function testSelectShard()
self::assertEquals($shardId, $shardManager->getCurrentDistributionValue());
}
- public function testGetShards()
+ public function testGetShards() : void
{
$conn = $this->createConnectionMock();
$conn->expects($this->any())->method('getParams')->will(
@@ -78,7 +82,7 @@ public function testGetShards()
self::assertEquals([['id' => 1], ['id' => 2]], $shards);
}
- public function testQueryAll()
+ public function testQueryAll() : void
{
$sql = 'SELECT * FROM table';
$params = [1];
@@ -108,7 +112,7 @@ public function testQueryAll()
self::assertEquals([['id' => 1], ['id' => 2]], $result);
}
- public function testQueryAllWithStaticShardChoser()
+ public function testQueryAllWithStaticShardChoser() : void
{
$sql = 'SELECT * FROM table';
$params = [1];
diff --git a/tests/Doctrine/Tests/DBAL/Sharding/SQLAzure/AbstractTestCase.php b/tests/Doctrine/Tests/DBAL/Sharding/SQLAzure/AbstractTestCase.php
index 5424c7bb676..b0439d5dfe2 100644
--- a/tests/Doctrine/Tests/DBAL/Sharding/SQLAzure/AbstractTestCase.php
+++ b/tests/Doctrine/Tests/DBAL/Sharding/SQLAzure/AbstractTestCase.php
@@ -52,7 +52,7 @@ protected function setUp() : void
$this->sm = new SQLAzureShardManager($this->conn);
}
- public function createShopSchema()
+ protected function createShopSchema() : Schema
{
$schema = new Schema();
diff --git a/tests/Doctrine/Tests/DBAL/Sharding/SQLAzure/FunctionalTest.php b/tests/Doctrine/Tests/DBAL/Sharding/SQLAzure/FunctionalTest.php
index 8a99ea70879..6e31d8716ed 100644
--- a/tests/Doctrine/Tests/DBAL/Sharding/SQLAzure/FunctionalTest.php
+++ b/tests/Doctrine/Tests/DBAL/Sharding/SQLAzure/FunctionalTest.php
@@ -7,7 +7,7 @@
class FunctionalTest extends AbstractTestCase
{
- public function testSharding()
+ public function testSharding() : void
{
$schema = $this->createShopSchema();
diff --git a/tests/Doctrine/Tests/DBAL/Sharding/SQLAzure/MultiTenantVisitorTest.php b/tests/Doctrine/Tests/DBAL/Sharding/SQLAzure/MultiTenantVisitorTest.php
index 94634dadb69..3549cf40b0e 100644
--- a/tests/Doctrine/Tests/DBAL/Sharding/SQLAzure/MultiTenantVisitorTest.php
+++ b/tests/Doctrine/Tests/DBAL/Sharding/SQLAzure/MultiTenantVisitorTest.php
@@ -9,7 +9,7 @@
class MultiTenantVisitorTest extends TestCase
{
- public function testMultiTenantPrimaryKey()
+ public function testMultiTenantPrimaryKey() : void
{
$platform = new SQLAzurePlatform();
$visitor = new MultiTenantVisitor();
@@ -24,7 +24,7 @@ public function testMultiTenantPrimaryKey()
self::assertTrue($foo->hasColumn('tenant_id'));
}
- public function testMultiTenantNonPrimaryKey()
+ public function testMultiTenantNonPrimaryKey() : void
{
$platform = new SQLAzurePlatform();
$visitor = new MultiTenantVisitor();
diff --git a/tests/Doctrine/Tests/DBAL/Sharding/SQLAzure/SQLAzureFederationsSynchronizerTest.php b/tests/Doctrine/Tests/DBAL/Sharding/SQLAzure/SQLAzureFederationsSynchronizerTest.php
index 20e479a3e00..2185a9fc8d1 100644
--- a/tests/Doctrine/Tests/DBAL/Sharding/SQLAzure/SQLAzureFederationsSynchronizerTest.php
+++ b/tests/Doctrine/Tests/DBAL/Sharding/SQLAzure/SQLAzureFederationsSynchronizerTest.php
@@ -6,7 +6,7 @@
class SQLAzureFederationsSynchronizerTest extends AbstractTestCase
{
- public function testCreateSchema()
+ public function testCreateSchema() : void
{
$schema = $this->createShopSchema();
@@ -23,7 +23,7 @@ public function testCreateSchema()
], $sql);
}
- public function testUpdateSchema()
+ public function testUpdateSchema() : void
{
$schema = $this->createShopSchema();
@@ -35,7 +35,7 @@ public function testUpdateSchema()
self::assertEquals([], $sql);
}
- public function testDropSchema()
+ public function testDropSchema() : void
{
$schema = $this->createShopSchema();
diff --git a/tests/Doctrine/Tests/DBAL/Sharding/SQLAzure/SQLAzureShardManagerTest.php b/tests/Doctrine/Tests/DBAL/Sharding/SQLAzure/SQLAzureShardManagerTest.php
index 3a0d37ab4ce..6dcbad5f356 100644
--- a/tests/Doctrine/Tests/DBAL/Sharding/SQLAzure/SQLAzureShardManagerTest.php
+++ b/tests/Doctrine/Tests/DBAL/Sharding/SQLAzure/SQLAzureShardManagerTest.php
@@ -9,7 +9,7 @@
class SQLAzureShardManagerTest extends TestCase
{
- public function testNoFederationName()
+ public function testNoFederationName() : void
{
$this->expectException(ShardingException::class);
$this->expectExceptionMessage('SQLAzure requires a federation name to be set during sharding configuration.');
@@ -18,7 +18,7 @@ public function testNoFederationName()
new SQLAzureShardManager($conn);
}
- public function testNoDistributionKey()
+ public function testNoDistributionKey() : void
{
$this->expectException(ShardingException::class);
$this->expectExceptionMessage('SQLAzure requires a distribution key to be set during sharding configuration.');
@@ -27,7 +27,7 @@ public function testNoDistributionKey()
new SQLAzureShardManager($conn);
}
- public function testNoDistributionType()
+ public function testNoDistributionType() : void
{
$this->expectException(ShardingException::class);
@@ -35,7 +35,7 @@ public function testNoDistributionType()
new SQLAzureShardManager($conn);
}
- public function testGetDefaultDistributionValue()
+ public function testGetDefaultDistributionValue() : void
{
$conn = $this->createConnection(['sharding' => ['federationName' => 'abc', 'distributionKey' => 'foo', 'distributionType' => 'integer']]);
@@ -43,7 +43,7 @@ public function testGetDefaultDistributionValue()
self::assertNull($sm->getCurrentDistributionValue());
}
- public function testSelectGlobalTransactionActive()
+ public function testSelectGlobalTransactionActive() : void
{
$conn = $this->createConnection(['sharding' => ['federationName' => 'abc', 'distributionKey' => 'foo', 'distributionType' => 'integer']]);
$conn->expects($this->at(1))->method('isTransactionActive')->will($this->returnValue(true));
@@ -55,7 +55,7 @@ public function testSelectGlobalTransactionActive()
$sm->selectGlobal();
}
- public function testSelectGlobal()
+ public function testSelectGlobal() : void
{
$conn = $this->createConnection(['sharding' => ['federationName' => 'abc', 'distributionKey' => 'foo', 'distributionType' => 'integer']]);
$conn->expects($this->at(1))->method('isTransactionActive')->will($this->returnValue(false));
@@ -65,7 +65,7 @@ public function testSelectGlobal()
$sm->selectGlobal();
}
- public function testSelectShard()
+ public function testSelectShard() : void
{
$conn = $this->createConnection(['sharding' => ['federationName' => 'abc', 'distributionKey' => 'foo', 'distributionType' => 'integer']]);
$conn->expects($this->at(1))->method('isTransactionActive')->will($this->returnValue(true));
@@ -82,7 +82,7 @@ public function testSelectShard()
/**
* @param mixed[] $params
*/
- private function createConnection(array $params)
+ private function createConnection(array $params) : Connection
{
$conn = $this->getMockBuilder(Connection::class)
->setMethods(['getParams', 'exec', 'isTransactionActive'])
diff --git a/tests/Doctrine/Tests/DBAL/Sharding/ShardChoser/MultiTenantShardChoserTest.php b/tests/Doctrine/Tests/DBAL/Sharding/ShardChoser/MultiTenantShardChoserTest.php
index 0c78b5c1771..aa15f91d3cc 100644
--- a/tests/Doctrine/Tests/DBAL/Sharding/ShardChoser/MultiTenantShardChoserTest.php
+++ b/tests/Doctrine/Tests/DBAL/Sharding/ShardChoser/MultiTenantShardChoserTest.php
@@ -8,7 +8,7 @@
class MultiTenantShardChoserTest extends TestCase
{
- public function testPickShard()
+ public function testPickShard() : void
{
$choser = new MultiTenantShardChoser();
$conn = $this->createConnectionMock();
@@ -17,7 +17,7 @@ public function testPickShard()
self::assertEquals(2, $choser->pickShard(2, $conn));
}
- private function createConnectionMock()
+ private function createConnectionMock() : PoolingShardConnection
{
return $this->getMockBuilder(PoolingShardConnection::class)
->setMethods(['connect', 'getParams', 'fetchAll'])
diff --git a/tests/Doctrine/Tests/DBAL/StatementTest.php b/tests/Doctrine/Tests/DBAL/StatementTest.php
index 1dae44d253d..1d76e3aabe3 100644
--- a/tests/Doctrine/Tests/DBAL/StatementTest.php
+++ b/tests/Doctrine/Tests/DBAL/StatementTest.php
@@ -55,7 +55,7 @@ protected function setUp() : void
->will($this->returnValue($driver));
}
- public function testExecuteCallsLoggerStartQueryWithParametersWhenValuesBound()
+ public function testExecuteCallsLoggerStartQueryWithParametersWhenValuesBound() : void
{
$name = 'foo';
$var = 'bar';
@@ -78,7 +78,7 @@ public function testExecuteCallsLoggerStartQueryWithParametersWhenValuesBound()
$statement->execute();
}
- public function testExecuteCallsLoggerStartQueryWithParametersWhenParamsPassedToExecute()
+ public function testExecuteCallsLoggerStartQueryWithParametersWhenParamsPassedToExecute() : void
{
$name = 'foo';
$var = 'bar';
@@ -99,7 +99,7 @@ public function testExecuteCallsLoggerStartQueryWithParametersWhenParamsPassedTo
$statement->execute($values);
}
- public function testExecuteCallsStartQueryWithTheParametersBoundViaBindParam()
+ public function testExecuteCallsStartQueryWithTheParametersBoundViaBindParam() : void
{
$name = 'foo';
$var = 'bar';
@@ -121,7 +121,7 @@ public function testExecuteCallsStartQueryWithTheParametersBoundViaBindParam()
$statement->execute();
}
- public function testExecuteCallsLoggerStopQueryOnException()
+ public function testExecuteCallsLoggerStopQueryOnException() : void
{
$logger = $this->createMock(SQLLogger::class);
diff --git a/tests/Doctrine/Tests/DBAL/Tools/Console/RunSqlCommandTest.php b/tests/Doctrine/Tests/DBAL/Tools/Console/RunSqlCommandTest.php
index eb06ddc350b..21eab4203ba 100644
--- a/tests/Doctrine/Tests/DBAL/Tools/Console/RunSqlCommandTest.php
+++ b/tests/Doctrine/Tests/DBAL/Tools/Console/RunSqlCommandTest.php
@@ -39,7 +39,7 @@ protected function setUp() : void
$this->command->setHelperSet($helperSet);
}
- public function testMissingSqlArgument()
+ public function testMissingSqlArgument() : void
{
try {
$this->commandTester->execute([
@@ -52,7 +52,7 @@ public function testMissingSqlArgument()
}
}
- public function testIncorrectDepthOption()
+ public function testIncorrectDepthOption() : void
{
try {
$this->commandTester->execute([
@@ -66,7 +66,7 @@ public function testIncorrectDepthOption()
}
}
- public function testSelectStatementsPrintsResult()
+ public function testSelectStatementsPrintsResult() : void
{
$this->expectConnectionFetchAll();
@@ -79,7 +79,7 @@ public function testSelectStatementsPrintsResult()
self::assertRegExp('@array.*1.*@', $this->commandTester->getDisplay());
}
- public function testUpdateStatementsPrintsAffectedLines()
+ public function testUpdateStatementsPrintsAffectedLines() : void
{
$this->expectConnectionExecuteUpdate();
@@ -92,7 +92,7 @@ public function testUpdateStatementsPrintsAffectedLines()
self::assertNotRegExp('@array.*1.*@', $this->commandTester->getDisplay());
}
- private function expectConnectionExecuteUpdate()
+ private function expectConnectionExecuteUpdate() : void
{
$this->connectionMock
->expects($this->exactly(1))
@@ -102,7 +102,7 @@ private function expectConnectionExecuteUpdate()
->method('fetchAll');
}
- private function expectConnectionFetchAll()
+ private function expectConnectionFetchAll() : void
{
$this->connectionMock
->expects($this->exactly(0))
@@ -112,7 +112,7 @@ private function expectConnectionFetchAll()
->method('fetchAll');
}
- public function testStatementsWithFetchResultPrintsResult()
+ public function testStatementsWithFetchResultPrintsResult() : void
{
$this->expectConnectionFetchAll();
diff --git a/tests/Doctrine/Tests/DBAL/Tools/DumperTest.php b/tests/Doctrine/Tests/DBAL/Tools/DumperTest.php
index 2aae261561f..ba99024231b 100644
--- a/tests/Doctrine/Tests/DBAL/Tools/DumperTest.php
+++ b/tests/Doctrine/Tests/DBAL/Tools/DumperTest.php
@@ -16,7 +16,7 @@
class DumperTest extends DbalTestCase
{
- public function testExportObject()
+ public function testExportObject() : void
{
$obj = new stdClass();
$obj->foo = 'bar';
@@ -26,7 +26,7 @@ public function testExportObject()
self::assertEquals('stdClass', $var->__CLASS__);
}
- public function testExportObjectWithReference()
+ public function testExportObjectWithReference() : void
{
$foo = 'bar';
$bar = ['foo' => & $foo];
@@ -39,7 +39,7 @@ public function testExportObjectWithReference()
self::assertEquals('tab', $bar['foo']);
}
- public function testExportArray()
+ public function testExportArray() : void
{
$array = ['a' => 'b', 'b' => ['c', 'd' => ['e', 'f']]];
$var = Dumper::export($array, 2);
@@ -48,7 +48,7 @@ public function testExportArray()
self::assertEquals($expected, $var);
}
- public function testExportDateTime()
+ public function testExportDateTime() : void
{
$obj = new DateTime('2010-10-10 10:10:10', new DateTimeZone('UTC'));
@@ -57,7 +57,7 @@ public function testExportDateTime()
self::assertEquals('2010-10-10T10:10:10+00:00', $var->date);
}
- public function testExportDateTimeImmutable()
+ public function testExportDateTimeImmutable() : void
{
$obj = new DateTimeImmutable('2010-10-10 10:10:10', new DateTimeZone('UTC'));
@@ -66,7 +66,7 @@ public function testExportDateTimeImmutable()
self::assertEquals('2010-10-10T10:10:10+00:00', $var->date);
}
- public function testExportDateTimeZone()
+ public function testExportDateTimeZone() : void
{
$obj = new DateTimeImmutable('2010-10-10 12:34:56', new DateTimeZone('Europe/Rome'));
@@ -75,7 +75,7 @@ public function testExportDateTimeZone()
self::assertEquals('2010-10-10T12:34:56+02:00', $var->date);
}
- public function testExportArrayTraversable()
+ public function testExportArrayTraversable() : void
{
$obj = new ArrayObject(['foobar']);
@@ -93,7 +93,7 @@ public function testExportArrayTraversable()
*
* @dataProvider provideAttributesCases
*/
- public function testExportParentAttributes(TestAsset\ParentClass $class, array $expected)
+ public function testExportParentAttributes(TestAsset\ParentClass $class, array $expected) : void
{
$print_r_class = print_r($class, true);
$print_r_expected = print_r($expected, true);
@@ -110,7 +110,10 @@ public function testExportParentAttributes(TestAsset\ParentClass $class, array $
self::assertSame($expected, $var);
}
- public function provideAttributesCases()
+ /**
+ * @return mixed[][]
+ */
+ public static function provideAttributesCases() : iterable
{
return [
'different-attributes' => [
diff --git a/tests/Doctrine/Tests/DBAL/Types/ArrayTest.php b/tests/Doctrine/Tests/DBAL/Types/ArrayTest.php
index 6f09cbf2bc0..bc6ab4d413f 100644
--- a/tests/Doctrine/Tests/DBAL/Types/ArrayTest.php
+++ b/tests/Doctrine/Tests/DBAL/Types/ArrayTest.php
@@ -24,24 +24,24 @@ protected function setUp() : void
$this->type = Type::getType('array');
}
- public function testArrayConvertsToDatabaseValue()
+ public function testArrayConvertsToDatabaseValue() : void
{
self::assertIsString($this->type->convertToDatabaseValue([], $this->platform));
}
- public function testArrayConvertsToPHPValue()
+ public function testArrayConvertsToPHPValue() : void
{
self::assertIsArray($this->type->convertToPHPValue(serialize([]), $this->platform));
}
- public function testConversionFailure()
+ public function testConversionFailure() : void
{
$this->expectException(ConversionException::class);
$this->expectExceptionMessage("Could not convert database value to 'array' as an error was triggered by the unserialization: 'unserialize(): Error at offset 0 of 7 bytes'");
$this->type->convertToPHPValue('abcdefg', $this->platform);
}
- public function testNullConversion()
+ public function testNullConversion() : void
{
self::assertNull($this->type->convertToPHPValue(null, $this->platform));
}
@@ -49,7 +49,7 @@ public function testNullConversion()
/**
* @group DBAL-73
*/
- public function testFalseConversion()
+ public function testFalseConversion() : void
{
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 3e73c96e7c9..5f5b412e249 100644
--- a/tests/Doctrine/Tests/DBAL/Types/BaseDateTypeTestCase.php
+++ b/tests/Doctrine/Tests/DBAL/Types/BaseDateTypeTestCase.php
@@ -43,7 +43,7 @@ protected function tearDown() : void
date_default_timezone_set($this->currentTimezone);
}
- public function testDateConvertsToDatabaseValue()
+ public function testDateConvertsToDatabaseValue() : void
{
self::assertIsString($this->type->convertToDatabaseValue(new DateTime(), $this->platform));
}
@@ -53,19 +53,19 @@ public function testDateConvertsToDatabaseValue()
*
* @dataProvider invalidPHPValuesProvider
*/
- public function testInvalidTypeConversionToDatabaseValue($value)
+ public function testInvalidTypeConversionToDatabaseValue($value) : void
{
$this->expectException(ConversionException::class);
$this->type->convertToDatabaseValue($value, $this->platform);
}
- public function testNullConversion()
+ public function testNullConversion() : void
{
self::assertNull($this->type->convertToPHPValue(null, $this->platform));
}
- public function testConvertDateTimeToPHPValue()
+ public function testConvertDateTimeToPHPValue() : void
{
$date = new DateTime('now');
@@ -79,7 +79,7 @@ public function testConvertDateTimeToPHPValue()
* by @see \Doctrine\DBAL\Types\DateTimeImmutableType, previous DBAL versions handled it just fine.
* This test is just in place to prevent further regressions, even if the type is being misused
*/
- public function testConvertDateTimeImmutableToPHPValue()
+ public function testConvertDateTimeImmutableToPHPValue() : void
{
$date = new DateTimeImmutable('now');
@@ -93,7 +93,7 @@ public function testConvertDateTimeImmutableToPHPValue()
* by @see \Doctrine\DBAL\Types\DateTimeImmutableType, previous DBAL versions handled it just fine.
* This test is just in place to prevent further regressions, even if the type is being misused
*/
- public function testDateTimeImmutableConvertsToDatabaseValue()
+ public function testDateTimeImmutableConvertsToDatabaseValue() : void
{
self::assertIsString($this->type->convertToDatabaseValue(new DateTimeImmutable(), $this->platform));
}
@@ -101,7 +101,7 @@ public function testDateTimeImmutableConvertsToDatabaseValue()
/**
* @return mixed[][]
*/
- public function invalidPHPValuesProvider()
+ public static function invalidPHPValuesProvider() : iterable
{
return [
[0],
@@ -111,7 +111,6 @@ public function invalidPHPValuesProvider()
['2015-01-31'],
['2015-01-31 10:11:12'],
[new stdClass()],
- [$this],
[27],
[-1],
[1.2],
diff --git a/tests/Doctrine/Tests/DBAL/Types/BinaryTest.php b/tests/Doctrine/Tests/DBAL/Types/BinaryTest.php
index 4eed8f7e4fd..fceeee557b8 100644
--- a/tests/Doctrine/Tests/DBAL/Types/BinaryTest.php
+++ b/tests/Doctrine/Tests/DBAL/Types/BinaryTest.php
@@ -31,17 +31,17 @@ protected function setUp() : void
$this->type = Type::getType('binary');
}
- public function testReturnsBindingType()
+ public function testReturnsBindingType() : void
{
self::assertSame(ParameterType::BINARY, $this->type->getBindingType());
}
- public function testReturnsName()
+ public function testReturnsName() : void
{
self::assertSame(Types::BINARY, $this->type->getName());
}
- public function testReturnsSQLDeclaration()
+ public function testReturnsSQLDeclaration() : void
{
$this->platform->expects($this->once())
->method('getBinaryTypeDeclarationSQL')
@@ -50,12 +50,12 @@ public function testReturnsSQLDeclaration()
self::assertSame('TEST_BINARY', $this->type->getSQLDeclaration([], $this->platform));
}
- public function testBinaryNullConvertsToPHPValue()
+ public function testBinaryNullConvertsToPHPValue() : void
{
self::assertNull($this->type->convertToPHPValue(null, $this->platform));
}
- public function testBinaryStringConvertsToPHPValue()
+ public function testBinaryStringConvertsToPHPValue() : void
{
$databaseValue = 'binary string';
$phpValue = $this->type->convertToPHPValue($databaseValue, $this->platform);
@@ -64,7 +64,7 @@ public function testBinaryStringConvertsToPHPValue()
self::assertEquals($databaseValue, stream_get_contents($phpValue));
}
- public function testBinaryResourceConvertsToPHPValue()
+ public function testBinaryResourceConvertsToPHPValue() : void
{
$databaseValue = fopen('data://text/plain;base64,' . base64_encode('binary string'), 'r');
$phpValue = $this->type->convertToPHPValue($databaseValue, $this->platform);
@@ -73,16 +73,21 @@ public function testBinaryResourceConvertsToPHPValue()
}
/**
+ * @param mixed $value
+ *
* @dataProvider getInvalidDatabaseValues
*/
- public function testThrowsConversionExceptionOnInvalidDatabaseValue($value)
+ public function testThrowsConversionExceptionOnInvalidDatabaseValue($value) : void
{
$this->expectException(ConversionException::class);
$this->type->convertToPHPValue($value, $this->platform);
}
- public function getInvalidDatabaseValues()
+ /**
+ * @return mixed[][]
+ */
+ public static function getInvalidDatabaseValues() : iterable
{
return [
[false],
diff --git a/tests/Doctrine/Tests/DBAL/Types/BlobTest.php b/tests/Doctrine/Tests/DBAL/Types/BlobTest.php
index 70bbcf55967..194d26af0b8 100644
--- a/tests/Doctrine/Tests/DBAL/Types/BlobTest.php
+++ b/tests/Doctrine/Tests/DBAL/Types/BlobTest.php
@@ -29,12 +29,12 @@ protected function setUp() : void
$this->type = Type::getType('blob');
}
- public function testBlobNullConvertsToPHPValue()
+ public function testBlobNullConvertsToPHPValue() : void
{
self::assertNull($this->type->convertToPHPValue(null, $this->platform));
}
- public function testBinaryStringConvertsToPHPValue()
+ public function testBinaryStringConvertsToPHPValue() : void
{
$databaseValue = $this->getBinaryString();
$phpValue = $this->type->convertToPHPValue($databaseValue, $this->platform);
@@ -43,7 +43,7 @@ public function testBinaryStringConvertsToPHPValue()
self::assertSame($databaseValue, stream_get_contents($phpValue));
}
- public function testBinaryResourceConvertsToPHPValue()
+ public function testBinaryResourceConvertsToPHPValue() : void
{
$databaseValue = fopen('data://text/plain;base64,' . base64_encode($this->getBinaryString()), 'r');
$phpValue = $this->type->convertToPHPValue($databaseValue, $this->platform);
@@ -53,10 +53,8 @@ public function testBinaryResourceConvertsToPHPValue()
/**
* Creates a binary string containing all possible byte values.
- *
- * @return string
*/
- private function getBinaryString()
+ private function getBinaryString() : string
{
$string = '';
diff --git a/tests/Doctrine/Tests/DBAL/Types/BooleanTest.php b/tests/Doctrine/Tests/DBAL/Types/BooleanTest.php
index af84fbf00d2..b5e25c2a77b 100644
--- a/tests/Doctrine/Tests/DBAL/Types/BooleanTest.php
+++ b/tests/Doctrine/Tests/DBAL/Types/BooleanTest.php
@@ -22,17 +22,17 @@ protected function setUp() : void
$this->type = Type::getType('boolean');
}
- public function testBooleanConvertsToDatabaseValue()
+ public function testBooleanConvertsToDatabaseValue() : void
{
self::assertIsInt($this->type->convertToDatabaseValue(1, $this->platform));
}
- public function testBooleanConvertsToPHPValue()
+ public function testBooleanConvertsToPHPValue() : void
{
self::assertIsBool($this->type->convertToPHPValue(0, $this->platform));
}
- public function testBooleanNullConvertsToPHPValue()
+ public function testBooleanNullConvertsToPHPValue() : void
{
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 3030899cd51..e7fa8a4be03 100644
--- a/tests/Doctrine/Tests/DBAL/Types/ConversionExceptionTest.php
+++ b/tests/Doctrine/Tests/DBAL/Types/ConversionExceptionTest.php
@@ -15,7 +15,7 @@ class ConversionExceptionTest extends TestCase
*
* @dataProvider scalarsProvider
*/
- public function testConversionFailedInvalidTypeWithScalar($scalarValue)
+ public function testConversionFailedInvalidTypeWithScalar($scalarValue) : void
{
$exception = ConversionException::conversionFailedInvalidType($scalarValue, 'foo', ['bar', 'baz']);
@@ -32,7 +32,7 @@ public function testConversionFailedInvalidTypeWithScalar($scalarValue)
*
* @dataProvider nonScalarsProvider
*/
- public function testConversionFailedInvalidTypeWithNonScalar($nonScalar)
+ public function testConversionFailedInvalidTypeWithNonScalar($nonScalar) : void
{
$exception = ConversionException::conversionFailedInvalidType($nonScalar, 'foo', ['bar', 'baz']);
@@ -44,7 +44,7 @@ public function testConversionFailedInvalidTypeWithNonScalar($nonScalar)
);
}
- public function testConversionFailedFormatPreservesPreviousException()
+ public function testConversionFailedFormatPreservesPreviousException() : void
{
$previous = new Exception();
@@ -57,13 +57,12 @@ public function testConversionFailedFormatPreservesPreviousException()
/**
* @return mixed[][]
*/
- public function nonScalarsProvider()
+ public static function nonScalarsProvider() : iterable
{
return [
[[]],
[['foo']],
[null],
- [$this],
[new stdClass()],
[tmpfile()],
];
@@ -72,7 +71,7 @@ public function nonScalarsProvider()
/**
* @return mixed[][]
*/
- public function scalarsProvider()
+ public static function scalarsProvider() : iterable
{
return [
[''],
diff --git a/tests/Doctrine/Tests/DBAL/Types/DateImmutableTypeTest.php b/tests/Doctrine/Tests/DBAL/Types/DateImmutableTypeTest.php
index 38cf0a98a33..c48f9a5ee34 100644
--- a/tests/Doctrine/Tests/DBAL/Types/DateImmutableTypeTest.php
+++ b/tests/Doctrine/Tests/DBAL/Types/DateImmutableTypeTest.php
@@ -27,22 +27,22 @@ protected function setUp() : void
$this->platform = $this->prophesize(AbstractPlatform::class);
}
- public function testFactoryCreatesCorrectType()
+ public function testFactoryCreatesCorrectType() : void
{
self::assertSame(DateImmutableType::class, get_class($this->type));
}
- public function testReturnsName()
+ public function testReturnsName() : void
{
self::assertSame('date_immutable', $this->type->getName());
}
- public function testReturnsBindingType()
+ public function testReturnsBindingType() : void
{
self::assertSame(ParameterType::STRING, $this->type->getBindingType());
}
- public function testConvertsDateTimeImmutableInstanceToDatabaseValue()
+ public function testConvertsDateTimeImmutableInstanceToDatabaseValue() : void
{
$date = $this->prophesize(DateTimeImmutable::class);
@@ -55,31 +55,31 @@ public function testConvertsDateTimeImmutableInstanceToDatabaseValue()
);
}
- public function testConvertsNullToDatabaseValue()
+ public function testConvertsNullToDatabaseValue() : void
{
self::assertNull($this->type->convertToDatabaseValue(null, $this->platform->reveal()));
}
- public function testDoesNotSupportMutableDateTimeToDatabaseValueConversion()
+ public function testDoesNotSupportMutableDateTimeToDatabaseValueConversion() : void
{
$this->expectException(ConversionException::class);
$this->type->convertToDatabaseValue(new DateTime(), $this->platform->reveal());
}
- public function testConvertsDateTimeImmutableInstanceToPHPValue()
+ public function testConvertsDateTimeImmutableInstanceToPHPValue() : void
{
$date = new DateTimeImmutable();
self::assertSame($date, $this->type->convertToPHPValue($date, $this->platform->reveal()));
}
- public function testConvertsNullToPHPValue()
+ public function testConvertsNullToPHPValue() : void
{
self::assertNull($this->type->convertToPHPValue(null, $this->platform->reveal()));
}
- public function testConvertsDateStringToPHPValue()
+ public function testConvertsDateStringToPHPValue() : void
{
$this->platform->getDateFormatString()->willReturn('Y-m-d')->shouldBeCalled();
@@ -89,7 +89,7 @@ public function testConvertsDateStringToPHPValue()
self::assertSame('2016-01-01', $date->format('Y-m-d'));
}
- public function testResetTimeFractionsWhenConvertingToPHPValue()
+ public function testResetTimeFractionsWhenConvertingToPHPValue() : void
{
$this->platform->getDateFormatString()->willReturn('Y-m-d');
@@ -98,14 +98,14 @@ public function testResetTimeFractionsWhenConvertingToPHPValue()
self::assertSame('2016-01-01 00:00:00.000000', $date->format('Y-m-d H:i:s.u'));
}
- public function testThrowsExceptionDuringConversionToPHPValueWithInvalidDateString()
+ public function testThrowsExceptionDuringConversionToPHPValueWithInvalidDateString() : void
{
$this->expectException(ConversionException::class);
$this->type->convertToPHPValue('invalid date string', $this->platform->reveal());
}
- public function testRequiresSQLCommentHint()
+ public function testRequiresSQLCommentHint() : void
{
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 710474257af..7b2c09aca9f 100644
--- a/tests/Doctrine/Tests/DBAL/Types/DateIntervalTest.php
+++ b/tests/Doctrine/Tests/DBAL/Types/DateIntervalTest.php
@@ -103,6 +103,8 @@ public function testRequiresSQLCommentHint() : void
}
/**
+ * @param mixed $value
+ *
* @dataProvider invalidPHPValuesProvider
*/
public function testInvalidTypeConversionToDatabaseValue($value) : void
@@ -115,7 +117,7 @@ public function testInvalidTypeConversionToDatabaseValue($value) : void
/**
* @return mixed[][]
*/
- public function invalidPHPValuesProvider() : array
+ public static function invalidPHPValuesProvider() : iterable
{
return [
[0],
@@ -125,7 +127,6 @@ public function invalidPHPValuesProvider() : array
['2015-01-31'],
['2015-01-31 10:11:12'],
[new stdClass()],
- [$this],
[27],
[-1],
[1.2],
diff --git a/tests/Doctrine/Tests/DBAL/Types/DateTest.php b/tests/Doctrine/Tests/DBAL/Types/DateTest.php
index e7c76ba77ff..73e426ea41c 100644
--- a/tests/Doctrine/Tests/DBAL/Types/DateTest.php
+++ b/tests/Doctrine/Tests/DBAL/Types/DateTest.php
@@ -19,7 +19,7 @@ protected function setUp() : void
parent::setUp();
}
- public function testDateConvertsToPHPValue()
+ public function testDateConvertsToPHPValue() : void
{
// Birthday of jwage and also birthday of Doctrine. Send him a present ;)
self::assertInstanceOf(
@@ -28,14 +28,14 @@ public function testDateConvertsToPHPValue()
);
}
- public function testDateResetsNonDatePartsToZeroUnixTimeValues()
+ public function testDateResetsNonDatePartsToZeroUnixTimeValues() : void
{
$date = $this->type->convertToPHPValue('1985-09-01', $this->platform);
self::assertEquals('00:00:00', $date->format('H:i:s'));
}
- public function testDateRestsSummerTimeAffection()
+ public function testDateRestsSummerTimeAffection() : void
{
date_default_timezone_set('Europe/Berlin');
@@ -48,7 +48,7 @@ public function testDateRestsSummerTimeAffection()
self::assertEquals('2009-11-01', $date->format('Y-m-d'));
}
- public function testInvalidDateFormatConversion()
+ public function testInvalidDateFormatConversion() : void
{
$this->expectException(ConversionException::class);
$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 4c2ed8e104e..8bc957f5c6b 100644
--- a/tests/Doctrine/Tests/DBAL/Types/DateTimeImmutableTypeTest.php
+++ b/tests/Doctrine/Tests/DBAL/Types/DateTimeImmutableTypeTest.php
@@ -27,22 +27,22 @@ protected function setUp() : void
$this->platform = $this->prophesize(AbstractPlatform::class);
}
- public function testFactoryCreatesCorrectType()
+ public function testFactoryCreatesCorrectType() : void
{
self::assertSame(DateTimeImmutableType::class, get_class($this->type));
}
- public function testReturnsName()
+ public function testReturnsName() : void
{
self::assertSame('datetime_immutable', $this->type->getName());
}
- public function testReturnsBindingType()
+ public function testReturnsBindingType() : void
{
self::assertSame(ParameterType::STRING, $this->type->getBindingType());
}
- public function testConvertsDateTimeImmutableInstanceToDatabaseValue()
+ public function testConvertsDateTimeImmutableInstanceToDatabaseValue() : void
{
$date = $this->prophesize(DateTimeImmutable::class);
@@ -55,31 +55,31 @@ public function testConvertsDateTimeImmutableInstanceToDatabaseValue()
);
}
- public function testConvertsNullToDatabaseValue()
+ public function testConvertsNullToDatabaseValue() : void
{
self::assertNull($this->type->convertToDatabaseValue(null, $this->platform->reveal()));
}
- public function testDoesNotSupportMutableDateTimeToDatabaseValueConversion()
+ public function testDoesNotSupportMutableDateTimeToDatabaseValueConversion() : void
{
$this->expectException(ConversionException::class);
$this->type->convertToDatabaseValue(new DateTime(), $this->platform->reveal());
}
- public function testConvertsDateTimeImmutableInstanceToPHPValue()
+ public function testConvertsDateTimeImmutableInstanceToPHPValue() : void
{
$date = new DateTimeImmutable();
self::assertSame($date, $this->type->convertToPHPValue($date, $this->platform->reveal()));
}
- public function testConvertsNullToPHPValue()
+ public function testConvertsNullToPHPValue() : void
{
self::assertNull($this->type->convertToPHPValue(null, $this->platform->reveal()));
}
- public function testConvertsDateTimeStringToPHPValue()
+ public function testConvertsDateTimeStringToPHPValue() : void
{
$this->platform->getDateTimeFormatString()->willReturn('Y-m-d H:i:s')->shouldBeCalled();
@@ -92,7 +92,7 @@ public function testConvertsDateTimeStringToPHPValue()
/**
* @group DBAL-415
*/
- public function testConvertsDateTimeStringWithMicrosecondsToPHPValue()
+ public function testConvertsDateTimeStringWithMicrosecondsToPHPValue() : void
{
$this->platform->getDateTimeFormatString()->willReturn('Y-m-d H:i:s');
@@ -101,14 +101,14 @@ public function testConvertsDateTimeStringWithMicrosecondsToPHPValue()
self::assertSame('2016-01-01 15:58:59', $date->format('Y-m-d H:i:s'));
}
- public function testThrowsExceptionDuringConversionToPHPValueWithInvalidDateTimeString()
+ public function testThrowsExceptionDuringConversionToPHPValueWithInvalidDateTimeString() : void
{
$this->expectException(ConversionException::class);
$this->type->convertToPHPValue('invalid datetime string', $this->platform->reveal());
}
- public function testRequiresSQLCommentHint()
+ public function testRequiresSQLCommentHint() : void
{
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 615c14d584d..ba7a661c8d9 100644
--- a/tests/Doctrine/Tests/DBAL/Types/DateTimeTest.php
+++ b/tests/Doctrine/Tests/DBAL/Types/DateTimeTest.php
@@ -18,7 +18,7 @@ protected function setUp() : void
parent::setUp();
}
- public function testDateTimeConvertsToDatabaseValue()
+ public function testDateTimeConvertsToDatabaseValue() : void
{
$date = new DateTime('1985-09-01 10:10:10');
@@ -28,7 +28,7 @@ public function testDateTimeConvertsToDatabaseValue()
self::assertEquals($expected, $actual);
}
- public function testDateTimeConvertsToPHPValue()
+ public function testDateTimeConvertsToPHPValue() : void
{
// Birthday of jwage and also birthday of Doctrine. Send him a present ;)
$date = $this->type->convertToPHPValue('1985-09-01 00:00:00', $this->platform);
@@ -36,13 +36,13 @@ public function testDateTimeConvertsToPHPValue()
self::assertEquals('1985-09-01 00:00:00', $date->format('Y-m-d H:i:s'));
}
- public function testInvalidDateTimeFormatConversion()
+ public function testInvalidDateTimeFormatConversion() : void
{
$this->expectException(ConversionException::class);
$this->type->convertToPHPValue('abcdefg', $this->platform);
}
- public function testConvertsNonMatchingFormatToPhpValueWithParser()
+ public function testConvertsNonMatchingFormatToPhpValueWithParser() : void
{
$date = '1985/09/01 10:10:10.12345';
diff --git a/tests/Doctrine/Tests/DBAL/Types/DateTimeTzImmutableTypeTest.php b/tests/Doctrine/Tests/DBAL/Types/DateTimeTzImmutableTypeTest.php
index aa602b629c2..ededd0e6e6c 100644
--- a/tests/Doctrine/Tests/DBAL/Types/DateTimeTzImmutableTypeTest.php
+++ b/tests/Doctrine/Tests/DBAL/Types/DateTimeTzImmutableTypeTest.php
@@ -27,22 +27,22 @@ protected function setUp() : void
$this->platform = $this->prophesize(AbstractPlatform::class);
}
- public function testFactoryCreatesCorrectType()
+ public function testFactoryCreatesCorrectType() : void
{
self::assertSame(DateTimeTzImmutableType::class, get_class($this->type));
}
- public function testReturnsName()
+ public function testReturnsName() : void
{
self::assertSame('datetimetz_immutable', $this->type->getName());
}
- public function testReturnsBindingType()
+ public function testReturnsBindingType() : void
{
self::assertSame(ParameterType::STRING, $this->type->getBindingType());
}
- public function testConvertsDateTimeImmutableInstanceToDatabaseValue()
+ public function testConvertsDateTimeImmutableInstanceToDatabaseValue() : void
{
$date = $this->prophesize(DateTimeImmutable::class);
@@ -55,31 +55,31 @@ public function testConvertsDateTimeImmutableInstanceToDatabaseValue()
);
}
- public function testConvertsNullToDatabaseValue()
+ public function testConvertsNullToDatabaseValue() : void
{
self::assertNull($this->type->convertToDatabaseValue(null, $this->platform->reveal()));
}
- public function testDoesNotSupportMutableDateTimeToDatabaseValueConversion()
+ public function testDoesNotSupportMutableDateTimeToDatabaseValueConversion() : void
{
$this->expectException(ConversionException::class);
$this->type->convertToDatabaseValue(new DateTime(), $this->platform->reveal());
}
- public function testConvertsDateTimeImmutableInstanceToPHPValue()
+ public function testConvertsDateTimeImmutableInstanceToPHPValue() : void
{
$date = new DateTimeImmutable();
self::assertSame($date, $this->type->convertToPHPValue($date, $this->platform->reveal()));
}
- public function testConvertsNullToPHPValue()
+ public function testConvertsNullToPHPValue() : void
{
self::assertNull($this->type->convertToPHPValue(null, $this->platform->reveal()));
}
- public function testConvertsDateTimeWithTimezoneStringToPHPValue()
+ public function testConvertsDateTimeWithTimezoneStringToPHPValue() : void
{
$this->platform->getDateTimeTzFormatString()->willReturn('Y-m-d H:i:s T')->shouldBeCalled();
@@ -89,14 +89,14 @@ public function testConvertsDateTimeWithTimezoneStringToPHPValue()
self::assertSame('2016-01-01 15:58:59 UTC', $date->format('Y-m-d H:i:s T'));
}
- public function testThrowsExceptionDuringConversionToPHPValueWithInvalidDateTimeWithTimezoneString()
+ public function testThrowsExceptionDuringConversionToPHPValueWithInvalidDateTimeWithTimezoneString() : void
{
$this->expectException(ConversionException::class);
$this->type->convertToPHPValue('invalid datetime with timezone string', $this->platform->reveal());
}
- public function testRequiresSQLCommentHint()
+ public function testRequiresSQLCommentHint() : void
{
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 419974c6b09..72ccaf87d05 100644
--- a/tests/Doctrine/Tests/DBAL/Types/DateTimeTzTest.php
+++ b/tests/Doctrine/Tests/DBAL/Types/DateTimeTzTest.php
@@ -18,7 +18,7 @@ protected function setUp() : void
parent::setUp();
}
- public function testDateTimeConvertsToDatabaseValue()
+ public function testDateTimeConvertsToDatabaseValue() : void
{
$date = new DateTime('1985-09-01 10:10:10');
@@ -28,7 +28,7 @@ public function testDateTimeConvertsToDatabaseValue()
self::assertEquals($expected, $actual);
}
- public function testDateTimeConvertsToPHPValue()
+ public function testDateTimeConvertsToPHPValue() : void
{
// Birthday of jwage and also birthday of Doctrine. Send him a present ;)
$date = $this->type->convertToPHPValue('1985-09-01 00:00:00', $this->platform);
@@ -36,7 +36,7 @@ public function testDateTimeConvertsToPHPValue()
self::assertEquals('1985-09-01 00:00:00', $date->format('Y-m-d H:i:s'));
}
- public function testInvalidDateFormatConversion()
+ public function testInvalidDateFormatConversion() : void
{
$this->expectException(ConversionException::class);
$this->type->convertToPHPValue('abcdefg', $this->platform);
diff --git a/tests/Doctrine/Tests/DBAL/Types/DecimalTest.php b/tests/Doctrine/Tests/DBAL/Types/DecimalTest.php
index 7087d2a6a49..1528dfd86d9 100644
--- a/tests/Doctrine/Tests/DBAL/Types/DecimalTest.php
+++ b/tests/Doctrine/Tests/DBAL/Types/DecimalTest.php
@@ -22,12 +22,12 @@ protected function setUp() : void
$this->type = Type::getType('decimal');
}
- public function testDecimalConvertsToPHPValue()
+ public function testDecimalConvertsToPHPValue() : void
{
self::assertIsString($this->type->convertToPHPValue('5.5', $this->platform));
}
- public function testDecimalNullConvertsToPHPValue()
+ public function testDecimalNullConvertsToPHPValue() : void
{
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 6daffd7d29b..4934f716c0f 100644
--- a/tests/Doctrine/Tests/DBAL/Types/FloatTest.php
+++ b/tests/Doctrine/Tests/DBAL/Types/FloatTest.php
@@ -22,22 +22,22 @@ protected function setUp() : void
$this->type = Type::getType('float');
}
- public function testFloatConvertsToPHPValue()
+ public function testFloatConvertsToPHPValue() : void
{
self::assertIsFloat($this->type->convertToPHPValue('5.5', $this->platform));
}
- public function testFloatNullConvertsToPHPValue()
+ public function testFloatNullConvertsToPHPValue() : void
{
self::assertNull($this->type->convertToPHPValue(null, $this->platform));
}
- public function testFloatConvertToDatabaseValue()
+ public function testFloatConvertToDatabaseValue() : void
{
self::assertIsFloat($this->type->convertToDatabaseValue(5.5, $this->platform));
}
- public function testFloatNullConvertToDatabaseValue()
+ public function testFloatNullConvertToDatabaseValue() : void
{
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 bbd309bea6d..df265d8541a 100644
--- a/tests/Doctrine/Tests/DBAL/Types/GuidTypeTest.php
+++ b/tests/Doctrine/Tests/DBAL/Types/GuidTypeTest.php
@@ -22,18 +22,18 @@ protected function setUp() : void
$this->type = Type::getType('guid');
}
- public function testConvertToPHPValue()
+ public function testConvertToPHPValue() : void
{
self::assertIsString($this->type->convertToPHPValue('foo', $this->platform));
self::assertIsString($this->type->convertToPHPValue('', $this->platform));
}
- public function testNullConversion()
+ public function testNullConversion() : void
{
self::assertNull($this->type->convertToPHPValue(null, $this->platform));
}
- public function testNativeGuidSupport()
+ public function testNativeGuidSupport() : void
{
self::assertTrue($this->type->requiresSQLCommentHint($this->platform));
diff --git a/tests/Doctrine/Tests/DBAL/Types/IntegerTest.php b/tests/Doctrine/Tests/DBAL/Types/IntegerTest.php
index 789de21e208..e4ac718c4ea 100644
--- a/tests/Doctrine/Tests/DBAL/Types/IntegerTest.php
+++ b/tests/Doctrine/Tests/DBAL/Types/IntegerTest.php
@@ -22,13 +22,13 @@ protected function setUp() : void
$this->type = Type::getType('integer');
}
- public function testIntegerConvertsToPHPValue()
+ public function testIntegerConvertsToPHPValue() : void
{
self::assertIsInt($this->type->convertToPHPValue('1', $this->platform));
self::assertIsInt($this->type->convertToPHPValue('0', $this->platform));
}
- public function testIntegerNullConvertsToPHPValue()
+ public function testIntegerNullConvertsToPHPValue() : void
{
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 2f76d14b503..2ee5e9fc45e 100644
--- a/tests/Doctrine/Tests/DBAL/Types/JsonArrayTest.php
+++ b/tests/Doctrine/Tests/DBAL/Types/JsonArrayTest.php
@@ -30,17 +30,17 @@ protected function setUp() : void
$this->type = Type::getType('json_array');
}
- public function testReturnsBindingType()
+ public function testReturnsBindingType() : void
{
self::assertSame(ParameterType::STRING, $this->type->getBindingType());
}
- public function testReturnsName()
+ public function testReturnsName() : void
{
self::assertSame(Types::JSON_ARRAY, $this->type->getName());
}
- public function testReturnsSQLDeclaration()
+ public function testReturnsSQLDeclaration() : void
{
$this->platform->expects($this->once())
->method('getJsonTypeDeclarationSQL')
@@ -49,17 +49,17 @@ public function testReturnsSQLDeclaration()
self::assertSame('TEST_JSON', $this->type->getSQLDeclaration([], $this->platform));
}
- public function testJsonNullConvertsToPHPValue()
+ public function testJsonNullConvertsToPHPValue() : void
{
self::assertSame([], $this->type->convertToPHPValue(null, $this->platform));
}
- public function testJsonEmptyStringConvertsToPHPValue()
+ public function testJsonEmptyStringConvertsToPHPValue() : void
{
self::assertSame([], $this->type->convertToPHPValue('', $this->platform));
}
- public function testJsonStringConvertsToPHPValue()
+ public function testJsonStringConvertsToPHPValue() : void
{
$value = ['foo' => 'bar', 'bar' => 'foo'];
$databaseValue = json_encode($value);
@@ -68,7 +68,7 @@ public function testJsonStringConvertsToPHPValue()
self::assertEquals($value, $phpValue);
}
- public function testJsonResourceConvertsToPHPValue()
+ public function testJsonResourceConvertsToPHPValue() : void
{
$value = ['foo' => 'bar', 'bar' => 'foo'];
$databaseValue = fopen('data://text/plain;base64,' . base64_encode(json_encode($value)), 'r');
@@ -77,7 +77,7 @@ public function testJsonResourceConvertsToPHPValue()
self::assertSame($value, $phpValue);
}
- public function testRequiresSQLCommentHint()
+ public function testRequiresSQLCommentHint() : void
{
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 796f5b1464f..4a5ff3c28c0 100644
--- a/tests/Doctrine/Tests/DBAL/Types/JsonTest.php
+++ b/tests/Doctrine/Tests/DBAL/Types/JsonTest.php
@@ -31,17 +31,17 @@ protected function setUp() : void
$this->type = Type::getType('json');
}
- public function testReturnsBindingType()
+ public function testReturnsBindingType() : void
{
self::assertSame(ParameterType::STRING, $this->type->getBindingType());
}
- public function testReturnsName()
+ public function testReturnsName() : void
{
self::assertSame(Types::JSON, $this->type->getName());
}
- public function testReturnsSQLDeclaration()
+ public function testReturnsSQLDeclaration() : void
{
$this->platform->expects($this->once())
->method('getJsonTypeDeclarationSQL')
@@ -50,17 +50,17 @@ public function testReturnsSQLDeclaration()
self::assertSame('TEST_JSON', $this->type->getSQLDeclaration([], $this->platform));
}
- public function testJsonNullConvertsToPHPValue()
+ public function testJsonNullConvertsToPHPValue() : void
{
self::assertNull($this->type->convertToPHPValue(null, $this->platform));
}
- public function testJsonEmptyStringConvertsToPHPValue()
+ public function testJsonEmptyStringConvertsToPHPValue() : void
{
self::assertNull($this->type->convertToPHPValue('', $this->platform));
}
- public function testJsonStringConvertsToPHPValue()
+ public function testJsonStringConvertsToPHPValue() : void
{
$value = ['foo' => 'bar', 'bar' => 'foo'];
$databaseValue = json_encode($value);
@@ -70,18 +70,21 @@ public function testJsonStringConvertsToPHPValue()
}
/** @dataProvider providerFailure */
- public function testConversionFailure($data)
+ public function testConversionFailure(string $data) : void
{
$this->expectException(ConversionException::class);
$this->type->convertToPHPValue($data, $this->platform);
}
- public function providerFailure()
+ /**
+ * @return mixed[][]
+ */
+ public static function providerFailure() : iterable
{
return [['a'], ['{']];
}
- public function testJsonResourceConvertsToPHPValue()
+ public function testJsonResourceConvertsToPHPValue() : void
{
$value = ['foo' => 'bar', 'bar' => 'foo'];
$databaseValue = fopen('data://text/plain;base64,' . base64_encode(json_encode($value)), 'r');
@@ -90,7 +93,7 @@ public function testJsonResourceConvertsToPHPValue()
self::assertSame($value, $phpValue);
}
- public function testRequiresSQLCommentHint()
+ public function testRequiresSQLCommentHint() : void
{
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 f8852ff1640..da9481d105a 100644
--- a/tests/Doctrine/Tests/DBAL/Types/ObjectTest.php
+++ b/tests/Doctrine/Tests/DBAL/Types/ObjectTest.php
@@ -25,24 +25,24 @@ protected function setUp() : void
$this->type = Type::getType('object');
}
- public function testObjectConvertsToDatabaseValue()
+ public function testObjectConvertsToDatabaseValue() : void
{
self::assertIsString($this->type->convertToDatabaseValue(new stdClass(), $this->platform));
}
- public function testObjectConvertsToPHPValue()
+ public function testObjectConvertsToPHPValue() : void
{
self::assertIsObject($this->type->convertToPHPValue(serialize(new stdClass()), $this->platform));
}
- public function testConversionFailure()
+ public function testConversionFailure() : void
{
$this->expectException(ConversionException::class);
$this->expectExceptionMessage("Could not convert database value to 'object' as an error was triggered by the unserialization: 'unserialize(): Error at offset 0 of 7 bytes'");
$this->type->convertToPHPValue('abcdefg', $this->platform);
}
- public function testNullConversion()
+ public function testNullConversion() : void
{
self::assertNull($this->type->convertToPHPValue(null, $this->platform));
}
@@ -50,7 +50,7 @@ public function testNullConversion()
/**
* @group DBAL-73
*/
- public function testFalseConversion()
+ public function testFalseConversion() : void
{
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 8aecc6649fa..b1731a99578 100644
--- a/tests/Doctrine/Tests/DBAL/Types/SmallIntTest.php
+++ b/tests/Doctrine/Tests/DBAL/Types/SmallIntTest.php
@@ -22,13 +22,13 @@ protected function setUp() : void
$this->type = Type::getType('smallint');
}
- public function testSmallIntConvertsToPHPValue()
+ public function testSmallIntConvertsToPHPValue() : void
{
self::assertIsInt($this->type->convertToPHPValue('1', $this->platform));
self::assertIsInt($this->type->convertToPHPValue('0', $this->platform));
}
- public function testSmallIntNullConvertsToPHPValue()
+ public function testSmallIntNullConvertsToPHPValue() : void
{
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 4ffb9af7d96..4548ff60943 100644
--- a/tests/Doctrine/Tests/DBAL/Types/StringTest.php
+++ b/tests/Doctrine/Tests/DBAL/Types/StringTest.php
@@ -22,7 +22,7 @@ protected function setUp() : void
$this->type = Type::getType('string');
}
- public function testReturnsSqlDeclarationFromPlatformVarchar()
+ public function testReturnsSqlDeclarationFromPlatformVarchar() : void
{
$this->platform->expects($this->once())
->method('getVarcharTypeDeclarationSQL')
@@ -31,7 +31,7 @@ public function testReturnsSqlDeclarationFromPlatformVarchar()
self::assertEquals('TEST_VARCHAR', $this->type->getSqlDeclaration([], $this->platform));
}
- public function testReturnsDefaultLengthFromPlatformVarchar()
+ public function testReturnsDefaultLengthFromPlatformVarchar() : void
{
$this->platform->expects($this->once())
->method('getVarcharDefaultLength')
@@ -40,18 +40,18 @@ public function testReturnsDefaultLengthFromPlatformVarchar()
self::assertEquals(255, $this->type->getDefaultLength($this->platform));
}
- public function testConvertToPHPValue()
+ public function testConvertToPHPValue() : void
{
self::assertIsString($this->type->convertToPHPValue('foo', $this->platform));
self::assertIsString($this->type->convertToPHPValue('', $this->platform));
}
- public function testNullConversion()
+ public function testNullConversion() : void
{
self::assertNull($this->type->convertToPHPValue(null, $this->platform));
}
- public function testSQLConversion()
+ public function testSQLConversion() : void
{
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));
diff --git a/tests/Doctrine/Tests/DBAL/Types/TimeImmutableTypeTest.php b/tests/Doctrine/Tests/DBAL/Types/TimeImmutableTypeTest.php
index a374cf1015f..e1445bee90c 100644
--- a/tests/Doctrine/Tests/DBAL/Types/TimeImmutableTypeTest.php
+++ b/tests/Doctrine/Tests/DBAL/Types/TimeImmutableTypeTest.php
@@ -27,22 +27,22 @@ protected function setUp() : void
$this->platform = $this->prophesize(AbstractPlatform::class);
}
- public function testFactoryCreatesCorrectType()
+ public function testFactoryCreatesCorrectType() : void
{
self::assertSame(TimeImmutableType::class, get_class($this->type));
}
- public function testReturnsName()
+ public function testReturnsName() : void
{
self::assertSame('time_immutable', $this->type->getName());
}
- public function testReturnsBindingType()
+ public function testReturnsBindingType() : void
{
self::assertSame(ParameterType::STRING, $this->type->getBindingType());
}
- public function testConvertsDateTimeImmutableInstanceToDatabaseValue()
+ public function testConvertsDateTimeImmutableInstanceToDatabaseValue() : void
{
$date = $this->prophesize(DateTimeImmutable::class);
@@ -55,31 +55,31 @@ public function testConvertsDateTimeImmutableInstanceToDatabaseValue()
);
}
- public function testConvertsNullToDatabaseValue()
+ public function testConvertsNullToDatabaseValue() : void
{
self::assertNull($this->type->convertToDatabaseValue(null, $this->platform->reveal()));
}
- public function testDoesNotSupportMutableDateTimeToDatabaseValueConversion()
+ public function testDoesNotSupportMutableDateTimeToDatabaseValueConversion() : void
{
$this->expectException(ConversionException::class);
$this->type->convertToDatabaseValue(new DateTime(), $this->platform->reveal());
}
- public function testConvertsDateTimeImmutableInstanceToPHPValue()
+ public function testConvertsDateTimeImmutableInstanceToPHPValue() : void
{
$date = new DateTimeImmutable();
self::assertSame($date, $this->type->convertToPHPValue($date, $this->platform->reveal()));
}
- public function testConvertsNullToPHPValue()
+ public function testConvertsNullToPHPValue() : void
{
self::assertNull($this->type->convertToPHPValue(null, $this->platform->reveal()));
}
- public function testConvertsTimeStringToPHPValue()
+ public function testConvertsTimeStringToPHPValue() : void
{
$this->platform->getTimeFormatString()->willReturn('H:i:s')->shouldBeCalled();
@@ -89,7 +89,7 @@ public function testConvertsTimeStringToPHPValue()
self::assertSame('15:58:59', $date->format('H:i:s'));
}
- public function testResetDateFractionsWhenConvertingToPHPValue()
+ public function testResetDateFractionsWhenConvertingToPHPValue() : void
{
$this->platform->getTimeFormatString()->willReturn('H:i:s');
@@ -98,14 +98,14 @@ public function testResetDateFractionsWhenConvertingToPHPValue()
self::assertSame('1970-01-01 15:58:59', $date->format('Y-m-d H:i:s'));
}
- public function testThrowsExceptionDuringConversionToPHPValueWithInvalidTimeString()
+ public function testThrowsExceptionDuringConversionToPHPValueWithInvalidTimeString() : void
{
$this->expectException(ConversionException::class);
$this->type->convertToPHPValue('invalid time string', $this->platform->reveal());
}
- public function testRequiresSQLCommentHint()
+ public function testRequiresSQLCommentHint() : void
{
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 1b254730092..a75544b650e 100644
--- a/tests/Doctrine/Tests/DBAL/Types/TimeTest.php
+++ b/tests/Doctrine/Tests/DBAL/Types/TimeTest.php
@@ -17,12 +17,12 @@ protected function setUp() : void
parent::setUp();
}
- public function testTimeConvertsToPHPValue()
+ public function testTimeConvertsToPHPValue() : void
{
self::assertInstanceOf('DateTime', $this->type->convertToPHPValue('5:30:55', $this->platform));
}
- public function testDateFieldResetInPHPValue()
+ public function testDateFieldResetInPHPValue() : void
{
$time = $this->type->convertToPHPValue('01:23:34', $this->platform);
@@ -30,7 +30,7 @@ public function testDateFieldResetInPHPValue()
self::assertEquals('1970-01-01', $time->format('Y-m-d'));
}
- public function testInvalidTimeFormatConversion()
+ public function testInvalidTimeFormatConversion() : void
{
$this->expectException(ConversionException::class);
$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 b948f22af77..9786c46bb1c 100644
--- a/tests/Doctrine/Tests/DBAL/Types/VarDateTimeImmutableTypeTest.php
+++ b/tests/Doctrine/Tests/DBAL/Types/VarDateTimeImmutableTypeTest.php
@@ -30,17 +30,17 @@ protected function setUp() : void
$this->platform = $this->prophesize(AbstractPlatform::class);
}
- public function testReturnsName()
+ public function testReturnsName() : void
{
self::assertSame('datetime_immutable', $this->type->getName());
}
- public function testReturnsBindingType()
+ public function testReturnsBindingType() : void
{
self::assertSame(ParameterType::STRING, $this->type->getBindingType());
}
- public function testConvertsDateTimeImmutableInstanceToDatabaseValue()
+ public function testConvertsDateTimeImmutableInstanceToDatabaseValue() : void
{
$date = $this->prophesize(DateTimeImmutable::class);
@@ -53,31 +53,31 @@ public function testConvertsDateTimeImmutableInstanceToDatabaseValue()
);
}
- public function testConvertsNullToDatabaseValue()
+ public function testConvertsNullToDatabaseValue() : void
{
self::assertNull($this->type->convertToDatabaseValue(null, $this->platform->reveal()));
}
- public function testDoesNotSupportMutableDateTimeToDatabaseValueConversion()
+ public function testDoesNotSupportMutableDateTimeToDatabaseValueConversion() : void
{
$this->expectException(ConversionException::class);
$this->type->convertToDatabaseValue(new DateTime(), $this->platform->reveal());
}
- public function testConvertsDateTimeImmutableInstanceToPHPValue()
+ public function testConvertsDateTimeImmutableInstanceToPHPValue() : void
{
$date = new DateTimeImmutable();
self::assertSame($date, $this->type->convertToPHPValue($date, $this->platform->reveal()));
}
- public function testConvertsNullToPHPValue()
+ public function testConvertsNullToPHPValue() : void
{
self::assertNull($this->type->convertToPHPValue(null, $this->platform->reveal()));
}
- public function testConvertsDateishStringToPHPValue()
+ public function testConvertsDateishStringToPHPValue() : void
{
$this->platform->getDateTimeFormatString()->shouldNotBeCalled();
@@ -87,14 +87,14 @@ public function testConvertsDateishStringToPHPValue()
self::assertSame('2016-01-01 15:58:59.123456 UTC', $date->format('Y-m-d H:i:s.u T'));
}
- public function testThrowsExceptionDuringConversionToPHPValueWithInvalidDateishString()
+ public function testThrowsExceptionDuringConversionToPHPValueWithInvalidDateishString() : void
{
$this->expectException(ConversionException::class);
$this->type->convertToPHPValue('invalid date-ish string', $this->platform->reveal());
}
- public function testRequiresSQLCommentHint()
+ public function testRequiresSQLCommentHint() : void
{
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 0807b25f022..7fe10cb2ba3 100644
--- a/tests/Doctrine/Tests/DBAL/Types/VarDateTimeTest.php
+++ b/tests/Doctrine/Tests/DBAL/Types/VarDateTimeTest.php
@@ -27,7 +27,7 @@ protected function setUp() : void
$this->type = Type::getType('vardatetime');
}
- public function testDateTimeConvertsToDatabaseValue()
+ public function testDateTimeConvertsToDatabaseValue() : void
{
$date = new DateTime('1985-09-01 10:10:10');
@@ -37,7 +37,7 @@ public function testDateTimeConvertsToDatabaseValue()
self::assertEquals($expected, $actual);
}
- public function testDateTimeConvertsToPHPValue()
+ public function testDateTimeConvertsToPHPValue() : void
{
// Birthday of jwage and also birthday of Doctrine. Send him a present ;)
$date = $this->type->convertToPHPValue('1985-09-01 00:00:00', $this->platform);
@@ -46,13 +46,13 @@ public function testDateTimeConvertsToPHPValue()
self::assertEquals('000000', $date->format('u'));
}
- public function testInvalidDateTimeFormatConversion()
+ public function testInvalidDateTimeFormatConversion() : void
{
$this->expectException(ConversionException::class);
$this->type->convertToPHPValue('abcdefg', $this->platform);
}
- public function testConversionWithMicroseconds()
+ public function testConversionWithMicroseconds() : void
{
$date = $this->type->convertToPHPValue('1985-09-01 00:00:00.123456', $this->platform);
self::assertInstanceOf('DateTime', $date);
@@ -60,12 +60,12 @@ public function testConversionWithMicroseconds()
self::assertEquals('123456', $date->format('u'));
}
- public function testNullConversion()
+ public function testNullConversion() : void
{
self::assertNull($this->type->convertToPHPValue(null, $this->platform));
}
- public function testConvertDateTimeToPHPValue()
+ public function testConvertDateTimeToPHPValue() : void
{
$date = new DateTime('now');
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 e7800fceba3..92f63872f15 100644
--- a/tests/Doctrine/Tests/DBAL/UtilTest.php
+++ b/tests/Doctrine/Tests/DBAL/UtilTest.php
@@ -7,7 +7,10 @@
class UtilTest extends DbalTestCase
{
- public static function dataConvertPositionalToNamedParameters()
+ /**
+ * @return mixed[][]
+ */
+ public static function dataConvertPositionalToNamedParameters() : iterable
{
return [
[
@@ -64,13 +67,11 @@ public static function dataConvertPositionalToNamedParameters()
}
/**
- * @param string $inputSQL
- * @param string $expectedOutputSQL
* @param mixed[] $expectedOutputParamsMap
*
* @dataProvider dataConvertPositionalToNamedParameters
*/
- public function testConvertPositionalToNamedParameters($inputSQL, $expectedOutputSQL, $expectedOutputParamsMap)
+ public function testConvertPositionalToNamedParameters(string $inputSQL, string $expectedOutputSQL, array $expectedOutputParamsMap) : void
{
[$statement, $params] = OCI8Statement::convertPositionalToNamedPlaceholders($inputSQL);
diff --git a/tests/Doctrine/Tests/DbalFunctionalTestCase.php b/tests/Doctrine/Tests/DbalFunctionalTestCase.php
index 2ae17cf9165..16aa747c20e 100644
--- a/tests/Doctrine/Tests/DbalFunctionalTestCase.php
+++ b/tests/Doctrine/Tests/DbalFunctionalTestCase.php
@@ -33,7 +33,7 @@ abstract class DbalFunctionalTestCase extends DbalTestCase
/** @var DebugStack */
protected $sqlLoggerStack;
- protected function resetSharedConn()
+ protected function resetSharedConn() : void
{
if (! self::$sharedConnection) {
return;
diff --git a/tests/Doctrine/Tests/DbalPerformanceTestCase.php b/tests/Doctrine/Tests/DbalPerformanceTestCase.php
index f9bb40df38c..ac0beb3c5de 100644
--- a/tests/Doctrine/Tests/DbalPerformanceTestCase.php
+++ b/tests/Doctrine/Tests/DbalPerformanceTestCase.php
@@ -40,7 +40,7 @@ protected function assertPostConditions() : void
/**
* begin timing
*/
- protected function startTiming()
+ protected function startTiming() : void
{
$this->startTime = microtime(true);
}
@@ -48,7 +48,7 @@ protected function startTiming()
/**
* end timing
*/
- protected function stopTiming()
+ protected function stopTiming() : void
{
$this->runTime = microtime(true) - $this->startTime;
}
@@ -56,7 +56,7 @@ protected function stopTiming()
/**
* @return float elapsed test execution time
*/
- public function getTime()
+ public function getTime() : float
{
return $this->runTime;
}
diff --git a/tests/Doctrine/Tests/TestUtil.php b/tests/Doctrine/Tests/TestUtil.php
index 0ff5a42ce8c..b5f4dd010c2 100644
--- a/tests/Doctrine/Tests/TestUtil.php
+++ b/tests/Doctrine/Tests/TestUtil.php
@@ -38,7 +38,7 @@ class TestUtil
*
* @return Connection The database connection instance.
*/
- public static function getConnection()
+ public static function getConnection() : Connection
{
if (self::hasRequiredConnectionParams() && ! self::$initialized) {
self::initializeDatabase();
@@ -52,7 +52,10 @@ public static function getConnection()
return $conn;
}
- public static function getConnectionParams()
+ /**
+ * @return mixed[]
+ */
+ public static function getConnectionParams() : array
{
if (self::hasRequiredConnectionParams()) {
return self::getParamsForMainConnection();
@@ -61,7 +64,7 @@ public static function getConnectionParams()
return self::getFallbackConnectionParams();
}
- private static function hasRequiredConnectionParams()
+ private static function hasRequiredConnectionParams() : bool
{
return isset(
$GLOBALS['db_type'],
@@ -111,7 +114,10 @@ private static function initializeDatabase() : void
}
}
- private static function getFallbackConnectionParams()
+ /**
+ * @return mixed[]
+ */
+ private static function getFallbackConnectionParams() : array
{
if (! extension_loaded('pdo_sqlite')) {
Assert::markTestSkipped('PDO SQLite extension is not loaded');
@@ -130,7 +136,7 @@ private static function getFallbackConnectionParams()
return $params;
}
- private static function addDbEventSubscribers(Connection $conn)
+ private static function addDbEventSubscribers(Connection $conn) : void
{
if (! isset($GLOBALS['db_event_subscribers'])) {
return;
@@ -143,7 +149,10 @@ private static function addDbEventSubscribers(Connection $conn)
}
}
- private static function getParamsForTemporaryConnection()
+ /**
+ * @return mixed[]
+ */
+ private static function getParamsForTemporaryConnection() : array
{
$connectionParams = [
'driver' => $GLOBALS['tmpdb_type'],
@@ -169,7 +178,10 @@ private static function getParamsForTemporaryConnection()
return $connectionParams;
}
- private static function getParamsForMainConnection()
+ /**
+ * @return mixed[]
+ */
+ private static function getParamsForMainConnection() : array
{
$connectionParams = [
'driver' => $GLOBALS['db_type'],
@@ -191,10 +203,7 @@ private static function getParamsForMainConnection()
return $connectionParams;
}
- /**
- * @return Connection
- */
- public static function getTempConnection()
+ public static function getTempConnection() : Connection
{
return DriverManager::getConnection(self::getParamsForTemporaryConnection());
}