You are here

public function SearchByPageIntlTest::translateEnvironment in Search by Page 7

Same name and namespace in other branches
  1. 6 tests/search_by_page.test \SearchByPageIntlTest::translateEnvironment()

Translates environment 1.

1 call to SearchByPageIntlTest::translateEnvironment()
SearchByPageIntlTest::testTranslations in tests/search_by_page.test
Tests that environment settings for main module and paths are translated.

File

tests/search_by_page.test, line 3060
Tests for the Search by Page module. By Jennifer Hodgdon of Poplar ProductivityWare, www.poplarware.com

Class

SearchByPageIntlTest
Environment internationalization test.

Code

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
      ->drupalPost('admin/config/regional/translate/translate', array(
      'string' => $english,
    ), 'Filter');
    $this
      ->assertLink('edit', 0, 'Found translation link for ' . $english);
    $this
      ->clickLink('edit');
    $this
      ->drupalPost(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
    ->drupalPost('admin/config/regional/translate/translate', array(
    'string' => $english,
    'group' => 'default',
  ), 'Filter');
  $this
    ->assertLink('edit', 0, 'Found translation link for ' . $english);
  $this
    ->clickLink('edit');
  $this
    ->drupalPost(NULL, array(
    'translations[' . $lang . ']' => $this->strings_to_test[$key],
  ), 'Save translations');
}