You are here

function Drupali18nTestCase::setUpContentType in Internationalization 7

Set up content-type (with translation).

2 calls to Drupali18nTestCase::setUpContentType()
Drupali18nTestCase::setUpContentTranslation in ./i18n.test
Set up translation for content type (default: page).
i18nPathTestCase::testPathTranslation in i18n_path/i18n_path.test

File

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

Class

Drupali18nTestCase
@file Base class for Internationalization tests

Code

function setUpContentType($settings = array()) {
  $settings += array(
    'type' => 'page',
    'mode' => TRANSLATION_ENABLED,
    'status' => 1,
    'promote' => 0,
  );
  $type = node_type_get_type($settings['type']);

  // Create content editor with translation permissions.
  $this->content_editor = $this
    ->drupalCreateUser(array(
    'create ' . $type->type . ' content',
    'edit own ' . $type->type . ' content',
    'translate content',
    'translate interface',
  ));
  $this
    ->drupalLogin($this->admin_user);

  // Set content type to use multilingual support with translation.
  $this
    ->drupalGet('admin/structure/types/manage/' . $type->type);
  $edit = array();
  $edit['language_content_type'] = $settings['mode'];

  // Mark status and promoted
  $edit['node_options[status]'] = $settings['status'];
  $edit['node_options[promote]'] = $settings['promote'];
  $this
    ->drupalPost('admin/structure/types/manage/' . $type->type, $edit, t('Save content type'));
  $this
    ->assertRaw(t('The content type %type has been updated.', array(
    '%type' => $type->name,
  )), t('%type content type has been updated.', array(
    '%type' => $type->name,
  )));
  $this
    ->drupalGet('admin/structure/types/manage/' . $type->type);
  $this
    ->enableLanguageBlock();
}