LocaleTranslationProjectsTest.php in Zircon Profile 8
File
core/modules/locale/src/Tests/LocaleTranslationProjectsTest.php
View source
<?php
namespace Drupal\locale\Tests;
use Drupal\simpletest\KernelTestBase;
class LocaleTranslationProjectsTest extends KernelTestBase {
public static $modules = [
'locale',
'locale_test',
];
protected $moduleHandler;
protected $projectStorage;
protected function setUp() {
parent::setUp();
$this->moduleHandler = $this->container
->get('module_handler');
$this->projectStorage = $this->container
->get('locale.project');
\Drupal::state()
->set('locale.remove_core_project', TRUE);
}
public function testLocaleTranslationClearCacheProjects() {
$this->moduleHandler
->loadInclude('locale', 'inc', 'locale.translation');
$expected = [];
$this
->assertIdentical($expected, locale_translation_get_projects());
$this->projectStorage
->set('foo', []);
$expected['foo'] = new \stdClass();
$this
->assertEqual($expected, locale_translation_get_projects());
$this->projectStorage
->set('bar', []);
locale_translation_clear_cache_projects();
$expected['bar'] = new \stdClass();
$this
->assertEqual($expected, locale_translation_get_projects());
}
}