[FOLLOWUP][BUGFIX] Respect SQL table names max length in install tool 65/50865/2
authorAnja Leichsenring <aleichsenring@ab-softlab.de>
Sat, 3 Dec 2016 08:27:03 +0000 (09:27 +0100)
committerJan Helke <typo3@helke.de>
Sat, 3 Dec 2016 08:50:31 +0000 (09:50 +0100)
Respect the max length of 64 chars in sql if removing (renaming)
an SQL table. Add unit test.

Resolves: #78636
Releases: master
Change-Id: I94f38c40f6539d5e53e2ac9bad5ed1c059836333
Reviewed-on: https://review.typo3.org/50865
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Manuel Glauser <mail@manuelglauser.ch>
Tested-by: Manuel Glauser <mail@manuelglauser.ch>
Reviewed-by: Jan Helke <typo3@helke.de>
Tested-by: Jan Helke <typo3@helke.de>
typo3/sysext/core/Tests/Unit/Database/Schema/ConnectionMigratorTest.php

index 207b320..3f9e6d6 100644 (file)
@@ -34,6 +34,7 @@ class ConnectionMigratorTest extends UnitTestCase
      */
     public function tableNamesStickToTheMaximumCharactersWhenPrefixedForRemoval()
     {
+        $maxTableNameLength = 64;
         $ridiculouslyLongTableName = 'table_name_that_is_ridiculously_long_' . random_bytes(200);
         $tableMock = $this->getAccessibleMock(Table::class, ['getQuotedName'], [$ridiculouslyLongTableName]);
         $tableMock->expects($this->any())->method('getQuotedName')->withAnyParameters()->will($this->returnValue($ridiculouslyLongTableName));
@@ -52,8 +53,8 @@ class ConnectionMigratorTest extends UnitTestCase
 
         $this->assertStringStartsWith('zzz_deleted_', $renamedSchemaDiff->changedTables[0]->newName);
         $this->assertLessThanOrEqual(
-            strlen($renamedSchemaDiff->changedTables[0]->newName),
-            $this->maxTableNameLength
+            $maxTableNameLength,
+            strlen($renamedSchemaDiff->changedTables[0]->newName)
         );
     }
 }