Commit e4211cf1 authored by Benni Mack's avatar Benni Mack
Browse files

[BUGFIX] Fix deprecated functionality in Doctrine DBAL 3.x API

The past changes of migrating to Doctrine DBAL 3.x
had some flaws:

* Not all changes from Doctrine DBAL 3.x was applied
* core relies on various invalid interfaces and classes, so the
  return types were wrong (also Tests used the old Statement class)
* No explicit ->execute() and ->iterateAssociative() calls
  and fetchColumn() vs. fetchOne()
* added executeQuery() and executeStatement() to QueryBuilder
  decorator class

This change adapts most places to help in migrating to Doctrine DBAL
3.x for TYPO3 v12, but also avoids some unneeded deprecations for now.

Resolves: #96247
Releases: main, 11.5
Change-Id: I60e99511efc4f9ec6d8d651c63becff028de4cf2
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/72430

Tested-by: core-ci's avatarcore-ci <typo3@b13.com>
Tested-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
Reviewed-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
parent c2f63b00
......@@ -17,8 +17,7 @@ declare(strict_types=1);
namespace TYPO3\CMS\Backend\Domain\Repository\Localization;
use Doctrine\DBAL\ForwardCompatibility\Result;
use Doctrine\DBAL\Statement;
use Doctrine\DBAL\Result;
use TYPO3\CMS\Backend\Configuration\TranslationConfigurationProvider;
use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
use TYPO3\CMS\Core\Database\Connection;
......@@ -181,7 +180,7 @@ class LocalizationRepository
* @param int $destLanguageId
* @param int $languageId
* @param string $fields
* @return Statement|Result
* @return Result
*/
public function getRecordsToCopyDatabaseResult(int $pageId, int $destLanguageId, int $languageId, string $fields = '*')
{
......
......@@ -222,7 +222,7 @@ class RecordHistory
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable($tablename);
$queryBuilder->getRestrictions()->removeAll();
$rows = $queryBuilder
$result = $queryBuilder
->select('uid')
->from($tablename)
->where(
......@@ -232,11 +232,7 @@ class RecordHistory
)
)
->execute();
$rowCount = (int)$queryBuilder->count('uid')->execute()->fetchOne();
if ($rowCount === 0) {
continue;
}
foreach ($rows as $row) {
while ($row = $result->fetchAssociative()) {
// if there is history data available, merge it into changelog
$newChangeLog = $this->getHistoryDataForRecord($tablename, $row['uid'], $lastHistoryEntry);
if (is_array($newChangeLog) && !empty($newChangeLog)) {
......
......@@ -15,8 +15,7 @@
namespace TYPO3\CMS\Backend\View;
use Doctrine\DBAL\ForwardCompatibility\Result;
use Doctrine\DBAL\Statement;
use Doctrine\DBAL\Result;
use Psr\Log\LoggerAwareInterface;
use Psr\Log\LoggerAwareTrait;
use TYPO3\CMS\Backend\Controller\Page\LocalizationController;
......@@ -861,7 +860,7 @@ class PageLayoutView implements LoggerAwareInterface
);
// Traverse any selected elements and render their display code:
/** @var Statement $result */
/** @var Result $result */
$result = $queryBuilder->execute();
$results = $this->getResult($result);
$unused = [];
......@@ -1552,7 +1551,7 @@ class PageLayoutView implements LoggerAwareInterface
/**
* Traverse the result pointer given, adding each record to array and setting some internal values at the same time.
*
* @param Statement|Result $result DBAL Statement or Result
* @param Result $result DBAL Result
* @return array The selected rows returned in this array.
*/
public function getResult($result): array
......
......@@ -18,7 +18,7 @@ declare(strict_types=1);
namespace TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider;
use Doctrine\DBAL\Exception as DBALException;
use Doctrine\DBAL\Statement;
use Doctrine\DBAL\Result;
use Prophecy\Argument;
use Prophecy\PhpUnit\ProphecyTrait;
use Prophecy\Prophecy\ObjectProphecy;
......@@ -130,8 +130,8 @@ class TcaSelectItemsTest extends UnitTestCase
{
[$queryBuilderProphet, $connectionPoolProphet] = $this->mockDatabaseConnection('foreignTable');
/** @var Statement|ObjectProphecy $statementProphet */
$statementProphet = $this->prophesize(Statement::class);
/** @var Result|ObjectProphecy $statementProphet */
$statementProphet = $this->prophesize(Result::class);
$statementProphet->fetchAssociative()->shouldBeCalled();
$queryBuilderProphet->select('foreignTable.uid')
......@@ -1008,8 +1008,8 @@ class TcaSelectItemsTest extends UnitTestCase
[$queryBuilderProphet, $connectionPoolProphet] = $this->mockDatabaseConnection();
/** @var Statement|ObjectProphecy $statementProphet */
$statementProphet = $this->prophesize(Statement::class);
/** @var Result|ObjectProphecy $statementProphet */
$statementProphet = $this->prophesize(Result::class);
$queryBuilderProphet->select('fTable.uid')->shouldBeCalled()->willReturn($queryBuilderProphet->reveal());
$queryBuilderProphet->from('fTable')->shouldBeCalled()->willReturn($queryBuilderProphet->reveal());
......@@ -1105,8 +1105,8 @@ class TcaSelectItemsTest extends UnitTestCase
[$queryBuilderProphet, $connectionPoolProphet] = $this->mockDatabaseConnection();
/** @var Statement|ObjectProphecy $statementProphet */
$statementProphet = $this->prophesize(Statement::class);
/** @var Result|ObjectProphecy $statementProphet */
$statementProphet = $this->prophesize(Result::class);
$queryBuilderProphet->select('fTable.uid')->shouldBeCalled()->willReturn($queryBuilderProphet->reveal());
$queryBuilderProphet->from('fTable')->shouldBeCalled()->willReturn($queryBuilderProphet->reveal());
......@@ -1213,8 +1213,8 @@ class TcaSelectItemsTest extends UnitTestCase
{
[$queryBuilderProphet, $connectionPoolProphet] = $this->mockDatabaseConnection();
/** @var Statement|ObjectProphecy $statementProphet */
$statementProphet = $this->prophesize(Statement::class);
/** @var Result|ObjectProphecy $statementProphet */
$statementProphet = $this->prophesize(Result::class);
$queryBuilderProphet->select('fTable.uid', 'fTable.labelField')->shouldBeCalled()->willReturn($queryBuilderProphet->reveal());
$queryBuilderProphet->from('fTable')->shouldBeCalled()->willReturn($queryBuilderProphet->reveal());
......@@ -1374,8 +1374,8 @@ class TcaSelectItemsTest extends UnitTestCase
[$queryBuilderProphet, $connectionPoolProphet] = $this->mockDatabaseConnection('sys_file_storage');
/** @var Statement|ObjectProphecy $statementProphet */
$statementProphet = $this->prophesize(Statement::class);
/** @var Result|ObjectProphecy $statementProphet */
$statementProphet = $this->prophesize(Result::class);
$queryBuilderProphet->select('sys_file_storage.uid', 'sys_file_storage.labelField')
->shouldBeCalled()->willReturn($queryBuilderProphet->reveal());
......@@ -1469,8 +1469,8 @@ class TcaSelectItemsTest extends UnitTestCase
[$queryBuilderProphet, $connectionPoolProphet] = $this->mockDatabaseConnection();
/** @var Statement|ObjectProphecy $statementProphet */
$statementProphet = $this->prophesize(Statement::class);
/** @var Result|ObjectProphecy $statementProphet */
$statementProphet = $this->prophesize(Result::class);
$queryBuilderProphet->select('fTable.uid', 'fTable.icon')->shouldBeCalled()->willReturn($queryBuilderProphet->reveal());
$queryBuilderProphet->from('fTable')->shouldBeCalled()->willReturn($queryBuilderProphet->reveal());
......
......@@ -17,7 +17,7 @@ declare(strict_types=1);
namespace TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider;
use Doctrine\DBAL\Statement;
use Doctrine\DBAL\Result;
use Prophecy\Argument;
use Prophecy\PhpUnit\ProphecyTrait;
use Prophecy\Prophecy\ObjectProphecy;
......@@ -67,8 +67,8 @@ class TcaSelectTreeItemsTest extends UnitTestCase
return '`' . $arguments[0] . '`';
});
/** @var Statement|ObjectProphecy $statementProphet */
$statementProphet = $this->prophesize(Statement::class);
/** @var Result|ObjectProphecy $statementProphet */
$statementProphet = $this->prophesize(Result::class);
$statementProphet->fetchAssociative()->shouldBeCalled();
$restrictionProphet = $this->prophesize(DefaultRestrictionContainer::class);
......
......@@ -362,7 +362,7 @@ abstract class AbstractRecordCollection implements RecordCollectionInterface, Pe
->where($queryBuilder->expr()->eq('uid', $queryBuilder->createNamedParameter($id, \PDO::PARAM_INT)))
->execute()
->fetchAssociative();
return self::create($collectionRecord, $fillItems);
return self::create($collectionRecord ?: [], $fillItems);
}
/**
......
......@@ -8716,7 +8716,7 @@ class DataHandler implements LoggerAwareInterface
$queryBuilder->expr()->eq('t3ver_oid', 0)
)
->execute()
->fetchColumn();
->fetchOne();
if ($count === 0) {
$clearCacheEnabled = false;
}
......
......@@ -888,7 +888,7 @@ class DataMapProcessor
->execute();
$translationValues = [];
foreach ($statement as $record) {
while ($record = $statement->fetchAssociative()) {
$translationValues[$record['uid']] = $record;
}
return $translationValues;
......@@ -1141,7 +1141,7 @@ class DataMapProcessor
->execute();
$dependentElements = [];
foreach ($statement as $record) {
while ($record = $statement->fetchAssociative()) {
$dependentElements[] = $record;
}
return $dependentElements;
......
......@@ -21,10 +21,9 @@ use Doctrine\Common\EventManager;
use Doctrine\DBAL\Configuration;
use Doctrine\DBAL\Driver;
use Doctrine\DBAL\Driver\ServerInfoAwareConnection;
use Doctrine\DBAL\Driver\Statement;
use Doctrine\DBAL\ForwardCompatibility\Result;
use Doctrine\DBAL\Platforms\PostgreSQL94Platform as PostgreSqlPlatform;
use Doctrine\DBAL\Platforms\SQLServer2012Platform;
use Doctrine\DBAL\Result;
use Doctrine\DBAL\VersionAwarePlatformDriver;
use Psr\Log\LoggerAwareInterface;
use Psr\Log\LoggerAwareTrait;
......@@ -246,7 +245,7 @@ class Connection extends \Doctrine\DBAL\Connection implements LoggerAwareInterfa
* @param int $limit The maximum number of rows to return.
* @param int $offset The first result row to select (when used with limit)
*
* @return Statement|Result The executed statement.
* @return Result The executed statement.
*/
public function select(
array $columns,
......
......@@ -17,15 +17,14 @@ declare(strict_types=1);
namespace TYPO3\CMS\Core\Database\Query;
use Doctrine\DBAL\Driver\ResultStatement;
use Doctrine\DBAL\Driver\Statement;
use Doctrine\DBAL\ForwardCompatibility\Result;
use Doctrine\DBAL\DBALException;
use Doctrine\DBAL\Platforms\MySqlPlatform;
use Doctrine\DBAL\Platforms\OraclePlatform;
use Doctrine\DBAL\Platforms\PostgreSQL94Platform as PostgreSqlPlatform;
use Doctrine\DBAL\Platforms\SqlitePlatform;
use Doctrine\DBAL\Platforms\SQLServer2012Platform as SQLServerPlatform;
use Doctrine\DBAL\Query\Expression\CompositeExpression;
use Doctrine\DBAL\Result;
use TYPO3\CMS\Core\Database\Connection;
use TYPO3\CMS\Core\Database\Query\Expression\ExpressionBuilder;
use TYPO3\CMS\Core\Database\Query\Restriction\DefaultRestrictionContainer;
......@@ -206,24 +205,80 @@ class QueryBuilder
/**
* Executes this query using the bound parameters and their types.
*
* @return Statement|Result|ResultStatement|int
* doctrine/dbal decided to split execute() into executeQuery() and
* executeStatement() for doctrine/dbal:^3.0, like it was done on
* connection level already, thus these methods are added to this
* decorator class also as preparation for extension authors, that
* they are able to write code which is compatible across two core
* versions and avoid deprecation warning. Additional this will ease
* backport without the need to switch if execute() is not used anymore.
*
* It is recommended to use directly executeQuery() for 'SELECT' and
* executeStatement() for 'INSERT', 'UPDATE' and 'DELETE' queries.
*
* @return Result|int
* @throws DBALException
* @todo Deprecate in v12 along with raise to min doctrine/dbal:^3.2 to align with doctrine/dbal deprecation.
*/
public function execute()
{
if ($this->getType() !== \Doctrine\DBAL\Query\QueryBuilder::SELECT) {
return $this->concreteQueryBuilder->execute();
return $this->executeStatement();
}
return $this->executeQuery();
}
/**
* Executes an SQL query (SELECT) and returns a Result.
*
* doctrine/dbal decided to split execute() into executeQuery() and
* executeStatement() for doctrine/dbal:^3.0, like it was done on
* connection level already, thus these methods are added to this
* decorator class also as preparation for extension authors, that
* they are able to write code which is compatible across two core
* versions and avoid deprecation warning. Additional this will ease
* backport without the need to switch if execute() is not used anymore.
*
* @throws DBALException
*/
public function executeQuery(): Result
{
// Set additional query restrictions
$originalWhereConditions = $this->addAdditionalWhereConditions();
$result = $this->concreteQueryBuilder->execute();
// @todo Call $this->concreteQueryBuilder->executeQuery()
// directly with doctrine/dbal:^3.2 raise in v12.
$return = $this->concreteQueryBuilder->execute();
// Restore the original query conditions in case the user keeps
// on modifying the state.
$this->concreteQueryBuilder->add('where', $originalWhereConditions, false);
return $result;
return $return;
}
/**
* Executes an SQL statement (INSERT, UPDATE and DELETE) and returns
* the number of affected rows.
*
* doctrine/dbal decided to split execute() into executeQuery() and
* executeStatement() for doctrine/dbal:^3.0, like it was done on
* connection level already, thus these methods are added to this
* decorator class also as preparation for extension authors, that
* they are able to write code which is compatible across two core
* versions and avoid deprecation warning. Additional this will ease
* backport without the need to switch if execute() is not used anymore.
*
* @return int The number of affected rows.
*
* @throws DBALException
*/
public function executeStatement(): int
{
// @todo Call $this->concreteQueryBuilder->executeStatement()
// directly with doctrine/dbal:^3.2 raise in v12.
return $this->concreteQueryBuilder->execute();
}
/**
......@@ -693,6 +748,12 @@ class QueryBuilder
*/
public function where(...$predicates): QueryBuilder
{
// Doctrine DBAL 3.x requires a non-empty $predicate, however TYPO3 uses static values
// such as PageRepository->$where_hid_del which could be empty
$predicates = array_filter($predicates);
if (empty($predicates)) {
return $this;
}
$this->concreteQueryBuilder->where(...$predicates);
return $this;
......@@ -710,6 +771,12 @@ class QueryBuilder
*/
public function andWhere(...$where): QueryBuilder
{
// Doctrine DBAL 3.x requires a non-empty $predicate, however TYPO3 uses static values
// such as PageRepository->$where_hid_del which could be empty
$where = array_filter($where);
if (empty($where)) {
return $this;
}
$this->concreteQueryBuilder->andWhere(...$where);
return $this;
......@@ -727,6 +794,12 @@ class QueryBuilder
*/
public function orWhere(...$where): QueryBuilder
{
// Doctrine DBAL 3.x requires a non-empty $predicate, however TYPO3 uses static values
// such as PageRepository->$where_hid_del which could be empty
$where = array_filter($where);
if (empty($where)) {
return $this;
}
$this->concreteQueryBuilder->orWhere(...$where);
return $this;
......
......@@ -650,7 +650,7 @@ class QueryView
$markup[] = htmlspecialchars($this->languageService->sL($conf['ctrl']['title'])) . ' (' . $count . ')';
$markup[] = ' </div>';
$markup[] = ' <table class="table table-striped table-hover">';
$markup[] = $this->resultRowTitles($lastRow, $conf);
$markup[] = $this->resultRowTitles((array)$lastRow, $conf);
$markup[] = implode(LF, $rowArr);
$markup[] = ' </table>';
$markup[] = '</div>';
......
......@@ -55,7 +55,7 @@ class Comparator extends \Doctrine\DBAL\Schema\Comparator
*
* @param \Doctrine\DBAL\Schema\Table $fromTable
* @param \Doctrine\DBAL\Schema\Table $toTable
* @return bool|\Doctrine\DBAL\Schema\TableDiff|\TYPO3\CMS\Core\Database\Schema\TableDiff
* @return false|\Doctrine\DBAL\Schema\TableDiff|\TYPO3\CMS\Core\Database\Schema\TableDiff
* @throws \InvalidArgumentException
*/
public function diffTable(Table $fromTable, Table $toTable)
......
......@@ -300,8 +300,7 @@ class ConnectionMigrator
// columns, indexes and foreign_keys. Order of definitions is based on
// extension load order.
$currentTableDefinition = $tablesForConnection[$tableName];
$tablesForConnection[$tableName] = GeneralUtility::makeInstance(
Table::class,
$tablesForConnection[$tableName] = new Table(
$tableName,
array_merge($currentTableDefinition->getColumns(), $table->getColumns()),
array_merge($currentTableDefinition->getIndexes(), $table->getIndexes()),
......@@ -453,8 +452,7 @@ class ConnectionMigrator
}
$tableOptions = $tableDiff->getTableOptions();
$tableOptionsDiff = GeneralUtility::makeInstance(
TableDiff::class,
$tableOptionsDiff = new TableDiff(
$tableDiff->name,
[],
[],
......@@ -1171,8 +1169,7 @@ class ConnectionMigrator
);
}
$table = GeneralUtility::makeInstance(
Table::class,
$table = new Table(
$table->getQuotedName($connection->getDatabasePlatform()),
$table->getColumns(),
$indexes,
......@@ -1257,8 +1254,7 @@ class ConnectionMigrator
{
$databasePlatform = $this->connection->getDatabasePlatform();
return GeneralUtility::makeInstance(
Table::class,
return new Table(
$databasePlatform->quoteIdentifier($table->getName()),
$table->getColumns(),
$table->getIndexes(),
......
......@@ -598,7 +598,7 @@ class DefaultTcaSchema
'string',
[
'default' => '',
'size' => 255,
'length' => 255,
'notnull' => true,
]
);
......@@ -609,7 +609,7 @@ class DefaultTcaSchema
'string',
[
'default' => '',
'size' => 255,
'length' => 255,
'notnull' => true,
]
);
......
......@@ -18,6 +18,7 @@ declare(strict_types=1);
namespace TYPO3\CMS\Core\Database\Schema\EventListener;
use Doctrine\DBAL\Event\SchemaIndexDefinitionEventArgs;
use Doctrine\DBAL\Platforms\MySqlPlatform;
use Doctrine\DBAL\Schema\Index;
use TYPO3\CMS\Core\Utility\GeneralUtility;
......@@ -38,13 +39,14 @@ class SchemaIndexDefinitionListener
*/
public function onSchemaIndexDefinition(SchemaIndexDefinitionEventArgs $event)
{
if (strpos((string)$event->getConnection()->getServerVersion(), 'MySQL') !== 0) {
// Early return for non-MySQL-compatible platforms
if (!($event->getConnection()->getDatabasePlatform() instanceof MySqlPlatform)) {
return;
}
$connection = $event->getConnection();
$indexName = $event->getTableIndex()['name'];
$sql = $event->getDatabasePlatform()->getListTableIndexesSQL(
$sql = $event->getConnection()->getDatabasePlatform()->getListTableIndexesSQL(
$event->getTable(),
$event->getConnection()->getDatabase()
);
......
......@@ -256,8 +256,7 @@ class TableBuilder
$index->addFlag('spatial');
}
$this->table = GeneralUtility::makeInstance(
Table::class,
$this->table = new Table(
$this->table->getQuotedName($this->platform),
$this->table->getColumns(),
array_merge($this->table->getIndexes(), [strtolower($indexName) => $index]),
......
......@@ -17,9 +17,7 @@ declare(strict_types=1);
namespace TYPO3\CMS\Core\Resource\Search;
use Doctrine\DBAL\Driver\ResultStatement;
use Doctrine\DBAL\Driver\Statement;
use Doctrine\DBAL\ForwardCompatibility\Result;
use Doctrine\DBAL\Result;
use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\Database\Query\QueryBuilder;
use TYPO3\CMS\Core\Database\Query\QueryHelper;
......@@ -53,7 +51,7 @@ class FileSearchQuery
private $additionalRestrictions = [];
/**
* @var Statement|Result|ResultStatement|int
* @var Result|int
*/
private $result;
......
......@@ -17,7 +17,7 @@ declare(strict_types=1);
namespace TYPO3\CMS\Core\Tests\Unit\Configuration\FlexForm;
use Doctrine\DBAL\Statement;
use Doctrine\DBAL\Result;
use Prophecy\Argument;
use Prophecy\PhpUnit\ProphecyTrait;
use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
......@@ -574,7 +574,7 @@ class FlexFormToolsTest extends UnitTestCase
$queryRestrictionContainerProphecy = $this->prophesize(QueryRestrictionContainerInterface::class);
$queryRestrictionContainerRevelation = $queryRestrictionContainerProphecy->reveal();
$expressionBuilderProphecy = $this->prophesize(ExpressionBuilder::class);
$statementProphecy = $this->prophesize(Statement::class);
$statementProphecy = $this->prophesize(Result::class);
// Register connection pool revelation in framework, this is the entry point used by system under test
GeneralUtility::addInstance(ConnectionPool::class, $connectionPoolProphecy->reveal());
......@@ -635,7 +635,7 @@ class FlexFormToolsTest extends UnitTestCase
$queryRestrictionContainerProphecy = $this->prophesize(QueryRestrictionContainerInterface::class);
$queryRestrictionContainerRevelation = $queryRestrictionContainerProphecy->reveal();
$expressionBuilderProphecy = $this->prophesize(ExpressionBuilder::class);
$statementProphecy = $this->prophesize(Statement::class);
$statementProphecy = $this->prophesize(Result::class);
// Register connection pool revelation in framework, this is the entry point used by system under test
// Two queries are done, so we need two instances
......@@ -704,7 +704,7 @@ class FlexFormToolsTest extends UnitTestCase
$queryRestrictionContainerProphecy = $this->prophesize(QueryRestrictionContainerInterface::class);
$queryRestrictionContainerRevelation = $queryRestrictionContainerProphecy->reveal();
$expressionBuilderProphecy = $this->prophesize(ExpressionBuilder::class);
$statementProphecy = $this->prophesize(Statement::class);
$statementProphecy = $this->prophesize(Result::class);
// Register connection pool revelation in framework, this is the entry point used by system under test
// Two queries are done, so we need two instances
......@@ -846,7 +846,7 @@ class FlexFormToolsTest extends UnitTestCase
$queryRestrictionContainerProphecy = $this->prophesize(QueryRestrictionContainerInterface::class);
$queryRestrictionContainerRevelation = $queryRestrictionContainerProphecy->reveal();
$expressionBuilderProphecy = $this->prophesize(ExpressionBuilder::class);
$statementProphecy = $this->prophesize(Statement::class);
$statementProphecy = $this->prophesize(Result::class);
// Register connection pool revelation in framework, this is the entry point used by system under test
// Two queries are done, so we need two instances
......@@ -909,7 +909,7 @@ class FlexFormToolsTest extends UnitTestCase
$queryRestrictionContainerProphecy = $this->prophesize(QueryRestrictionContainerInterface::class);
$queryRestrictionContainerRevelation = $queryRestrictionContainerProphecy->reveal();
$expressionBuilderProphecy = $this->prophesize(ExpressionBuilder::class);
$statementProphecy = $this->prophesize(Statement::class);
$statementProphecy = $this->prophesize(Result::class);
// Register connection pool revelation in framework, this is the entry point used by system under test
// Two queries are done, so we need two instances
......@@ -971,7 +971,7 @@ class FlexFormToolsTest extends UnitTestCase
$queryRestrictionContainerProphecy = $this->prophesize(QueryRestrictionContainerInterface::class);
$queryRestrictionContainerRevelation = $queryRestrictionContainerProphecy->reveal();
$expressionBuilderProphecy = $this->prophesize(ExpressionBuilder::class);
$statementProphecy = $this->prophesize(Statement::class);
$statementProphecy = $this->prophesize(Result::class);
// Register connection pool revelation in framework, this is the entry point used by system under test
// Two queries are done, so we need two instances
......@@ -1055,7 +1055,7 @@ class FlexFormToolsTest extends UnitTestCase
$queryRestrictionContainerProphecy = $this->prophesize(QueryRestrictionContainerInterface::class);
$queryRestrictionContainerRevelation = $queryRestrictionContainerProphecy->reveal();
$expressionBuilderProphecy = $this->prophesize(ExpressionBuilder::class);
$statementProphecy = $this->prophesize(Statement::class);
$statementProphecy = $this->prophesize(Result::class);
// Register connection pool revelation in framework, this is the entry point used by system under test
// Two queries are done, so we need two instances
......@@ -1254,7 +1254,7 @@ class FlexFormToolsTest extends UnitTestCase
$queryRestrictionContainerProphecy = $this->prophesize(QueryRestrictionContainerInterface::class);
$queryRestrictionContainerRevelation = $queryRestrictionContainerProphecy->reveal();
$expressionBuilderProphecy = $this->prophesize(ExpressionBuilder::class);
$statementProphecy = $this->prophesize(Statement::class);
$statementProphecy = $this->prophesize(Result::class);
// Register connection pool revelation in framework, this is the entry point used by system under test
GeneralUtility::addInstance(ConnectionPool::class, $connectionPoolProphecy->reveal());
......
......@@ -20,11 +20,10 @@ namespace TYPO3\CMS\Core\Tests\Unit\Database;
use Doctrine\DBAL\Configuration;
use Doctrine\DBAL\Driver\Mysqli\Driver;
use Doctrine\DBAL\Driver\Mysqli\MysqliConnection;
use Doctrine\DBAL\Driver\ResultStatement;
use Doctrine\DBAL\Driver\ServerInfoAwareConnection;
use Doctrine\DBAL\ForwardCompatibility\Result;
use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Platforms\MySqlPlatform;
use Doctrine\DBAL\Statement;