3 namespace Drupal\Tests\locale\Functional;
5 use Drupal\language\Entity\ConfigurableLanguage;
6 use Drupal\Tests\BrowserTestBase;
13 class LocaleLocaleLookupTest extends BrowserTestBase {
20 public static $modules = ['locale', 'locale_test'];
25 protected function setUp() {
28 // Change the language default object to different values.
29 ConfigurableLanguage::createFromLangcode('fr')->save();
30 $this->config('system.site')->set('default_langcode', 'fr')->save();
32 $this->drupalLogin($this->rootUser);
36 * Tests that there are no circular dependencies.
38 public function testCircularDependency() {
39 // Ensure that we can enable early_translation_test on a non-english site.
40 $this->drupalPostForm('admin/modules', ['modules[early_translation_test][enable]' => TRUE], t('Install'));
41 $this->assertResponse(200);
45 * Test language fallback defaults.
47 public function testLanguageFallbackDefaults() {
49 // Ensure state of fallback languages persisted by
50 // locale_test_language_fallback_candidates_locale_lookup_alter() is empty.
51 $this->assertEqual(\Drupal::state()->get('locale.test_language_fallback_candidates_locale_lookup_alter_candidates'), []);
52 // Make sure there is enough information provided for alter hooks.
53 $context = \Drupal::state()->get('locale.test_language_fallback_candidates_locale_lookup_alter_context');
54 $this->assertEqual($context['langcode'], 'fr');
55 $this->assertEqual($context['operation'], 'locale_lookup');