### Eclipse Workspace Patch 1.0
#P simpletest
Index: tests/functional/translation.test
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/simpletest/tests/functional/translation.test,v
retrieving revision 1.10
diff -u -r1.10 translation.test
--- tests/functional/translation.test 5 Apr 2008 19:19:26 -0000 1.10
+++ tests/functional/translation.test 9 Apr 2008 22:59:18 -0000
@@ -2,24 +2,33 @@
// $Id: translation.test,v 1.10 2008/04/05 19:19:26 boombatower Exp $
class TranslationModuleTestCase extends DrupalTestCase {
- var $book;
+ protected $book;
+ /**
+ * Implementation of getInfo().
+ */
function getInfo() {
return array(
'name' => t('Translation functionality'),
- 'description' => t('Create a story with translation, modify the story outdating translation, and update translation.'),
- 'group' => t('Translation Tests'),
+ 'description' => t('Create a page with translation, modify the page outdating translation, and update translation.'),
+ 'group' => t('Translation Tests')
);
}
+ /**
+ * Implementation of setUp().
+ */
function setUp() {
parent::setUp('locale', 'translation');
}
+ /**
+ * Create a page with translation, modify the page outdating translation, and update translation.
+ */
function testContentTranslation() {
// Setup users.
$admin_user = $this->drupalCreateUser(array('administer languages', 'administer content types', 'access administration pages'));
- $translator = $this->drupalCreateUser(array('create story content', 'edit own story content', 'translate content'));
+ $translator = $this->drupalCreateUser(array('create page content', 'edit own page content', 'translate content'));
$this->drupalLogin($admin_user);
@@ -27,16 +36,17 @@
$this->addLanguage('en');
$this->addLanguage('es');
- // Set story content type to use multilingual support with translation.
- $this->drupalPost('admin/content/node-type/story', array('language_content_type' => "2"), t('Save content type'));
- $this->assertRaw(t('The content type %type has been updated.', array('%type' => 'Story')), 'Story content type has been updated.');
+ // Set page content type to use multilingual support with translation.
+ $this->drupalGet('admin/content/node-type/page');
+ $this->drupalPost('admin/content/node-type/page', array('language_content_type' => '2'), t('Save content type'));
+ $this->assertRaw(t('The content type %type has been updated.', array('%type' => 'Page')), t('Page content type has been updated.'));
- $this->drupalGet('logout');
+ $this->drupalLogout();
$this->drupalLogin($translator);
- // Create story in English.
+ // Create page in English.
$node_title = 'Test Translation '. $this->randomName();
- $node = $this->createStory($node_title, 'Node body.', 'en');
+ $node = $this->createPage($node_title, 'Node body.', 'en');
// Submit translation in Spanish.
$node_trans_title = 'Test Traduccion '. $this->randomName();
@@ -47,18 +57,18 @@
$edit['body'] = 'Node body. Additional Text.';
$edit['translation[retranslate]'] = TRUE;
$this->drupalPost('node/'. $node->nid .'/edit', $edit, t('Save'));
- $this->assertRaw(t('Story %title has been updated.', array('%title' => $node_title)), 'Original node updated.');
+ $this->assertRaw(t('Page %title has been updated.', array('%title' => $node_title)), t('Original node updated.'));
// Check to make sure that interface shows translation as outdated
$this->drupalGet('node/'. $node->nid .'/translate');
- $this->assertRaw(''. t('outdated') .'', 'Translation marked as outdated.');
+ $this->assertRaw(''. t('outdated') .'', t('Translation marked as outdated.'));
// Update translation and mark as updated.
$edit = array();
$edit['body'] = 'Nodo cuerpo. Texto adicional.';
$edit['translation[status]'] = FALSE;
$this->drupalPost('node/'. $node_trans->nid .'/edit', $edit, t('Save'));
- $this->assertRaw(t('Story %title has been updated.', array('%title' => $node_trans_title)), 'Translated node updated.');
+ $this->assertRaw(t('Page %title has been updated.', array('%title' => $node_trans_title)), t('Translated node updated.'));
}
/**
@@ -78,10 +88,10 @@
$this->drupalPost('admin/settings/language/add', $edit, t('Add language'));
$languages = language_list('language', TRUE); // make sure not using cached version
- $this->assertTrue(array_key_exists($language_code, $languages), 'Language was installed successfully.');
+ $this->assertTrue(array_key_exists($language_code, $languages), t('Language was installed successfully.'));
if (array_key_exists($language_code, $languages)) {
- $this->assertRaw(t('The language %language has been created and can now be used. More information is available on the help screen.', array('%language' => $languages[$language_code]->name, '@locale-help' => url('admin/help/locale'))));
+ $this->assertRaw(t('The language %language has been created and can now be used. More information is available on the help screen.', array('%language' => $languages[$language_code]->name, '@locale-help' => url('admin/help/locale'))), t('Language has been created.'));
}
}
else {
@@ -89,57 +99,54 @@
$this->assertTrue(true, 'Language ['. $language_code .'] already installed.');
$this->drupalPost(NULL, array('enabled['. $language_code .']' => TRUE), t('Save configuration'));
- $this->assertRaw(t('Configuration saved.'), 'Language successfully enabled.');
+ $this->assertRaw(t('Configuration saved.'), t('Language successfully enabled.'));
}
}
/**
- * Create a story in the specified language.
+ * Create a page in the specified language.
*
- * @param string $title Title of story in specified language.
- * @param string $body Body of story in specified language.
+ * @param string $title Title of page in specified language.
+ * @param string $body Body of page in specified language.
* @param string $language Langauge code.
*/
- function createStory($title, $body, $language) {
+ function createPage($title, $body, $language) {
$this->drupalVariableSet('node_options_page', array('status', 'promote'));
$edit = array();
$edit['title'] = $title;
$edit['body'] = $body;
$edit['language'] = $language;
- $this->drupalPost('node/add/story', $edit, t('Save'));
-
- $this->assertRaw(t('Story %title has been created.', array('%title' => $edit['title'])), 'Story created.');
+ $this->drupalPost('node/add/page', $edit, t('Save'));
+ $this->assertRaw(t('Page %title has been created.', array('%title' => $edit['title'])), t('Page created.'));
// Check to make sure the node was created.
$node = node_load(array('title' => $edit['title']));
- $this->assertTrue($node, 'Node found in database.');
+ $this->assertTrue($node, t('Node found in database.'));
return $node;
}
/**
- * Create a translation for the specified story in the specified language.
+ * Create a translation for the specified page in the specified language.
*
- * @param integer $nid Node id of story to create translation for.
- * @param string $title Title of story in specified language.
- * @param string $body Body of story in specified language.
+ * @param integer $nid Node id of page to create translation for.
+ * @param string $title Title of page in specified language.
+ * @param string $body Body of page in specified language.
* @param string $language Langauge code.
*/
function createTranslation($nid, $title, $body, $language) {
- $this->drupalGet('node/add/story', array('query' => array('translation' => $nid, 'language' => $language)));
+ $this->drupalGet('node/add/page', array('query' => array('translation' => $nid, 'language' => $language)));
$edit = array();
$edit['title'] = $title;
$edit['body'] = $body;
-
$this->drupalPost(NULL, $edit, t('Save'));
-
- $this->assertRaw(t('Story %title has been created.', array('%title' => $edit['title'])), 'Translation created.');
+ $this->assertRaw(t('Page %title has been created.', array('%title' => $edit['title'])), t('Translation created.'));
// Check to make sure that translation was successfull.
$node = node_load(array('title' => $edit['title']));
- $this->assertTrue($node, 'Node found in database.');
+ $this->assertTrue($node, t('Node found in database.'));
return $node;
}