You are here

function EntityTranslationTestCase::createPage in Entity Translation 7

Create a "Basic page" in the specified language.

Parameters

$title: Title of the basic page in the specified language.

$body: Body of the basic page in the specified language.

$langcode: The language code to be assigned to the specified values.

5 calls to EntityTranslationTestCase::createPage()
EntityTranslationCommentTestCase::testCommentLanguageFiltering in tests/entity_translation.test
Test comment filtering by language.
EntityTranslationHookTestCase::testAPI in tests/entity_translation.test
Test whether hooks are properly fired when using the API.
EntityTranslationHookTestCase::testFormWorkflow in tests/entity_translation.test
Test whether hooks are properly fired in the regular form workflow.
EntityTranslationIntegrationTestCase::testPathautoIntegration in tests/entity_translation.test
Tests Pathauto integration.
EntityTranslationTranslationTestCase::testFieldTranslation in tests/entity_translation.test
Test if field based translation works.
2 methods override EntityTranslationTestCase::createPage()
EntityTranslationContentTranslationTestCase::createPage in tests/entity_translation.test
EntityTranslationMenuTranslationTestCase::createPage in entity_translation_i18n_menu/entity_translation_i18n_menu.test
Create page with menu item.

File

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

Class

EntityTranslationTestCase
Base class for entity translation module tests.

Code

function createPage($title, $body, $langcode) {
  $edit = array();
  $edit["title"] = $title;
  $edit["body[{$langcode}][0][value]"] = $body;
  $edit['language'] = $langcode;
  $this
    ->drupalPost('node/add/page', $edit, t('Save'));
  $this
    ->assertRaw(t('Basic page %title has been created.', array(
    '%title' => $title,
  )), t('Basic page created.'));

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