function LocaleConfigSubscriberForeignTest::testUnchangedActiveTranslationNotResaved

Same name and namespace in other branches
  1. main core/modules/locale/tests/src/Kernel/LocaleConfigSubscriberForeignTest.php \Drupal\Tests\locale\Kernel\LocaleConfigSubscriberForeignTest::testUnchangedActiveTranslationNotResaved()

Tests that unchanged active translations are not re-saved.

File

core/modules/locale/tests/src/Kernel/LocaleConfigSubscriberForeignTest.php, line 127

Class

LocaleConfigSubscriberForeignTest
Tests default configuration handling with a foreign default language.

Namespace

Drupal\Tests\locale\Kernel

Code

public function testUnchangedActiveTranslationNotResaved() : void {
  $config_name = 'locale_test.translation';
  // After setUp(), the Hungarian active translation already exists. Calling
  // updateConfigTranslations() again without changes should not re-save it.
  $this->localeConfigManager
    ->reset();
  $count = $this->localeConfigManager
    ->updateConfigTranslations([
    $config_name,
  ], [
    'hu',
  ]);
  $this->assertSame(0, $count, 'Unchanged active config translation should not be re-saved.');
  // Verify the active config is still intact.
  $this->assertActiveConfig($config_name, 'test', 'Hungarian test', 'hu');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.