Creates a "Basic page" in the specified language.
$title: The title of a basic page in the specified language.
$body: The body of a basic page in the specified language.
$language: (optional) Language code.
A node object.
function createPage($title, $body, $language = NULL) {
$edit = array();
$langcode = LANGUAGE_NONE;
$edit["title"] = $title;
$edit["body[{$langcode}][0][value]"] = $body;
if (!empty($language)) {
$edit['language'] = $language;
}
$this
->drupalPost('node/add/page', $edit, t('Save'));
$this
->assertRaw(t('Basic page %title has been created.', array(
'%title' => $title,
)), 'Basic page created.');
// Check to make sure the node was created.
$node = $this
->drupalGetNodeByTitle($title);
$this
->assertTrue($node, 'Node found in database.');
return $node;
}