You are here

public function HreflangContentTranslationTest::testHreflangContentTranslation in Hreflang 7

Test that Content translation doesn't trigger an exception.

File

./hreflang.test, line 119
Functional tests for Hreflang.

Class

HreflangContentTranslationTest
Functional tests for Hreflang with Content translation.

Code

public function testHreflangContentTranslation() {

  // User to add language.
  $admin_user = $this
    ->drupalCreateUser(array(
    'access administration pages',
    'access content',
    'administer content types',
    'administer languages',
    'create page content',
  ));
  $this
    ->drupalLogin($admin_user);

  // Add predefined language.
  $edit = array(
    'langcode' => 'fr',
  );
  $this
    ->drupalPost('admin/config/regional/language/add', $edit, t('Add language'));

  // Enable language detection.
  $edit = array(
    'language[enabled][locale-url]' => 1,
  );
  $this
    ->drupalPost('admin/config/regional/language/configure', $edit, t('Save settings'));

  // Set "Basic page" content type to use translation.
  $this
    ->drupalGet('admin/structure/types/manage/page');
  $edit = array();
  $edit['language_content_type'] = 2;
  $this
    ->drupalPost('admin/structure/types/manage/page', $edit, t('Save content type'));

  // Create an English-language node.
  $edit = array();
  $edit['title'] = $this
    ->randomName(8);
  $edit['body[' . LANGUAGE_NONE . '][0][value]'] = $this
    ->randomName(16);
  $edit['language'] = 'fr';
  $this
    ->drupalPost('node/add/page', $edit, t('Save'));
}