public function testFixOldPluralStyle($translation_value,
$expected) { $string_storage = \Drupal::
service('locale.storage'
);
$string =
$string_storage->
findString(['source' => 'Member for', 'context' => ''
]);
$lid =
$string->
getId();
$string_storage->
createTranslation([ 'lid' =>
$lid,
'language' => 'fr',
'translation' =>
$translation_value,
])->
save();
_locale_refresh_translations(['fr'
],
[$lid]);
// Check that 'count[2]' was fixed for render value.
$this->
drupalGet(''
);
$this->
assertSession()->
pageTextContains($expected);
// 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->
assertStringContainsString('@count[2]',
$translation, 'Source value contains @count[2]'
);
}