public function SearchByPageIntlTest::translateEnvironment in Search by Page 8
Translates environment 1.
1 call to SearchByPageIntlTest::translateEnvironment()
- SearchByPageIntlTest::testTranslations in tests/
src/ Functional/ search_by_page.test - Tests that environment settings for main module and paths are translated.
File
- tests/
src/ Functional/ search_by_page.test, line 2759 - Tests for the Search by Page module. By Jennifer Hodgdon of Poplar ProductivityWare, www.poplarware.com
Class
- SearchByPageIntlTest
- Environment internationalization test.
Namespace
Drupal\Tests\search_by_page\FunctionalCode
public function translateEnvironment() {
$stuff = $this->envinfo1;
$lang = $this->lang_to_use;
foreach ($this->strings_to_test as $key => $trans) {
// Find the string in the translate interface.
$english = $stuff[$key];
$this
->drupalPostForm('admin/config/regional/translate/translate', array(
'string' => $english,
), 'Filter');
$this
->assertLink('edit', 0, 'Found translation link for ' . $english);
$this
->clickLink('edit');
$this
->drupalPostForm(NULL, array(
'translations[' . $lang . ']' => $trans,
), 'Save translations');
}
// Special case for the page title: since it's in hook_menu, it gets
// into the translate interface as part of the built-in interface. So
// make sure that version of it is translated too.
$key = 'page_title';
$english = $stuff[$key];
$this
->drupalPostForm('admin/config/regional/translate/translate', array(
'string' => $english,
'group' => 'default',
), 'Filter');
$this
->assertLink('edit', 0, 'Found translation link for ' . $english);
$this
->clickLink('edit');
$this
->drupalPostForm(NULL, array(
'translations[' . $lang . ']' => $this->strings_to_test[$key],
), 'Save translations');
}