Mercurial > hg > isophonics-drupal-site
comparison core/modules/language/tests/src/Functional/LanguageConfigurationTest.php @ 18:af1871eacc83
Update to Drupal core 8.7.1
author | Chris Cannam |
---|---|
date | Thu, 09 May 2019 15:33:08 +0100 |
parents | 7a779792577d |
children |
comparison
equal
deleted
inserted
replaced
17:129ea1e6d783 | 18:af1871eacc83 |
---|---|
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\Core\Language\LanguageInterface; | 6 use Drupal\Core\Language\LanguageInterface; |
6 use Drupal\language\Entity\ConfigurableLanguage; | 7 use Drupal\language\Entity\ConfigurableLanguage; |
7 use Drupal\Tests\BrowserTestBase; | 8 use Drupal\Tests\BrowserTestBase; |
8 | 9 |
9 /** | 10 /** |
44 $edit = [ | 45 $edit = [ |
45 'predefined_langcode' => 'fr', | 46 'predefined_langcode' => 'fr', |
46 ]; | 47 ]; |
47 $this->drupalPostForm(NULL, $edit, 'Add language'); | 48 $this->drupalPostForm(NULL, $edit, 'Add language'); |
48 $this->assertText('French'); | 49 $this->assertText('French'); |
49 $this->assertUrl(\Drupal::url('entity.configurable_language.collection', [], ['absolute' => TRUE]), [], 'Correct page redirection.'); | 50 $this->assertUrl(Url::fromRoute('entity.configurable_language.collection', [], ['absolute' => TRUE])->toString(), [], 'Correct page redirection.'); |
50 // Langcode for Languages is always 'en'. | 51 // Langcode for Languages is always 'en'. |
51 $language = $this->config('language.entity.fr')->get(); | 52 $language = $this->config('language.entity.fr')->get(); |
52 $this->assertEqual($language['langcode'], 'en'); | 53 $this->assertEqual($language['langcode'], 'en'); |
53 | 54 |
54 // Check if the Default English language has no path prefix. | 55 // Check if the Default English language has no path prefix. |
67 'site_default_language' => 'fr', | 68 'site_default_language' => 'fr', |
68 ]; | 69 ]; |
69 $this->drupalPostForm(NULL, $edit, t('Save configuration')); | 70 $this->drupalPostForm(NULL, $edit, t('Save configuration')); |
70 $this->rebuildContainer(); | 71 $this->rebuildContainer(); |
71 $this->assertFieldChecked('edit-site-default-language-fr', 'Default language updated.'); | 72 $this->assertFieldChecked('edit-site-default-language-fr', 'Default language updated.'); |
72 $this->assertUrl(\Drupal::url('entity.configurable_language.collection', [], ['absolute' => TRUE, 'langcode' => 'fr']), [], 'Correct page redirection.'); | 73 $this->assertUrl(Url::fromRoute('entity.configurable_language.collection', [], ['absolute' => TRUE, 'langcode' => 'fr'])->toString(), [], 'Correct page redirection.'); |
73 | 74 |
74 // Check if a valid language prefix is added after changing the default | 75 // Check if a valid language prefix is added after changing the default |
75 // language. | 76 // language. |
76 $this->drupalGet('admin/config/regional/language/detection/url'); | 77 $this->drupalGet('admin/config/regional/language/detection/url'); |
77 $this->assertFieldByXPath('//input[@name="prefix[en]"]', 'en', 'A valid path prefix has been added to the previous default language.'); | 78 $this->assertFieldByXPath('//input[@name="prefix[en]"]', 'en', 'A valid path prefix has been added to the previous default language.'); |