function TranslationModuleTestCase::test_content_translation in SimpleTest 6
File
- tests/translation_module.test, line 22
Class
- TranslationModuleTestCase
Code
function test_content_translation() {
$admin_user = $this
->drupalCreateUserRolePerm(array(
'administer languages',
'administer content types',
));
$translator = $this
->drupalCreateUserRolePerm(array(
'create story content',
'edit own story content',
'translate content',
));
$this
->drupalLoginUser($admin_user);
$this
->add_language('en');
$this
->add_language('es');
$this
->drupalPost('admin/content/node-type/story', array(
'language_content_type' => "2",
), 'Save content type');
$this
->assertWantedRaw(t('The content type %type has been updated.', array(
'%type' => 'Story',
)), 'Story content type has been updated.');
$this
->drupalGet('logout');
$this
->drupalLoginUser($translator);
$node_title = 'Test Translation ' . $this
->randomName();
$node = $this
->create_story($node_title, 'Node body.', 'en');
$node_trans_title = 'Test Traduccion ' . $this
->randomName();
$node_trans = $this
->create_translation($node->nid, $node_trans_title, 'Nodo cuerpo.', 'es');
$edit = array();
$edit['body'] = 'Node body. Additional Text.';
$edit['translation[retranslate]'] = TRUE;
$this
->drupalPost('node/' . $node->nid . '/edit', $edit, 'Save');
$this
->assertWantedRaw(t('Story %title has been updated.', array(
'%title' => $node_title,
)), 'Original node updated.');
$this
->drupalGet('node/' . $node->nid . '/translate');
$this
->assertWantedRaw('<span class="marker">' . t('outdated') . '</span>', 'Translation marked as outdated.');
$edit = array();
$edit['body'] = 'Nodo cuerpo. Texto adicional.';
$edit['translation[status]'] = FALSE;
$this
->drupalPost('node/' . $node_trans->nid . '/edit', $edit, 'Save');
$this
->assertWantedRaw(t('Story %title has been updated.', array(
'%title' => $node_trans_title,
)), 'Translated node updated.');
}