[BUGFIX] Ensure proper quoting of fields for PostgreSQL in JsonRenderer.ts 69/51569/3
authorMorton Jonuschat <m.jonuschat@mojocode.de>
Wed, 8 Feb 2017 03:49:20 +0000 (19:49 -0800)
committerChristian Kuhn <lolli@schwarzbu.ch>
Thu, 16 Feb 2017 12:47:52 +0000 (13:47 +0100)
PostgreSQL requires mixed case column names in the database to be quoted at
all times, otherwise the name of the column will be forcefully converted to
all lowercase.

Set a constant in the testrenderer that contains the current database type
and switch the WHERE condition in JsonRenderer.ts to a properly quoted
version for PostgreSQL

Change-Id: I0b7caf4b51006bdf3bc131d995b0993504f49889
Releases: master
Resolves: #79651
Reviewed-on: https://review.typo3.org/51569
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Tymoteusz Motylewski <t.motylewski@gmail.com>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
components/testing_framework/Classes/Core/Functional/FunctionalTestCase.php
typo3/sysext/core/Tests/Functional/Fixtures/Frontend/JsonRenderer.ts

index c81b65b..acee9b1 100644 (file)
@@ -14,6 +14,7 @@ namespace TYPO3\Components\TestingFramework\Core\Functional;
  * The TYPO3 project - inspiring people to share!
  */
 
+use Doctrine\DBAL\Platforms\PostgreSqlPlatform;
 use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
 use TYPO3\CMS\Core\Cache\Backend\NullBackend;
 use TYPO3\CMS\Core\Database\ConnectionPool;
@@ -349,6 +350,11 @@ abstract class FunctionalTestCase extends BaseTestCase
             $this->fail('Cannot set up frontend root page "' . $pageId . '"');
         }
 
+        $databasePlatform = 'mysql';
+        if ($connection->getDatabasePlatform() instanceof PostgreSqlPlatform) {
+            $databasePlatform = 'postgresql';
+        }
+
         $connection->update(
             'pages',
             ['is_siteroot' => 1],
@@ -358,6 +364,7 @@ abstract class FunctionalTestCase extends BaseTestCase
         $templateFields = [
             'pid' => $pageId,
             'title' => '',
+            'constants' => 'databasePlatform = ' . $databasePlatform . LF,
             'config' => '',
             'clear' => 3,
             'root' => 1,
index f2f4e95..2d7e6de 100644 (file)
@@ -238,6 +238,13 @@ page {
        stdWrap.postUserFunc = TYPO3\Components\TestingFramework\Core\Functional\Framework\Frontend\Renderer->renderSections
 }
 
+[globalVar = LIT:postgresql = {$databasePlatform}]
+page.10.20.select.where = "colPos" = 0
+page.10.20.renderObj.20.select.where.wrap = "parenttable" = 'tt_content' AND "parentid" = |
+page.10.20.renderObj.20.renderObj.10.select.where.wrap = "parenttable" = 'tx_irretutorial_1nff_hotel' AND "parentid" = |
+page.10.20.renderObj.20.renderObj.10.renderObj.10.select.where.wrap = "parenttable" = 'tx_irretutorial_1nff_offer' AND "parentid" = |
+[end]
+
 [globalVar = GP:L = 1]
 config.sys_language_uid = 1
 [end]