Skip to content

Commit fd7b598

Browse files
committed
#1394 Include Enrichment[NAME] translation keys in update
1 parent 2444d57 commit fd7b598

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

modules/admin/models/EnrichmentKeys.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,8 @@ public function getTranslationKeys($enrichmentKey)
225225
{
226226
$patterns = $this->getKeyPatterns();
227227

228+
$patterns['label'] = 'Enrichment%s'; // TODO remove special handling of 'label'
229+
228230
$translationKeys = [];
229231

230232
foreach ($patterns as $patternName => $pattern) {

tests/library/Application/Update/UpdateEnrichmentsTest.php

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,9 @@ public function setUp(): void
6363
$enrichmentKey->store();
6464

6565
$this->translationHelper = new Admin_Model_EnrichmentKeys();
66-
$this->translationHelper->createTranslations('testOldKey');
66+
$this->translationHelper->createTranslations('testOldKey', null, [
67+
'label' => 'EnrichmenttestOldKey'
68+
]);
6769

6870
$this->updater = new Application_Update_UpdateEnrichments();
6971
$this->updater->setOutput(new NullOutput());
@@ -119,7 +121,7 @@ public function testUpdateNewKeyExists()
119121
public function testUpdateTranslations()
120122
{
121123
$translations = $this->translationHelper->getTranslations('testOldKey');
122-
$this->assertCount(6, $translations);
124+
$this->assertCount(7, $translations);
123125

124126
$this->updater->update([
125127
'testOldKey' => 'testNewKey',
@@ -128,7 +130,7 @@ public function testUpdateTranslations()
128130
$translations = $this->translationHelper->getTranslations('testOldKey');
129131
$this->assertCount(0, $translations);
130132
$translations = $this->translationHelper->getTranslations('testNewKey');
131-
$this->assertCount(6, $translations);
133+
$this->assertCount(7, $translations);
132134

133135
$this->translationHelper->removeTranslations('testNewKey');
134136
}
@@ -168,10 +170,10 @@ public function testUpdateTranslationNoSideEffects()
168170
$translationManager->setFilter('testOldKey');
169171

170172
$matchingTranslations = $translationManager->getMergedTranslations();
171-
$this->assertCount(7, $matchingTranslations);
173+
$this->assertCount(8, $matchingTranslations);
172174

173175
$translations = $this->translationHelper->getTranslations('testOldKey');
174-
$this->assertCount(6, $translations);
176+
$this->assertCount(7, $translations);
175177

176178
$this->updater->update([
177179
'testOldKey' => 'testNewKey',
@@ -180,11 +182,11 @@ public function testUpdateTranslationNoSideEffects()
180182
$translations = $this->translationHelper->getTranslations('testOldKey');
181183
$this->assertCount(0, $translations);
182184
$translations = $this->translationHelper->getTranslations('testNewKey');
183-
$this->assertCount(6, $translations);
185+
$this->assertCount(7, $translations);
184186

185187
$translationManager->setFilter('testNewKey');
186188
$matchingTranslations = $translationManager->getMergedTranslations();
187-
$this->assertCount(6, $matchingTranslations);
189+
$this->assertCount(7, $matchingTranslations);
188190

189191
$this->assertArrayNotHasKey('additionalTestKey_testNewKey', $matchingTranslations);
190192

0 commit comments

Comments
 (0)