1 translation.test | TranslationTestCase::createPage($title, $body, $langcode = NULL) |
Creates a "Page" in the specified language.
Parameters
$title: The title of a page in the specified language.
$body: The body of a page in the specified language.
$language: (optional) Language code.
Return value
A node object.:
File
- core/
modules/ translation/ tests/ translation.test, line 334 - Tests for the Translation module.
Class
- TranslationTestCase
- Functional tests for the Translation module.
Code
function createPage($title, $body, $langcode = NULL) {
$edit = array();
$field_langcode = LANGUAGE_NONE;
$edit["title"] = $title;
$edit["body[$field_langcode][0][value]"] = $body;
if (!empty($langcode)) {
$edit['langcode'] = $langcode;
}
$this->backdropPost('node/add/page', $edit, t('Save'));
$this->assertRaw(t('Page %title has been created.', array('%title' => $title)), 'Page created.');
// Check to make sure the node was created.
$node = $this->backdropGetNodeByTitle($title);
$this->assertTrue($node, t('Node found in database.'));
return $node;
}