From 81dfede616100c991b8cce13b393225a2c07db7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20B=C3=BCrk?= <stefan@buerk.tech> Date: Tue, 21 Dec 2021 07:02:25 +0100 Subject: [PATCH] [BUGFIX] Remove failing and superflous test for QueryHelper With #96393 forward-compatible prepared statement support has been added to QueryBuilder and also provided several tests to covers this implementation. However one test tests doctrine/dbal behaviour for 'Statement->bindValue()' which behaves differently accross drivers and platforms, emitting different exception types or need an additional execute. This patch removes this test as it is not the job of core testing to test 3rd party code and inconsistent behaviour. Removed test were already removed on backport for #96393. Resolves: #96408 Related: #96393 Releases: main Change-Id: I35d65171dda9fbcc91c906708324997006e21c67 Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/72752 Tested-by: core-ci <typo3@b13.com> Tested-by: Benni Mack <benni@typo3.org> Reviewed-by: Benni Mack <benni@typo3.org> --- ...sitionPlaceholderPreparedStatementTest.php | 38 +------------------ 1 file changed, 1 insertion(+), 37 deletions(-) diff --git a/typo3/sysext/core/Tests/Functional/Database/Query/QueryBuilder/PositionPlaceholderPreparedStatementTest.php b/typo3/sysext/core/Tests/Functional/Database/Query/QueryBuilder/PositionPlaceholderPreparedStatementTest.php index 3121922c07a2..486cf7f50fed 100644 --- a/typo3/sysext/core/Tests/Functional/Database/Query/QueryBuilder/PositionPlaceholderPreparedStatementTest.php +++ b/typo3/sysext/core/Tests/Functional/Database/Query/QueryBuilder/PositionPlaceholderPreparedStatementTest.php @@ -17,14 +17,12 @@ declare(strict_types=1); namespace TYPO3\CMS\Core\Tests\Functional\Database\Query\QueryBuilder; -use Doctrine\DBAL\Exception\DriverException; use Doctrine\DBAL\ParameterType; use Doctrine\DBAL\Statement; use TYPO3\CMS\Core\Cache\CacheManager; use TYPO3\CMS\Core\Database\Connection; use TYPO3\CMS\Core\Database\ConnectionPool; use TYPO3\CMS\Core\Database\Query\QueryBuilder; -use TYPO3\CMS\Core\Database\Query\QueryHelper; use TYPO3\CMS\Core\Database\Query\Restriction\DeletedRestriction; use TYPO3\CMS\Core\Database\Query\UnsupportedPreparedStatementParameterTypeException; use TYPO3\CMS\Core\Utility\GeneralUtility; @@ -254,7 +252,7 @@ class PositionPlaceholderPreparedStatementTest extends FunctionalTestCase ->removeAll() ->add(GeneralUtility::makeInstance(DeletedRestriction::class)); - // prepare should result in exception, thus no forther execution with it + // prepare should result in exception, thus no further execution with it $queryBuilder ->select(...['*']) ->from('pages') @@ -270,38 +268,4 @@ class PositionPlaceholderPreparedStatementTest extends FunctionalTestCase ->addOrderBy('uid', 'ASC') ->prepare(); } - - /** - * @test - * @dataProvider invalidParameterTypesForPreparedStatements - */ - public function preparedStatementThrowsDoctrineExceptionIfInvalidParameterTypeIsUsedOnBindValue(int $arrayParameterType, string $arrayParameterName, array $arrayValues): void - { - // expected exception - $this->expectException(DriverException::class); - - $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class) - ->getQueryBuilderForTable('pages'); - $queryBuilder->getRestrictions() - ->removeAll() - ->add(GeneralUtility::makeInstance(DeletedRestriction::class)); - - // prepare should result in exception, thus no forther execution with it - $statement = $queryBuilder - ->select(...['*']) - ->from('pages') - ->where( - $queryBuilder->expr()->in( - 'pid', - $queryBuilder->createPositionalParameter(QueryHelper::implodeToIntQuotedValueList($arrayValues, $queryBuilder->getConnection())) - ) - ) - ->orderBy('sorting', 'ASC') - // add deterministic sort order as last sorting information, which many dbms - // and version does it by itself, but not all. - ->addOrderBy('uid', 'ASC') - ->prepare(); - - $statement->bindValue(1, $arrayValues, $arrayParameterType); - } } -- GitLab