You are here

public function LocaleTranslationProjectsTest::testLocaleTranslationClearCacheProjects in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/locale/tests/src/Kernel/LocaleTranslationProjectsTest.php \Drupal\Tests\locale\Kernel\LocaleTranslationProjectsTest::testLocaleTranslationClearCacheProjects()
  2. 9 core/modules/locale/tests/src/Kernel/LocaleTranslationProjectsTest.php \Drupal\Tests\locale\Kernel\LocaleTranslationProjectsTest::testLocaleTranslationClearCacheProjects()

Tests locale_translation_clear_cache_projects().

File

core/modules/locale/tests/src/Kernel/LocaleTranslationProjectsTest.php, line 47

Class

LocaleTranslationProjectsTest
Tests locale translation project handling.

Namespace

Drupal\Tests\locale\Kernel

Code

public function testLocaleTranslationClearCacheProjects() {
  $this->moduleHandler
    ->loadInclude('locale', 'inc', 'locale.translation');
  $expected = [];
  $this
    ->assertSame($expected, locale_translation_get_projects());
  $this->projectStorage
    ->set('foo', []);
  $expected['foo'] = new \stdClass();
  $this
    ->assertEquals($expected, locale_translation_get_projects());
  $this->projectStorage
    ->set('bar', []);
  locale_translation_clear_cache_projects();
  $expected['bar'] = new \stdClass();
  $this
    ->assertEquals($expected, locale_translation_get_projects());
}