Mercurial > hg > cmmr2012-drupal-site
comparison core/modules/language/tests/src/Functional/LanguageBrowserDetectionTest.php @ 5:12f9dff5fda9 tip
Update to Drupal core 8.7.1
author | Chris Cannam |
---|---|
date | Thu, 09 May 2019 15:34:47 +0100 |
parents | c75dbcec494b |
children |
comparison
equal
deleted
inserted
replaced
4:a9cd425dd02b | 5:12f9dff5fda9 |
---|---|
1 <?php | 1 <?php |
2 | 2 |
3 namespace Drupal\Tests\language\Functional; | 3 namespace Drupal\Tests\language\Functional; |
4 | 4 |
5 use Drupal\Core\Url; | |
5 use Drupal\Tests\BrowserTestBase; | 6 use Drupal\Tests\BrowserTestBase; |
6 | 7 |
7 /** | 8 /** |
8 * Tests browser language detection. | 9 * Tests browser language detection. |
9 * | 10 * |
48 '%browser' => $browser_langcode, | 49 '%browser' => $browser_langcode, |
49 ]; | 50 ]; |
50 $this->assertRaw(t('The mapping for the %browser browser language code has been deleted.', $t_args), 'The test browser language code has been deleted.'); | 51 $this->assertRaw(t('The mapping for the %browser browser language code has been deleted.', $t_args), 'The test browser language code has been deleted.'); |
51 | 52 |
52 // Check we went back to the browser negotiation mapping overview. | 53 // Check we went back to the browser negotiation mapping overview. |
53 $this->assertUrl(\Drupal::url('language.negotiation_browser', [], ['absolute' => TRUE])); | 54 $this->assertUrl(Url::fromRoute('language.negotiation_browser', [], ['absolute' => TRUE])->toString()); |
54 // Check that ch-zn no longer exists. | 55 // Check that ch-zn no longer exists. |
55 $this->assertNoField('edit-mappings-zh-cn-browser-langcode', 'Chinese browser language code no longer exists.'); | 56 $this->assertNoField('edit-mappings-zh-cn-browser-langcode', 'Chinese browser language code no longer exists.'); |
56 | 57 |
57 // Add a new custom mapping. | 58 // Add a new custom mapping. |
58 $edit = [ | 59 $edit = [ |
59 'new_mapping[browser_langcode]' => 'xx', | 60 'new_mapping[browser_langcode]' => 'xx', |
60 'new_mapping[drupal_langcode]' => 'en', | 61 'new_mapping[drupal_langcode]' => 'en', |
61 ]; | 62 ]; |
62 $this->drupalPostForm('admin/config/regional/language/detection/browser', $edit, t('Save configuration')); | 63 $this->drupalPostForm('admin/config/regional/language/detection/browser', $edit, t('Save configuration')); |
63 $this->assertUrl(\Drupal::url('language.negotiation_browser', [], ['absolute' => TRUE])); | 64 $this->assertUrl(Url::fromRoute('language.negotiation_browser', [], ['absolute' => TRUE])->toString()); |
64 $this->assertField('edit-mappings-xx-browser-langcode', 'xx', 'Browser language code found.'); | 65 $this->assertField('edit-mappings-xx-browser-langcode', 'xx', 'Browser language code found.'); |
65 $this->assertField('edit-mappings-xx-drupal-langcode', 'en', 'Drupal language code found.'); | 66 $this->assertField('edit-mappings-xx-drupal-langcode', 'en', 'Drupal language code found.'); |
66 | 67 |
67 // Add the same custom mapping again. | 68 // Add the same custom mapping again. |
68 $this->drupalPostForm('admin/config/regional/language/detection/browser', $edit, t('Save configuration')); | 69 $this->drupalPostForm('admin/config/regional/language/detection/browser', $edit, t('Save configuration')); |
80 $edit = [ | 81 $edit = [ |
81 'mappings[xx][browser_langcode]' => 'xx', | 82 'mappings[xx][browser_langcode]' => 'xx', |
82 'mappings[xx][drupal_langcode]' => 'zh-hans', | 83 'mappings[xx][drupal_langcode]' => 'zh-hans', |
83 ]; | 84 ]; |
84 $this->drupalPostForm('admin/config/regional/language/detection/browser', $edit, t('Save configuration')); | 85 $this->drupalPostForm('admin/config/regional/language/detection/browser', $edit, t('Save configuration')); |
85 $this->assertUrl(\Drupal::url('language.negotiation_browser', [], ['absolute' => TRUE])); | 86 $this->assertUrl(Url::fromRoute('language.negotiation_browser', [], ['absolute' => TRUE])->toString()); |
86 $this->assertField('edit-mappings-xx-browser-langcode', 'xx', 'Browser language code found.'); | 87 $this->assertField('edit-mappings-xx-browser-langcode', 'xx', 'Browser language code found.'); |
87 $this->assertField('edit-mappings-xx-drupal-langcode', 'zh-hans', 'Drupal language code found.'); | 88 $this->assertField('edit-mappings-xx-drupal-langcode', 'zh-hans', 'Drupal language code found.'); |
88 } | 89 } |
89 | 90 |
90 } | 91 } |