You are here

protected function I18nBookNavigationTestBase::createBookOutline in Book translation 7.2

Creates a book outline in the desired language.

Parameters

string $language: (optional) The language of the nodes. Defaults to 'en'.

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

Return value

array The book bid as the 1st key and the nodes in an array as the 2nd key..

5 calls to I18nBookNavigationTestBase::createBookOutline()
I18nBookNavigationMenuBlockTestCase::testMenuBlockIntegration in tests/i18n_book_navigation.test
Test menu_block integration.
I18nBookNavigationPanelsTestCase::testPanelsIntegration in tests/i18n_book_navigation.test
Test panels integration.
I18nBookNavigationTestBase::outlineTranslation in tests/i18n_book_navigation.test
Test outline translations.
I18nBookNavigationTestCase::testCoreLogic in tests/i18n_book_navigation.test
Test core logic.
I18nBookNavigationTestCase::testIssue1619026 in tests/i18n_book_navigation.test
Regression test for [#1619026].

File

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

Class

I18nBookNavigationTestBase
@file Unit tests for the Book translation module.

Code

protected function createBookOutline($language = 'en', $use_entity_translation = FALSE) {
  $this->book = $this
    ->createBookNode('new', NULL, $language, $use_entity_translation);

  // Add page hierarchy to book.
  // Book - Node 0
  //  |- Node 1
  //    |- Node 2
  //    |- Node 3
  //  |- Node 4
  //  |- Node 5
  $nodes = array();

  // Node 1.
  $nodes[] = $this->book;
  $nodes[] = $this
    ->createBookNode($this->book->nid, NULL, $language, $use_entity_translation);

  // Node 2.
  $nodes[] = $this
    ->createBookNode($this->book->nid, $nodes[1]->book['mlid'], $language, $use_entity_translation);

  // Node 3.
  $nodes[] = $this
    ->createBookNode($this->book->nid, $nodes[1]->book['mlid'], $language, $use_entity_translation);

  // Node 4.
  $nodes[] = $this
    ->createBookNode($this->book->nid, NULL, $language, $use_entity_translation);

  // Node 5.
  $nodes[] = $this
    ->createBookNode($this->book->nid, NULL, $language, $use_entity_translation);
  return array(
    $this->book->nid,
    $nodes,
  );
}