Commit 8cc94d14 authored by crell's avatar crell Committed by Benni Mack
Browse files

[BUGFIX] Remove test data mangling in PHP 8.1 for SQLite

SQLite returns the correct type information now, so this workaround
is not necessary.

As long as we are not on php 8.1 as min requirement, use a version
check to disable the workaround for sqlite and php >8.1.

After 8.1 as minimum requirement the workaround method should be
removed at all.

Resolves: #95153
Releases: master
Change-Id: I8545d9eb847eacd13a4514034fab37cdb9a5d192
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/71238

Tested-by: core-ci's avatarcore-ci <typo3@b13.com>
Tested-by: Stefan Bürk's avatarStefan Bürk <stefan@buerk.tech>
Tested-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
Reviewed-by: Oliver Klee's avatarOliver Klee <typo3-coding@oliverklee.de>
Reviewed-by: Stefan Bürk's avatarStefan Bürk <stefan@buerk.tech>
Reviewed-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
parent fc763bd4
......@@ -99,16 +99,20 @@ abstract class AbstractImportExportTestCase extends FunctionalTestCase
* Asserts that two XML documents are equal.
*
* @todo: This is a hack to align 'expected' fixture files on sqlite: sqlite returns integer
* fields as string, so the exported xml miss the 'type="integer"' attribute.
* This change drops 'type="integer"' from the expectations if on sqlite.
* This needs to be changed in impexp, after that this helper method can vanish again.
* fields as string, so the exported xml miss the 'type="integer"' attribute.
* This change drops 'type="integer"' from the expectations if on sqlite.
* This needs to be changed in impexp, after that this helper method can vanish again.
* SQLite also now returns the correct type as of PHP 8.1, so the string mangling
* is no longer necessary.
*
* @todo: Remove this workaround method after minimum php version requirement is set to >8.1.
*/
public function assertXmlStringEqualsXmlFileWithIgnoredSqliteTypeInteger(string $expectedFile, string $actualXml): void
{
$actual = (new XmlLoader())->load($actualXml);
$expectedFileContent = file_get_contents($expectedFile);
$databasePlatform = $this->getConnectionPool()->getConnectionForTable('pages')->getDatabasePlatform();
if ($databasePlatform instanceof SqlitePlatform) {
if ((PHP_VERSION_ID < 80100) && $databasePlatform instanceof SqlitePlatform) {
$expectedFileContent = str_replace(' type="integer"', '', $expectedFileContent);
}
$expected = (new XmlLoader())->load($expectedFileContent);
......
Markdown is supported
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