function ConfigTranslationUiTest::testSourceAndTargetLanguage
Same name in other branches
- 8.9.x core/modules/config_translation/tests/src/Functional/ConfigTranslationUiTest.php \Drupal\Tests\config_translation\Functional\ConfigTranslationUiTest::testSourceAndTargetLanguage()
- 10 core/modules/config_translation/tests/src/Functional/ConfigTranslationUiTest.php \Drupal\Tests\config_translation\Functional\ConfigTranslationUiTest::testSourceAndTargetLanguage()
- 11.x core/modules/config_translation/tests/src/Functional/ConfigTranslationUiTest.php \Drupal\Tests\config_translation\Functional\ConfigTranslationUiTest::testSourceAndTargetLanguage()
Tests source and target language edge cases.
File
-
core/
modules/ config_translation/ tests/ src/ Functional/ ConfigTranslationUiTest.php, line 561
Class
- ConfigTranslationUiTest
- Translate settings and entities to various languages.
Namespace
Drupal\Tests\config_translation\FunctionalCode
public function testSourceAndTargetLanguage() {
$this->drupalLogin($this->adminUser);
// Loading translation page for not-specified language (und)
// should return 403.
$this->drupalGet('admin/config/system/site-information/translate/und/add');
$this->assertSession()
->statusCodeEquals(403);
// Check the source language doesn't have 'Add' or 'Delete' link and
// make sure source language edit goes to original configuration page
// not the translation specific edit page.
$this->drupalGet('admin/config/system/site-information/translate');
$this->assertSession()
->linkByHrefNotExists('admin/config/system/site-information/translate/en/edit');
$this->assertSession()
->linkByHrefNotExists('admin/config/system/site-information/translate/en/add');
$this->assertSession()
->linkByHrefNotExists('admin/config/system/site-information/translate/en/delete');
$this->assertSession()
->linkByHrefExists('admin/config/system/site-information');
// Translation addition to source language should return 403.
$this->drupalGet('admin/config/system/site-information/translate/en/add');
$this->assertSession()
->statusCodeEquals(403);
// Translation editing in source language should return 403.
$this->drupalGet('admin/config/system/site-information/translate/en/edit');
$this->assertSession()
->statusCodeEquals(403);
// Translation deletion in source language should return 403.
$this->drupalGet('admin/config/system/site-information/translate/en/delete');
$this->assertSession()
->statusCodeEquals(403);
// Set default language of site information to not-specified language (und).
$this->config('system.site')
->set('langcode', LanguageInterface::LANGCODE_NOT_SPECIFIED)
->save();
// Make sure translation tab does not exist on the configuration page.
$this->drupalGet('admin/config/system/site-information');
$this->assertSession()
->linkByHrefNotExists('admin/config/system/site-information/translate');
// If source language is not specified, translation page should be 403.
$this->drupalGet('admin/config/system/site-information/translate');
$this->assertSession()
->statusCodeEquals(403);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.