function TranslationTestCase::createPage

Creates a "Basic page" in the specified language.

Parameters

$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.

Return value

A node object.

3 calls to TranslationTestCase::createPage()
TranslationTestCase::testContentTranslation in modules/translation/translation.test
Creates, modifies, and updates a basic page with a translation.
TranslationTestCase::testLanguageSwitcherBlockIntegration in modules/translation/translation.test
Tests that the language switcher block alterations work as intended.
TranslationTestCase::testLanguageSwitchLinks in modules/translation/translation.test
Checks that the language switch links behave properly.

File

modules/translation/translation.test, line 330

Class

TranslationTestCase
Functional tests for the Translation module.

Code

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;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.