function LocaleTranslationProjectsTest::testLocaleTranslationClearCacheProjects

Same name in other branches
  1. 9 core/modules/locale/tests/src/Kernel/LocaleTranslationProjectsTest.php \Drupal\Tests\locale\Kernel\LocaleTranslationProjectsTest::testLocaleTranslationClearCacheProjects()
  2. 8.9.x core/modules/locale/tests/src/Kernel/LocaleTranslationProjectsTest.php \Drupal\Tests\locale\Kernel\LocaleTranslationProjectsTest::testLocaleTranslationClearCacheProjects()
  3. 10 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 49

Class

LocaleTranslationProjectsTest
Tests locale translation project handling.

Namespace

Drupal\Tests\locale\Kernel

Code

public function testLocaleTranslationClearCacheProjects() : void {
    $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());
}

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