[BUGFIX] DefaultTcaSchema must not create SQL for tables not requested 54/62154/7
authorMarkus Klein <markus.klein@typo3.org>
Tue, 29 Oct 2019 13:32:55 +0000 (14:32 +0100)
committerDaniel Goerz <daniel.goerz@posteo.de>
Sun, 12 Jan 2020 13:00:22 +0000 (14:00 +0100)
The DefaultTcaSchema::enrich() function dynamically adds TCA-defined
ctrl-fields to the SQL schema definition for a provided set of tables.

The function used to add these definition for any table that is defined
in TCA, independent whether the table actually exists in any
ext_tables.sql file.
While this behaviour is no problem under the assumption that the
function is always called with the content of all ext_tables.sql files,
this is a problem if the function is called with only a subset of those
ext_tables.sql files. One example is the "extension manager tables"
upgrade in the Install Tool.

Despite the fact that the function was documented that it needs to be
called with the full set of tables, it actually is not strictly
necessary to do so.

This patch changes the requirement for the enrich() function and
changes the behaviour to not dynamically create tables if those are
found in TCA.

Technical detail to the reported bug:
The table definitions created by this class are usually overruled by
whatever might be defined in an ext_tables.sql file. In case of the
upgrade wizard (where only extension manager tables are requested) the
table definitions for all TCA tables were created based on the best
practice suggestions from the core. If the present DB schema (created by
the real ext_tables.sql files) mismatched those suggested definitions a
DB schema change was proposed, hence the wizard kept popping up.

Resolves: #89535
Releases: master, 9.5
Change-Id: I78594f1ee0878e8d3f5606901d0abb7fe0023059
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/62154
Tested-by: TYPO3com <noreply@typo3.com>
Tested-by: Benni Mack <benni@typo3.org>
Tested-by: Daniel Goerz <daniel.goerz@posteo.de>
Reviewed-by: Benni Mack <benni@typo3.org>
Reviewed-by: Daniel Goerz <daniel.goerz@posteo.de>
typo3/sysext/core/Classes/Database/Schema/DefaultTcaSchema.php
typo3/sysext/core/Tests/Unit/Database/Schema/DefaultTcaSchemaSqliteTest.php
typo3/sysext/core/Tests/Unit/Database/Schema/DefaultTcaSchemaTest.php

index 38e6452..fe3ce1a 100644 (file)
@@ -42,8 +42,6 @@ class DefaultTcaSchema
      * "soft delete" ['ctrl']['delete'] and adds the field if it has not been
      * defined in ext_tables.sql, yet.
      *
-     * Note the incoming $tables array must be created from all ext_tables.sql files
-     * of all loaded extensions, and TCA must be up-to-date.
      *
      * @param Table[] $tables
      * @return Table[]
@@ -52,21 +50,16 @@ class DefaultTcaSchema
     {
         foreach ($GLOBALS['TCA'] as $tableName => $tableDefinition) {
             $isTableDefined = $this->isTableDefined($tables, $tableName);
-            $tablePosition = null;
-            if ($isTableDefined) {
-                // If the table is given in existing $tables list, add all fields to the first
-                // position of that table - in case it is in there multiple times which happens
-                // if extensions add single fields to tables that have been defined in
-                // other ext_tables.sql, too.
-                $tablePosition = $this->getTableFirstPosition($tables, $tableName);
-            } else {
-                // Else create this table and add it to table list
-                $table = GeneralUtility::makeInstance(Table::class, $tableName);
-                $tables[] = $table;
-                $tableKeys = array_keys($tables);
-                $tablePosition = end($tableKeys);
+            if (!$isTableDefined) {
+                continue;
             }
 
+            // If the table is given in existing $tables list, add all fields to the first
+            // position of that table - in case it is in there multiple times which happens
+            // if extensions add single fields to tables that have been defined in
+            // other ext_tables.sql, too.
+            $tablePosition = $this->getTableFirstPosition($tables, $tableName);
+
             // uid column and primary key if uid is not defined
             if (!$this->isColumnDefinedForTable($tables, $tableName, 'uid')) {
                 $tables[$tablePosition]->addColumn(
index 37bd861..1eed325 100644 (file)
@@ -34,11 +34,17 @@ class DefaultTcaSchemaSqliteTest extends UnitTestCase
      */
     protected $subject;
 
+    /**
+     * @var Table
+     */
+    protected $defaultTable;
+
     public function setUp(): void
     {
         parent::setUp();
         $this->subject = $this->getAccessibleMock(DefaultTcaSchema::class, ['tableRunsOnSqlite']);
         $this->subject->method('tableRunsOnSqlite')->willReturn(true);
+        $this->defaultTable = new Table('aTable');
     }
 
     /**
@@ -126,7 +132,7 @@ class DefaultTcaSchemaSqliteTest extends UnitTestCase
     public function enrichAddsUidAndNoPrimaryKey()
     {
         $GLOBALS['TCA']['aTable']['ctrl'] = [];
-        $result = $this->subject->enrich([]);
+        $result = $this->subject->enrich([$this->defaultTable]);
         $expectedUidColumn = new Column(
             'uid',
             Type::getType('integer'),
@@ -146,7 +152,7 @@ class DefaultTcaSchemaSqliteTest extends UnitTestCase
     public function enrichAddsPid()
     {
         $GLOBALS['TCA']['aTable']['ctrl'] = [];
-        $result = $this->subject->enrich([]);
+        $result = $this->subject->enrich([$this->defaultTable]);
         $expectedPidColumn = new Column(
             'pid',
             Type::getType('integer'),
@@ -167,7 +173,7 @@ class DefaultTcaSchemaSqliteTest extends UnitTestCase
         $GLOBALS['TCA']['aTable']['ctrl'] = [
             'versioningWS' => true,
         ];
-        $result = $this->subject->enrich([]);
+        $result = $this->subject->enrich([$this->defaultTable]);
         $expectedPidColumn = new Column(
             'pid',
             Type::getType('integer'),
@@ -188,7 +194,7 @@ class DefaultTcaSchemaSqliteTest extends UnitTestCase
         $GLOBALS['TCA']['aTable']['ctrl'] = [
             'tstamp' => 'updatedon',
         ];
-        $result = $this->subject->enrich([]);
+        $result = $this->subject->enrich([$this->defaultTable]);
         $expectedColumn = new Column(
             '`updatedon`',
             Type::getType('integer'),
@@ -209,7 +215,7 @@ class DefaultTcaSchemaSqliteTest extends UnitTestCase
         $GLOBALS['TCA']['aTable']['ctrl'] = [
             'crdate' => 'createdon',
         ];
-        $result = $this->subject->enrich([]);
+        $result = $this->subject->enrich([$this->defaultTable]);
         $expectedColumn = new Column(
             '`createdon`',
             Type::getType('integer'),
@@ -230,7 +236,7 @@ class DefaultTcaSchemaSqliteTest extends UnitTestCase
         $GLOBALS['TCA']['aTable']['ctrl'] = [
             'cruser_id' => 'createdby',
         ];
-        $result = $this->subject->enrich([]);
+        $result = $this->subject->enrich([$this->defaultTable]);
         $expectedColumn = new Column(
             '`createdby`',
             Type::getType('integer'),
@@ -251,7 +257,7 @@ class DefaultTcaSchemaSqliteTest extends UnitTestCase
         $GLOBALS['TCA']['aTable']['ctrl'] = [
             'delete' => 'deleted',
         ];
-        $result = $this->subject->enrich([]);
+        $result = $this->subject->enrich([$this->defaultTable]);
         $expectedColumn = new Column(
             '`deleted`',
             Type::getType('smallint'),
@@ -274,7 +280,7 @@ class DefaultTcaSchemaSqliteTest extends UnitTestCase
                 'disabled' => 'disabled',
             ]
         ];
-        $result = $this->subject->enrich([]);
+        $result = $this->subject->enrich([$this->defaultTable]);
         $expectedColumn = new Column(
             '`disabled`',
             Type::getType('smallint'),
@@ -297,7 +303,7 @@ class DefaultTcaSchemaSqliteTest extends UnitTestCase
                 'starttime' => 'starttime',
             ]
         ];
-        $result = $this->subject->enrich([]);
+        $result = $this->subject->enrich([$this->defaultTable]);
         $expectedColumn = new Column(
             '`starttime`',
             Type::getType('integer'),
@@ -320,7 +326,7 @@ class DefaultTcaSchemaSqliteTest extends UnitTestCase
                 'endtime' => 'endtime',
             ]
         ];
-        $result = $this->subject->enrich([]);
+        $result = $this->subject->enrich([$this->defaultTable]);
         $expectedColumn = new Column(
             '`endtime`',
             Type::getType('integer'),
@@ -343,7 +349,7 @@ class DefaultTcaSchemaSqliteTest extends UnitTestCase
                 'fe_group' => 'fe_group',
             ]
         ];
-        $result = $this->subject->enrich([]);
+        $result = $this->subject->enrich([$this->defaultTable]);
         $expectedColumn = new Column(
             '`fe_group`',
             Type::getType('string'),
@@ -364,7 +370,7 @@ class DefaultTcaSchemaSqliteTest extends UnitTestCase
         $GLOBALS['TCA']['aTable']['ctrl'] = [
             'sortby' => 'sorting',
         ];
-        $result = $this->subject->enrich([]);
+        $result = $this->subject->enrich([$this->defaultTable]);
         $expectedColumn = new Column(
             '`sorting`',
             Type::getType('integer'),
@@ -383,7 +389,7 @@ class DefaultTcaSchemaSqliteTest extends UnitTestCase
     public function enrichAddsParentKey()
     {
         $GLOBALS['TCA']['aTable']['ctrl'] = [];
-        $result = $this->subject->enrich([]);
+        $result = $this->subject->enrich([$this->defaultTable]);
         $expectedIndex = new Index('parent', ['pid']);
         self::assertEquals($expectedIndex, $result[0]->getIndex('parent'));
     }
@@ -396,7 +402,7 @@ class DefaultTcaSchemaSqliteTest extends UnitTestCase
         $GLOBALS['TCA']['aTable']['ctrl'] = [
             'delete' => 'deleted',
         ];
-        $result = $this->subject->enrich([]);
+        $result = $this->subject->enrich([$this->defaultTable]);
         $expectedIndex = new Index('parent', ['pid', 'deleted']);
         self::assertEquals($expectedIndex, $result[0]->getIndex('parent'));
     }
@@ -411,7 +417,7 @@ class DefaultTcaSchemaSqliteTest extends UnitTestCase
                 'disabled' => 'disabled',
             ],
         ];
-        $result = $this->subject->enrich([]);
+        $result = $this->subject->enrich([$this->defaultTable]);
         $expectedIndex = new Index('parent', ['pid', 'disabled']);
         self::assertEquals($expectedIndex, $result[0]->getIndex('parent'));
     }
@@ -427,7 +433,7 @@ class DefaultTcaSchemaSqliteTest extends UnitTestCase
                 'disabled' => 'disabled',
             ],
         ];
-        $result = $this->subject->enrich([]);
+        $result = $this->subject->enrich([$this->defaultTable]);
         $expectedIndex = new Index('parent', ['pid', 'deleted', 'disabled']);
         self::assertEquals($expectedIndex, $result[0]->getIndex('parent'));
     }
@@ -440,7 +446,7 @@ class DefaultTcaSchemaSqliteTest extends UnitTestCase
         $GLOBALS['TCA']['aTable']['ctrl'] = [
             'languageField' => 'sys_language_uid',
         ];
-        $result = $this->subject->enrich([]);
+        $result = $this->subject->enrich([$this->defaultTable]);
         $expectedColumn = new Column(
             '`sys_language_uid`',
             Type::getType('integer'),
@@ -462,7 +468,7 @@ class DefaultTcaSchemaSqliteTest extends UnitTestCase
             'languageField' => 'sys_language_uid',
             'transOrigPointerField' => 'l10n_parent',
         ];
-        $result = $this->subject->enrich([]);
+        $result = $this->subject->enrich([$this->defaultTable]);
         $expectedColumn = new Column(
             '`l10n_parent`',
             Type::getType('integer'),
@@ -483,7 +489,7 @@ class DefaultTcaSchemaSqliteTest extends UnitTestCase
         $GLOBALS['TCA']['aTable']['ctrl'] = [
             'transOrigPointerField' => 'l10n_parent',
         ];
-        $result = $this->subject->enrich([]);
+        $result = $this->subject->enrich([$this->defaultTable]);
         $this->expectException(SchemaException::class);
         $result[0]->getColumn('l10n_parent');
     }
@@ -496,7 +502,7 @@ class DefaultTcaSchemaSqliteTest extends UnitTestCase
         $GLOBALS['TCA']['aTable']['ctrl'] = [
             'descriptionColumn' => 'rowDescription',
         ];
-        $result = $this->subject->enrich([]);
+        $result = $this->subject->enrich([$this->defaultTable]);
         $expectedColumn = new Column(
             '`rowDescription`',
             Type::getType('text'),
@@ -516,7 +522,7 @@ class DefaultTcaSchemaSqliteTest extends UnitTestCase
         $GLOBALS['TCA']['aTable']['ctrl'] = [
             'editlock' => 'editlock'
         ];
-        $result = $this->subject->enrich([]);
+        $result = $this->subject->enrich([$this->defaultTable]);
         $expectedColumn = new Column(
             '`editlock`',
             Type::getType('smallint'),
@@ -538,7 +544,7 @@ class DefaultTcaSchemaSqliteTest extends UnitTestCase
             'languageField' => 'sys_language_uid',
             'translationSource' => 'l10n_source',
         ];
-        $result = $this->subject->enrich([]);
+        $result = $this->subject->enrich([$this->defaultTable]);
         $expectedColumn = new Column(
             '`l10n_source`',
             Type::getType('integer'),
@@ -559,7 +565,7 @@ class DefaultTcaSchemaSqliteTest extends UnitTestCase
         $GLOBALS['TCA']['aTable']['ctrl'] = [
             'translationSource' => 'l10n_source',
         ];
-        $result = $this->subject->enrich([]);
+        $result = $this->subject->enrich([$this->defaultTable]);
         $this->expectException(SchemaException::class);
         $result[0]->getColumn('l10n_source');
     }
@@ -573,7 +579,7 @@ class DefaultTcaSchemaSqliteTest extends UnitTestCase
             'languageField' => 'sys_language_uid',
             'transOrigPointerField' => 'l10n_parent',
         ];
-        $result = $this->subject->enrich([]);
+        $result = $this->subject->enrich([$this->defaultTable]);
         $expectedColumn = new Column(
             '`l10n_state`',
             Type::getType('text'),
@@ -593,7 +599,7 @@ class DefaultTcaSchemaSqliteTest extends UnitTestCase
         $GLOBALS['TCA']['aTable']['ctrl'] = [
             'transOrigPointerField' => 'l10n_parent',
         ];
-        $result = $this->subject->enrich([]);
+        $result = $this->subject->enrich([$this->defaultTable]);
         $this->expectException(SchemaException::class);
         $result[0]->getColumn('l10n_state');
     }
@@ -606,7 +612,7 @@ class DefaultTcaSchemaSqliteTest extends UnitTestCase
         $GLOBALS['TCA']['aTable']['ctrl'] = [
             'languageField' => 'sys_language_uid',
         ];
-        $result = $this->subject->enrich([]);
+        $result = $this->subject->enrich([$this->defaultTable]);
         $this->expectException(SchemaException::class);
         $result[0]->getColumn('l10n_state');
     }
@@ -619,7 +625,7 @@ class DefaultTcaSchemaSqliteTest extends UnitTestCase
         $GLOBALS['TCA']['aTable']['ctrl'] = [
             'origUid' => 't3_origuid',
         ];
-        $result = $this->subject->enrich([]);
+        $result = $this->subject->enrich([$this->defaultTable]);
         $expectedColumn = new Column(
             '`t3_origuid`',
             Type::getType('integer'),
@@ -640,7 +646,7 @@ class DefaultTcaSchemaSqliteTest extends UnitTestCase
         $GLOBALS['TCA']['aTable']['ctrl'] = [
             'transOrigDiffSourceField' => 'l18n_diffsource',
         ];
-        $result = $this->subject->enrich([]);
+        $result = $this->subject->enrich([$this->defaultTable]);
         $expectedColumn = new Column(
             '`l18n_diffsource`',
             Type::getType('blob'),
@@ -660,7 +666,7 @@ class DefaultTcaSchemaSqliteTest extends UnitTestCase
         $GLOBALS['TCA']['aTable']['ctrl'] = [
             'versioningWS' => true,
         ];
-        $result = $this->subject->enrich([]);
+        $result = $this->subject->enrich([$this->defaultTable]);
         $expectedColumn = new Column(
             '`t3ver_oid`',
             Type::getType('integer'),
@@ -681,7 +687,7 @@ class DefaultTcaSchemaSqliteTest extends UnitTestCase
         $GLOBALS['TCA']['aTable']['ctrl'] = [
             'versioningWS' => true,
         ];
-        $result = $this->subject->enrich([]);
+        $result = $this->subject->enrich([$this->defaultTable]);
         $expectedColumn = new Column(
             '`t3ver_wsid`',
             Type::getType('integer'),
@@ -702,7 +708,7 @@ class DefaultTcaSchemaSqliteTest extends UnitTestCase
         $GLOBALS['TCA']['aTable']['ctrl'] = [
             'versioningWS' => true,
         ];
-        $result = $this->subject->enrich([]);
+        $result = $this->subject->enrich([$this->defaultTable]);
         $expectedColumn = new Column(
             '`t3ver_state`',
             Type::getType('smallint'),
@@ -723,7 +729,7 @@ class DefaultTcaSchemaSqliteTest extends UnitTestCase
         $GLOBALS['TCA']['aTable']['ctrl'] = [
             'versioningWS' => true,
         ];
-        $result = $this->subject->enrich([]);
+        $result = $this->subject->enrich([$this->defaultTable]);
         $expectedColumn = new Column(
             '`t3ver_stage`',
             Type::getType('integer'),
@@ -744,7 +750,7 @@ class DefaultTcaSchemaSqliteTest extends UnitTestCase
         $GLOBALS['TCA']['aTable']['ctrl'] = [
             'versioningWS' => true,
         ];
-        $result = $this->subject->enrich([]);
+        $result = $this->subject->enrich([$this->defaultTable]);
         $expectedColumn = new Column(
             '`t3ver_count`',
             Type::getType('integer'),
@@ -765,7 +771,7 @@ class DefaultTcaSchemaSqliteTest extends UnitTestCase
         $GLOBALS['TCA']['aTable']['ctrl'] = [
             'versioningWS' => true,
         ];
-        $result = $this->subject->enrich([]);
+        $result = $this->subject->enrich([$this->defaultTable]);
         $expectedColumn = new Column(
             '`t3ver_tstamp`',
             Type::getType('integer'),
@@ -786,7 +792,7 @@ class DefaultTcaSchemaSqliteTest extends UnitTestCase
         $GLOBALS['TCA']['aTable']['ctrl'] = [
             'versioningWS' => true,
         ];
-        $result = $this->subject->enrich([]);
+        $result = $this->subject->enrich([$this->defaultTable]);
         $expectedColumn = new Column(
             '`t3ver_move_id`',
             Type::getType('integer'),
@@ -807,7 +813,7 @@ class DefaultTcaSchemaSqliteTest extends UnitTestCase
         $GLOBALS['TCA']['aTable']['ctrl'] = [
             'versioningWS' => true,
         ];
-        $result = $this->subject->enrich([]);
+        $result = $this->subject->enrich([$this->defaultTable]);
         $expectedIndex = new Index('t3ver_oid', ['t3ver_oid', 't3ver_wsid']);
         self::assertEquals($expectedIndex, $result[0]->getIndex('t3ver_oid'));
     }
index d873d81..2256e29 100644 (file)
@@ -34,11 +34,17 @@ class DefaultTcaSchemaTest extends UnitTestCase
      */
     protected $subject;
 
+    /**
+     * @var Table
+     */
+    protected $defaultTable;
+
     public function setUp(): void
     {
         parent::setUp();
         $this->subject = $this->getAccessibleMock(DefaultTcaSchema::class, ['tableRunsOnSqlite']);
         $this->subject->method('tableRunsOnSqlite')->willReturn(false);
+        $this->defaultTable = new Table('aTable');
     }
 
     /**
@@ -47,7 +53,7 @@ class DefaultTcaSchemaTest extends UnitTestCase
     public function enrichKeepsGivenTablesArrayWithEmptyTca()
     {
         $GLOBALS['TCA'] = [];
-        self::assertEquals([], $this->subject->enrich([]));
+        self::assertEquals([$this->defaultTable], $this->subject->enrich([$this->defaultTable]));
     }
 
     /**
@@ -126,7 +132,7 @@ class DefaultTcaSchemaTest extends UnitTestCase
     public function enrichAddsUidAndPrimaryKey()
     {
         $GLOBALS['TCA']['aTable']['ctrl'] = [];
-        $result = $this->subject->enrich([]);
+        $result = $this->subject->enrich([$this->defaultTable]);
         $expectedUidColumn = new Column(
             'uid',
             Type::getType('integer'),
@@ -147,7 +153,7 @@ class DefaultTcaSchemaTest extends UnitTestCase
     public function enrichAddsPid()
     {
         $GLOBALS['TCA']['aTable']['ctrl'] = [];
-        $result = $this->subject->enrich([]);
+        $result = $this->subject->enrich([$this->defaultTable]);
         $expectedPidColumn = new Column(
             'pid',
             Type::getType('integer'),
@@ -168,7 +174,7 @@ class DefaultTcaSchemaTest extends UnitTestCase
         $GLOBALS['TCA']['aTable']['ctrl'] = [
             'versioningWS' => true,
         ];
-        $result = $this->subject->enrich([]);
+        $result = $this->subject->enrich([$this->defaultTable]);
         $expectedPidColumn = new Column(
             'pid',
             Type::getType('integer'),
@@ -189,7 +195,7 @@ class DefaultTcaSchemaTest extends UnitTestCase
         $GLOBALS['TCA']['aTable']['ctrl'] = [
             'tstamp' => 'updatedon',
         ];
-        $result = $this->subject->enrich([]);
+        $result = $this->subject->enrich([$this->defaultTable]);
         $expectedColumn = new Column(
             '`updatedon`',
             Type::getType('integer'),
@@ -210,7 +216,7 @@ class DefaultTcaSchemaTest extends UnitTestCase
         $GLOBALS['TCA']['aTable']['ctrl'] = [
             'crdate' => 'createdon',
         ];
-        $result = $this->subject->enrich([]);
+        $result = $this->subject->enrich([$this->defaultTable]);
         $expectedColumn = new Column(
             '`createdon`',
             Type::getType('integer'),
@@ -231,7 +237,7 @@ class DefaultTcaSchemaTest extends UnitTestCase
         $GLOBALS['TCA']['aTable']['ctrl'] = [
             'cruser_id' => 'createdby',
         ];
-        $result = $this->subject->enrich([]);
+        $result = $this->subject->enrich([$this->defaultTable]);
         $expectedColumn = new Column(
             '`createdby`',
             Type::getType('integer'),
@@ -252,7 +258,7 @@ class DefaultTcaSchemaTest extends UnitTestCase
         $GLOBALS['TCA']['aTable']['ctrl'] = [
             'delete' => 'deleted',
         ];
-        $result = $this->subject->enrich([]);
+        $result = $this->subject->enrich([$this->defaultTable]);
         $expectedColumn = new Column(
             '`deleted`',
             Type::getType('smallint'),
@@ -275,7 +281,7 @@ class DefaultTcaSchemaTest extends UnitTestCase
                 'disabled' => 'disabled',
             ]
         ];
-        $result = $this->subject->enrich([]);
+        $result = $this->subject->enrich([$this->defaultTable]);
         $expectedColumn = new Column(
             '`disabled`',
             Type::getType('smallint'),
@@ -298,7 +304,7 @@ class DefaultTcaSchemaTest extends UnitTestCase
                 'starttime' => 'starttime',
             ]
         ];
-        $result = $this->subject->enrich([]);
+        $result = $this->subject->enrich([$this->defaultTable]);
         $expectedColumn = new Column(
             '`starttime`',
             Type::getType('integer'),
@@ -321,7 +327,7 @@ class DefaultTcaSchemaTest extends UnitTestCase
                 'endtime' => 'endtime',
             ]
         ];
-        $result = $this->subject->enrich([]);
+        $result = $this->subject->enrich([$this->defaultTable]);
         $expectedColumn = new Column(
             '`endtime`',
             Type::getType('integer'),
@@ -344,7 +350,7 @@ class DefaultTcaSchemaTest extends UnitTestCase
                 'fe_group' => 'fe_group',
             ]
         ];
-        $result = $this->subject->enrich([]);
+        $result = $this->subject->enrich([$this->defaultTable]);
         $expectedColumn = new Column(
             '`fe_group`',
             Type::getType('string'),
@@ -365,7 +371,7 @@ class DefaultTcaSchemaTest extends UnitTestCase
         $GLOBALS['TCA']['aTable']['ctrl'] = [
             'sortby' => 'sorting',
         ];
-        $result = $this->subject->enrich([]);
+        $result = $this->subject->enrich([$this->defaultTable]);
         $expectedColumn = new Column(
             '`sorting`',
             Type::getType('integer'),
@@ -384,7 +390,7 @@ class DefaultTcaSchemaTest extends UnitTestCase
     public function enrichAddsParentKey()
     {
         $GLOBALS['TCA']['aTable']['ctrl'] = [];
-        $result = $this->subject->enrich([]);
+        $result = $this->subject->enrich([$this->defaultTable]);
         $expectedIndex = new Index('parent', ['pid']);
         self::assertEquals($expectedIndex, $result[0]->getIndex('parent'));
     }
@@ -397,7 +403,7 @@ class DefaultTcaSchemaTest extends UnitTestCase
         $GLOBALS['TCA']['aTable']['ctrl'] = [
             'delete' => 'deleted',
         ];
-        $result = $this->subject->enrich([]);
+        $result = $this->subject->enrich([$this->defaultTable]);
         $expectedIndex = new Index('parent', ['pid', 'deleted']);
         self::assertEquals($expectedIndex, $result[0]->getIndex('parent'));
     }
@@ -412,7 +418,7 @@ class DefaultTcaSchemaTest extends UnitTestCase
                 'disabled' => 'disabled',
             ],
         ];
-        $result = $this->subject->enrich([]);
+        $result = $this->subject->enrich([$this->defaultTable]);
         $expectedIndex = new Index('parent', ['pid', 'disabled']);
         self::assertEquals($expectedIndex, $result[0]->getIndex('parent'));
     }
@@ -428,7 +434,7 @@ class DefaultTcaSchemaTest extends UnitTestCase
                 'disabled' => 'disabled',
             ],
         ];
-        $result = $this->subject->enrich([]);
+        $result = $this->subject->enrich([$this->defaultTable]);
         $expectedIndex = new Index('parent', ['pid', 'deleted', 'disabled']);
         self::assertEquals($expectedIndex, $result[0]->getIndex('parent'));
     }
@@ -441,7 +447,7 @@ class DefaultTcaSchemaTest extends UnitTestCase
         $GLOBALS['TCA']['aTable']['ctrl'] = [
             'languageField' => 'sys_language_uid',
         ];
-        $result = $this->subject->enrich([]);
+        $result = $this->subject->enrich([$this->defaultTable]);
         $expectedColumn = new Column(
             '`sys_language_uid`',
             Type::getType('integer'),
@@ -463,7 +469,7 @@ class DefaultTcaSchemaTest extends UnitTestCase
             'languageField' => 'sys_language_uid',
             'transOrigPointerField' => 'l10n_parent',
         ];
-        $result = $this->subject->enrich([]);
+        $result = $this->subject->enrich([$this->defaultTable]);
         $expectedColumn = new Column(
             '`l10n_parent`',
             Type::getType('integer'),
@@ -484,7 +490,7 @@ class DefaultTcaSchemaTest extends UnitTestCase
         $GLOBALS['TCA']['aTable']['ctrl'] = [
             'transOrigPointerField' => 'l10n_parent',
         ];
-        $result = $this->subject->enrich([]);
+        $result = $this->subject->enrich([$this->defaultTable]);
         $this->expectException(SchemaException::class);
         $result[0]->getColumn('l10n_parent');
     }
@@ -497,7 +503,7 @@ class DefaultTcaSchemaTest extends UnitTestCase
         $GLOBALS['TCA']['aTable']['ctrl'] = [
             'descriptionColumn' => 'rowDescription',
         ];
-        $result = $this->subject->enrich([]);
+        $result = $this->subject->enrich([$this->defaultTable]);
         $expectedColumn = new Column(
             '`rowDescription`',
             Type::getType('text'),
@@ -517,7 +523,7 @@ class DefaultTcaSchemaTest extends UnitTestCase
         $GLOBALS['TCA']['aTable']['ctrl'] = [
             'editlock' => 'editlock'
         ];
-        $result = $this->subject->enrich([]);
+        $result = $this->subject->enrich([$this->defaultTable]);
         $expectedColumn = new Column(
             '`editlock`',
             Type::getType('smallint'),
@@ -539,7 +545,7 @@ class DefaultTcaSchemaTest extends UnitTestCase
             'languageField' => 'sys_language_uid',
             'translationSource' => 'l10n_source',
         ];
-        $result = $this->subject->enrich([]);
+        $result = $this->subject->enrich([$this->defaultTable]);
         $expectedColumn = new Column(
             '`l10n_source`',
             Type::getType('integer'),
@@ -560,7 +566,7 @@ class DefaultTcaSchemaTest extends UnitTestCase
         $GLOBALS['TCA']['aTable']['ctrl'] = [
             'translationSource' => 'l10n_source',
         ];
-        $result = $this->subject->enrich([]);
+        $result = $this->subject->enrich([$this->defaultTable]);
         $this->expectException(SchemaException::class);
         $result[0]->getColumn('l10n_source');
     }
@@ -574,7 +580,7 @@ class DefaultTcaSchemaTest extends UnitTestCase
             'languageField' => 'sys_language_uid',
             'transOrigPointerField' => 'l10n_parent',
         ];
-        $result = $this->subject->enrich([]);
+        $result = $this->subject->enrich([$this->defaultTable]);
         $expectedColumn = new Column(
             '`l10n_state`',
             Type::getType('text'),
@@ -594,7 +600,7 @@ class DefaultTcaSchemaTest extends UnitTestCase
         $GLOBALS['TCA']['aTable']['ctrl'] = [
             'transOrigPointerField' => 'l10n_parent',
         ];
-        $result = $this->subject->enrich([]);
+        $result = $this->subject->enrich([$this->defaultTable]);
         $this->expectException(SchemaException::class);
         $result[0]->getColumn('l10n_state');
     }
@@ -607,7 +613,7 @@ class DefaultTcaSchemaTest extends UnitTestCase
         $GLOBALS['TCA']['aTable']['ctrl'] = [
             'languageField' => 'sys_language_uid',
         ];
-        $result = $this->subject->enrich([]);
+        $result = $this->subject->enrich([$this->defaultTable]);
         $this->expectException(SchemaException::class);
         $result[0]->getColumn('l10n_state');
     }
@@ -620,7 +626,7 @@ class DefaultTcaSchemaTest extends UnitTestCase
         $GLOBALS['TCA']['aTable']['ctrl'] = [
             'origUid' => 't3_origuid',
         ];
-        $result = $this->subject->enrich([]);
+        $result = $this->subject->enrich([$this->defaultTable]);
         $expectedColumn = new Column(
             '`t3_origuid`',
             Type::getType('integer'),
@@ -641,7 +647,7 @@ class DefaultTcaSchemaTest extends UnitTestCase
         $GLOBALS['TCA']['aTable']['ctrl'] = [
             'transOrigDiffSourceField' => 'l18n_diffsource',
         ];
-        $result = $this->subject->enrich([]);
+        $result = $this->subject->enrich([$this->defaultTable]);
         $expectedColumn = new Column(
             '`l18n_diffsource`',
             Type::getType('blob'),
@@ -661,7 +667,7 @@ class DefaultTcaSchemaTest extends UnitTestCase
         $GLOBALS['TCA']['aTable']['ctrl'] = [
             'versioningWS' => true,
         ];
-        $result = $this->subject->enrich([]);
+        $result = $this->subject->enrich([$this->defaultTable]);
         $expectedColumn = new Column(
             '`t3ver_oid`',
             Type::getType('integer'),
@@ -682,7 +688,7 @@ class DefaultTcaSchemaTest extends UnitTestCase
         $GLOBALS['TCA']['aTable']['ctrl'] = [
             'versioningWS' => true,
         ];
-        $result = $this->subject->enrich([]);
+        $result = $this->subject->enrich([$this->defaultTable]);
         $expectedColumn = new Column(
             '`t3ver_wsid`',
             Type::getType('integer'),
@@ -703,7 +709,7 @@ class DefaultTcaSchemaTest extends UnitTestCase
         $GLOBALS['TCA']['aTable']['ctrl'] = [
             'versioningWS' => true,
         ];
-        $result = $this->subject->enrich([]);
+        $result = $this->subject->enrich([$this->defaultTable]);
         $expectedColumn = new Column(
             '`t3ver_state`',
             Type::getType('smallint'),
@@ -724,7 +730,7 @@ class DefaultTcaSchemaTest extends UnitTestCase
         $GLOBALS['TCA']['aTable']['ctrl'] = [
             'versioningWS' => true,
         ];
-        $result = $this->subject->enrich([]);
+        $result = $this->subject->enrich([$this->defaultTable]);
         $expectedColumn = new Column(
             '`t3ver_stage`',
             Type::getType('integer'),
@@ -745,7 +751,7 @@ class DefaultTcaSchemaTest extends UnitTestCase
         $GLOBALS['TCA']['aTable']['ctrl'] = [
             'versioningWS' => true,
         ];
-        $result = $this->subject->enrich([]);
+        $result = $this->subject->enrich([$this->defaultTable]);
         $expectedColumn = new Column(
             '`t3ver_count`',
             Type::getType('integer'),
@@ -766,7 +772,7 @@ class DefaultTcaSchemaTest extends UnitTestCase
         $GLOBALS['TCA']['aTable']['ctrl'] = [
             'versioningWS' => true,
         ];
-        $result = $this->subject->enrich([]);
+        $result = $this->subject->enrich([$this->defaultTable]);
         $expectedColumn = new Column(
             '`t3ver_tstamp`',
             Type::getType('integer'),
@@ -787,7 +793,7 @@ class DefaultTcaSchemaTest extends UnitTestCase
         $GLOBALS['TCA']['aTable']['ctrl'] = [
             'versioningWS' => true,
         ];
-        $result = $this->subject->enrich([]);
+        $result = $this->subject->enrich([$this->defaultTable]);
         $expectedColumn = new Column(
             '`t3ver_move_id`',
             Type::getType('integer'),
@@ -808,7 +814,7 @@ class DefaultTcaSchemaTest extends UnitTestCase
         $GLOBALS['TCA']['aTable']['ctrl'] = [
             'versioningWS' => true,
         ];
-        $result = $this->subject->enrich([]);
+        $result = $this->subject->enrich([$this->defaultTable]);
         $expectedIndex = new Index('t3ver_oid', ['t3ver_oid', 't3ver_wsid']);
         self::assertEquals($expectedIndex, $result[0]->getIndex('t3ver_oid'));
     }