You are here

protected function I18nBookNavigationTestBase::makeBooksTranslatable in Book translation 7.2

Enables translations on book nodes.

Parameters

bool $use_entity_translation: (optional) Wether to use Entity translation. Defaults to false.

2 calls to I18nBookNavigationTestBase::makeBooksTranslatable()
I18nBookNavigationEntityTranslationTestCase::testEntityTranslationIntegration in tests/i18n_book_navigation.test
Test entity_translation and title integration.
I18nBookNavigationTestBase::setUp in tests/i18n_book_navigation.test
Sets up a Drupal site for running functional and integration tests.

File

tests/i18n_book_navigation.test, line 67
Unit tests for the Book translation module.

Class

I18nBookNavigationTestBase
@file Unit tests for the Book translation module.

Code

protected function makeBooksTranslatable($use_entity_translation = FALSE) {
  $edit = array(
    'language_content_type' => $use_entity_translation ? 4 : 2,
  );
  $this
    ->drupalPost('admin/structure/types/manage/book', $edit, t("Save content type"));

  // Make fields translatable.
  if ($use_entity_translation) {
    $this
      ->drupalGet('admin/structure/types/manage/book/fields');

    // Title field.
    $this
      ->clickLink('replace');
    $edit = array(
      'enabled' => 1,
    );
    $this
      ->drupalPost(NULL, $edit, t("Save settings"));

    // Body field.
    $this
      ->drupalGet('admin/structure/types/manage/page/fields/body');
    $edit = array(
      'field[translatable]' => 1,
    );
    $this
      ->drupalPost(NULL, $edit, t("Save settings"));
  }
}