diff --git a/core/modules/help/src/Tests/HelpTopicTranslateTest.php b/core/modules/help/src/Tests/HelpTopicTranslateTest.php new file mode 100644 index 0000000..74205f0 --- /dev/null +++ b/core/modules/help/src/Tests/HelpTopicTranslateTest.php @@ -0,0 +1,76 @@ +adminUser = $this->drupalCreateUser(array('access administration pages', 'administer help topics', 'use text format help', 'translate configuration', 'administer languages', 'administer site configuration')); + } + + /** + * Logs in users, tests help translation + */ + public function testHelpTranslation() { + $this->drupalLogin($this->adminUser); + + // Add a language. + ConfigurableLanguage::createFromLangcode('es')->save(); + + // Verify that the help topics admin page has translate links. + $this->drupalGet('admin/config/development/help'); + $this->assertLink(t('Translate')); + + // Translate a topic. + $es_body = 'This is the fake Spanish body'; + $es_title = 'This is the fake Spanish title'; + $this->drupalGet('admin/config/development/help/help_test/edit/translate'); + $this->clickLink(t('Add')); + $this->drupalPostForm(NULL, array( + 'config_names[help.topic.help_test][label][translation]' => $es_title, + 'config_names[help.topic.help_test][body][body.value][translation]' => $es_body, + ), t('Save translation')); + + // Visit the page in English and verify. + $this->drupalGet('admin/help-topic/help_test'); + $this->assertText('Help Test module'); + $this->assertText('This is a test.'); + $this->assertNoText($es_title); + $this->assertNoText($es_body); + + // Visit the page in Spanish and verify. + $this->drupalGet('es/admin/help-topic/help_test'); + $this->assertNoText('Help Test module'); + $this->assertNoText('This is a test.'); + $this->assertText($es_title); + $this->assertText($es_body); + } + +}