You are here

function EntityTranslationContentTranslationTestCase::createPage in Entity Translation 7

Overrides EntityTranslationTestCase::createPage

See also

TranslationTestCase::createPage()

1 call to EntityTranslationContentTranslationTestCase::createPage()
EntityTranslationContentTranslationTestCase::testCopyFieldsUsingContentTranslation in tests/entity_translation.test
Tests copying of source node's body value in the add translation form page.

File

tests/entity_translation.test, line 720
Tests for Entity translation module.

Class

EntityTranslationContentTranslationTestCase
Basic tests for nodes using both content and entity translation.

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