Upgraded drupal core with security updates
[yaffs-website] / web / core / modules / locale / tests / src / Functional / LocaleLocaleLookupTest.php
1 <?php
2
3 namespace Drupal\Tests\locale\Functional;
4
5 use Drupal\language\Entity\ConfigurableLanguage;
6 use Drupal\Tests\BrowserTestBase;
7
8 /**
9  * Tests LocaleLookup.
10  *
11  * @group locale
12  */
13 class LocaleLocaleLookupTest extends BrowserTestBase {
14
15   /**
16    * Modules to enable.
17    *
18    * @var array
19    */
20   public static $modules = ['locale', 'locale_test'];
21
22   /**
23    * {@inheritdoc}
24    */
25   protected function setUp() {
26     parent::setUp();
27
28     // Change the language default object to different values.
29     ConfigurableLanguage::createFromLangcode('fr')->save();
30     $this->config('system.site')->set('default_langcode', 'fr')->save();
31
32     $this->drupalLogin($this->rootUser);
33   }
34
35   /**
36    * Tests that there are no circular dependencies.
37    */
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);
42   }
43
44   /**
45    * Test language fallback defaults.
46    */
47   public function testLanguageFallbackDefaults() {
48     $this->drupalGet('');
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');
56   }
57
58 }