| Server IP : 195.130.67.5 / Your IP : 216.73.217.154 Web Server : Microsoft-IIS/10.0 System : Windows NT WEBSERVER1 10.0 build 17763 (Windows Server 2016) i586 User : IUSR ( 0) PHP Version : 7.4.19 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /Old Sites/enoikio/core/modules/locale/tests/src/Kernel/ |
Upload File : |
<?php
namespace Drupal\Tests\locale\Kernel;
use Drupal\KernelTests\KernelTestBase;
/**
* Tests locale translation project handling.
*
* @group locale
*/
class LocaleTranslationProjectsTest extends KernelTestBase {
/**
* {@inheritdoc}
*/
public static $modules = ['locale', 'locale_test', 'system'];
/**
* The module handler used in this test.
*
* @var \Drupal\Core\Extension\ModuleHandlerInterface
*/
protected $moduleHandler;
/**
* The locale project storage used in this test.
*
* @var \Drupal\locale\LocaleProjectStorageInterface
*/
protected $projectStorage;
/**
* {@inheritdoc}
*/
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);
}
/**
* Tests locale_translation_clear_cache_projects().
*/
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());
}
}