Skip to content

Commit ca77523

Browse files
committed
[TASK] Enable strict mode for acceptance tests
1 parent dbd0357 commit ca77523

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

Classes/Core/Acceptance/Extension/BackendEnvironment.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,16 @@ public function bootstrapTypo3Environment(SuiteEvent $suiteEvent)
283283
$localConfiguration['DB']['Connections']['Default']['charset'] = 'utf8mb4';
284284
$localConfiguration['DB']['Connections']['Default']['defaultTableOptions']['charset'] = 'utf8mb4';
285285
$localConfiguration['DB']['Connections']['Default']['defaultTableOptions']['collation'] = 'utf8mb4_unicode_ci';
286+
// Ensure to run the DB connection in strict mode
287+
$localConfiguration['DB']['Connections']['Default']['initCommands'] = 'SET SESSION sql_mode = \'' . implode(',', [
288+
'STRICT_ALL_TABLES',
289+
'ERROR_FOR_DIVISION_BY_ZERO',
290+
'NO_AUTO_VALUE_ON_ZERO',
291+
'NO_ENGINE_SUBSTITUTION',
292+
'NO_ZERO_DATE',
293+
'NO_ZERO_IN_DATE',
294+
'ONLY_FULL_GROUP_BY',
295+
]) . '\';';
286296
}
287297
} else {
288298
// sqlite dbs of all tests are stored in a dir parallel to instance roots. Allows defining this path as tmpfs.
@@ -301,8 +311,6 @@ public function bootstrapTypo3Environment(SuiteEvent $suiteEvent)
301311
$localConfiguration['SYS']['errorHandlerErrors'] = E_ALL;
302312
$localConfiguration['SYS']['trustedHostsPattern'] = '.*';
303313
$localConfiguration['SYS']['encryptionKey'] = 'iAmInvalid';
304-
// @todo: This sql_mode should be enabled as soon as styleguide and dataHandler can cope with it
305-
//$localConfiguration['SYS']['setDBinit'] = 'SET SESSION sql_mode = \'STRICT_ALL_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_VALUE_ON_ZERO,NO_ENGINE_SUBSTITUTION,NO_ZERO_DATE,NO_ZERO_IN_DATE,ONLY_FULL_GROUP_BY\';';
306314
$localConfiguration['GFX']['processor'] = 'GraphicsMagick';
307315
$testbase->setUpLocalConfiguration($instancePath, $localConfiguration, $this->config['configurationToUseInTestInstance']);
308316
$frameworkExtensionPaths = [];

0 commit comments

Comments
 (0)