You are here

function Drupali18nTestCase::createNode in Internationalization 7

Create a node of the specified type in the specified language.

Parameters

$type: The node type.

$title: Title of node in specified language.

$body: Body of node in specified language.

$langcode: Language code.

7 calls to Drupali18nTestCase::createNode()
i18nMenuTestCase::testNodeMenuItems in i18n_menu/i18n_menu.test
Test menu items for nodes.
I18nNodeTestCase::testAddContentToTranslationSet in i18n_node/i18n_node.test
Tests for adding content to an existing translation set.
i18nPathTestCase::testPathTranslation in i18n_path/i18n_path.test
I18NSelectAdminViewsAjax::testViewsAjaxWithoutSkippingTags in i18n_select/i18n_select.test
Test AJAX of a view without skipping tags for selection.
i18nSelectTestCase::testIi18nSelect in i18n_select/i18n_select.test

... See full list

File

./i18n.test, line 158
Base class for Internationalization tests

Class

Drupali18nTestCase
@file Base class for Internationalization tests

Code

function createNode($type, $title, $body, $langcode, $edit = array()) {
  $lang = LANGUAGE_NONE;
  $edit["title"] = $title;
  $edit["body[{$lang}][0][value]"] = $body;
  $edit['language'] = $langcode;
  $this
    ->drupalPost('node/add/' . $type, $edit, t('Save'));
  $info = node_type_load($type);
  $message = t('@name %title has been created.', array(
    '@name' => $info->name,
    '%title' => $title,
  ));
  $this
    ->assertRaw($message);

  // Check to make sure the node was created.
  $node = $this
    ->drupalGetNodeByTitle($title);
  $this
    ->assertTrue($node, t('Node found in database.'));
  return $node;
}