Sfoglia il codice sorgente

RC3 update packs: Glossary pack carries the module's db_prefix (#5942)

The Glossary 15.0.2 -> 15.0.3 pack said db_prefix 'bx_glsr_', while the
module and every earlier Glossary pack use 'bx_glossary_' (its tables are
bx_glossary_*). #5937 fixed the same slip in the Organizations pack.

ModuleUpdatePacksTest now also checks db_prefix against the module's
config, so the next mismatch fails the Units suite.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Andrey Yasko 7 ore fa
parent
commit
a28de01fe4

+ 1 - 1
modules/boonex/glossary/updates/15.0.2_15.0.3/install/config.php

@@ -26,7 +26,7 @@ $aConfig = array(
     'module_dir' => 'boonex/glossary/',
     'module_uri' => 'glossary',
 
-    'db_prefix' => 'bx_glsr_',
+    'db_prefix' => 'bx_glossary_',
     'class_prefix' => 'BxGlsr',
 
     /**

+ 6 - 1
tests/units/install/ModuleUpdatePacksTest.php

@@ -4,6 +4,7 @@
  * Module update packs (modules/<vendor>/<module>/updates/<from>_<to>/) must name the module they update the way the
  * installed module is recorded. BxDolStudioUpdater finds the module by `module_dir` and `module_uri`, and builds the
  * updater class name from `class_prefix`, so a pack that differs from the module's own config fails on every site.
+ * `db_prefix` names the module's tables, so a pack must carry the module's own.
  */
 class ModuleUpdatePacksTest extends \PHPUnit\Framework\TestCase
 {
@@ -50,6 +51,10 @@ class ModuleUpdatePacksTest extends \PHPUnit\Framework\TestCase
             if (($aPack['class_prefix'] ?? '') !== $aModule['class_prefix'])
                 $aErrors[] = "$sPack: class_prefix '" . ($aPack['class_prefix'] ?? '') . "' is not the module's '{$aModule['class_prefix']}'";
 
+            $sDbPrefix = $aModule['db_prefix'] ?? '';
+            if (($aPack['db_prefix'] ?? '') !== $sDbPrefix)
+                $aErrors[] = "$sPack: db_prefix '" . ($aPack['db_prefix'] ?? '') . "' is not the module's '$sDbPrefix'";
+
             $sVersions = ($aPack['version_from'] ?? '') . '_' . ($aPack['version_to'] ?? '');
             if (basename($sPack) !== $sVersions)
                 $aErrors[] = "$sPack: the folder is not named after version_from and version_to ($sVersions)";
@@ -58,6 +63,6 @@ class ModuleUpdatePacksTest extends \PHPUnit\Framework\TestCase
                 $aErrors[] = "$sPack: home_dir '" . ($aPack['home_dir'] ?? '') . "' is not '{$sModuleDir}updates/update_{$sVersions}/'";
         }
 
-        $this->assertSame([], $aErrors, "Update packs that would not apply:\n" . implode("\n", $aErrors));
+        $this->assertSame([], $aErrors, "Update packs that don't match their module:\n" . implode("\n", $aErrors));
     }
 }