Skip to content
Snippets Groups Projects
Commit 81dfede6 authored by Stefan Bürk's avatar Stefan Bürk Committed by Benni Mack
Browse files

[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: default avatarcore-ci <typo3@b13.com>
Tested-by: default avatarBenni Mack <benni@typo3.org>
Reviewed-by: default avatarBenni Mack <benni@typo3.org>
parent aece622c
Branches
Tags
No related merge requests found
...@@ -17,14 +17,12 @@ declare(strict_types=1); ...@@ -17,14 +17,12 @@ declare(strict_types=1);
namespace TYPO3\CMS\Core\Tests\Functional\Database\Query\QueryBuilder; namespace TYPO3\CMS\Core\Tests\Functional\Database\Query\QueryBuilder;
use Doctrine\DBAL\Exception\DriverException;
use Doctrine\DBAL\ParameterType; use Doctrine\DBAL\ParameterType;
use Doctrine\DBAL\Statement; use Doctrine\DBAL\Statement;
use TYPO3\CMS\Core\Cache\CacheManager; use TYPO3\CMS\Core\Cache\CacheManager;
use TYPO3\CMS\Core\Database\Connection; use TYPO3\CMS\Core\Database\Connection;
use TYPO3\CMS\Core\Database\ConnectionPool; use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\Database\Query\QueryBuilder; 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\Restriction\DeletedRestriction;
use TYPO3\CMS\Core\Database\Query\UnsupportedPreparedStatementParameterTypeException; use TYPO3\CMS\Core\Database\Query\UnsupportedPreparedStatementParameterTypeException;
use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Core\Utility\GeneralUtility;
...@@ -254,7 +252,7 @@ class PositionPlaceholderPreparedStatementTest extends FunctionalTestCase ...@@ -254,7 +252,7 @@ class PositionPlaceholderPreparedStatementTest extends FunctionalTestCase
->removeAll() ->removeAll()
->add(GeneralUtility::makeInstance(DeletedRestriction::class)); ->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 $queryBuilder
->select(...['*']) ->select(...['*'])
->from('pages') ->from('pages')
...@@ -270,38 +268,4 @@ class PositionPlaceholderPreparedStatementTest extends FunctionalTestCase ...@@ -270,38 +268,4 @@ class PositionPlaceholderPreparedStatementTest extends FunctionalTestCase
->addOrderBy('uid', 'ASC') ->addOrderBy('uid', 'ASC')
->prepare(); ->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);
}
} }
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment