You are here

public function ScaldLocalizeTestCase::testStringTranslation in Scald: Media Management made easy 7

Adds a language and tests string translation.

File

tests/scald.test, line 627
Tests for scald.module.

Class

ScaldLocalizeTestCase
Test the Scald localization.

Code

public function testStringTranslation() {

  // Go to Scald page in another language to add action name into translation
  // database.
  $this
    ->drupalGet('fr/admin/structure/scald/image');

  // Translate an action name.
  $edit = array(
    'string' => 'Edit',
  );
  $this
    ->drupalPost('admin/config/regional/translate/translate', $edit, t('Filter'));

  // The first result is an exact match, because we don't surf much.
  $this
    ->clickLink(t('edit'));
  $edit = array(
    "translations[{$this->langcode}]" => 'Modifier',
  );
  $this
    ->drupalPost(NULL, $edit, t('Save translations'));
  cache_clear_all('*', 'cache_scald', TRUE);
  $this
    ->drupalGet('fr/admin/structure/scald/image');
  $this
    ->assertFieldByXPath('//label[@for="edit-type-image-actin-edit"]', 'Modifier ', 'Action name is correctly translated.');
  $this
    ->drupalGet('admin/structure/scald/image');
  $this
    ->assertFieldByXPath('//label[@for="edit-type-image-actin-edit"]', 'Edit ', 'Action name is correctly cached per language.');
}