function TranslationTestCase::createPage

7.x translation.test TranslationTestCase::createPage($title, $body, $language = NULL)

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 drupal-7.x/modules/translation/translation.test
Creates, modifies, and updates a basic page with a translation.
TranslationTestCase::testLanguageSwitcherBlockIntegration in drupal-7.x/modules/translation/translation.test
Tests that the language switcher block alterations work as intended.
TranslationTestCase::testLanguageSwitchLinks in drupal-7.x/modules/translation/translation.test
Checks that the language switch links behave properly.

File

drupal-7.x/modules/translation/translation.test, line 328
Tests for the Translation module.

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