You are here

function TranslationModuleTestCase::create_translation in SimpleTest 6

Create a translation for the specified story in the specified language.

Parameters

integer $nid Node id of story to create translation for.:

string $title Title of story in specified language.:

string $body Body of story in specified language.:

string $language Langauge code.:

1 call to TranslationModuleTestCase::create_translation()
TranslationModuleTestCase::test_content_translation in tests/translation_module.test

File

tests/translation_module.test, line 132

Class

TranslationModuleTestCase

Code

function create_translation($nid, $title, $body, $language) {
  $this
    ->drupalGet('node/add/story', array(
    'query' => array(
      'translation' => $nid,
      'language' => $language,
    ),
  ));
  $edit = array();
  $edit['title'] = $title;
  $edit['body'] = $body;
  $this
    ->drupalPost(NULL, $edit, 'Save');
  $this
    ->assertWantedRaw(t('Story %title has been created.', array(
    '%title' => $edit['title'],
  )), 'Translation created.');

  // Check to make sure that translation was successfull.
  $node = node_load(array(
    'title' => $edit['title'],
  ));
  $this
    ->assertTrue($node, 'Node found in database.');
  return $node;
}