diff --git a/core/modules/locale/tests/src/Functional/LocaleLocaleLookupTest.php b/core/modules/locale/tests/src/Functional/LocaleLocaleLookupTest.php index 0938895083..4afd1c81ff 100644 --- a/core/modules/locale/tests/src/Functional/LocaleLocaleLookupTest.php +++ b/core/modules/locale/tests/src/Functional/LocaleLocaleLookupTest.php @@ -62,25 +62,24 @@ public function testLanguageFallbackDefaults() { * @dataProvider providerTestFixOldPluralStyle */ public function testFixOldPluralStyle($translation_value, $expected) { - /** @var \Drupal\locale\StringDatabaseStorage $string_storage */ $string_storage = \Drupal::service('locale.storage'); - $string = $string_storage->findString(['source' => 'Member for', 'context' => '']); - - // Create translation with old @count[2] plural style. + $lid = $string->getId(); $string_storage->createTranslation([ - 'lid' => $string->getId(), + 'lid' => $lid, 'language' => 'fr', 'translation' => $translation_value, ])->save(); + _locale_refresh_translations(['fr'], [$lid]); - drupal_flush_all_caches(); + // Check that 'count[2]' was fixed for render value. $this->drupalGet(''); $this->assertSession()->pageTextContains($expected); - // Assert that source not changed. - $translation = $string_storage->findTranslation(['language' => 'fr', 'lid' => $string->getId()])->translation; - $this->assertSame($translation_value, $translation); + // Check that 'count[2]' was saved for source value. + $translation = $string_storage->findTranslation(['language' => 'fr', 'lid' => $lid])->translation; + $this->assertSame($translation_value, $translation, 'Source value not changed'); + $this->assertNotFalse(strpos($translation, '@count[2]'), 'Source value contains @count[2]'); } /**