You are here

protected function SitemapBookTest::createBook in Sitemap 8

Same name and namespace in other branches
  1. 8.2 src/Tests/SitemapBookTest.php \Drupal\sitemap\Tests\SitemapBookTest::createBook()
  2. 2.0.x src/Tests/SitemapBookTest.php \Drupal\sitemap\Tests\SitemapBookTest::createBook()

Creates a new book with a page hierarchy. Adapted from BookTest.

1 call to SitemapBookTest::createBook()
SitemapBookTest::testBooks in src/Tests/SitemapBookTest.php
Tests books.

File

src/Tests/SitemapBookTest.php, line 91

Class

SitemapBookTest
Test the display of books based on sitemap settings.

Namespace

Drupal\sitemap\Tests

Code

protected function createBook() {
  $this->book = $this
    ->createBookNode('new');
  $book = $this->book;

  /*
   * Add page hierarchy to book.
   * Node 00 (top level), created above
   *  |- Node 01
   *   |- Node 02
   *   |- Node 03
   *  |- Node 04
   *  |- Node 05
   */
  $nodes = [];
  $nodes[] = $this
    ->createBookNode($book
    ->id());
  $nodes[] = $this
    ->createBookNode($book
    ->id(), $nodes[0]->book['nid']);
  $nodes[] = $this
    ->createBookNode($book
    ->id(), $nodes[0]->book['nid']);
  $nodes[] = $this
    ->createBookNode($book
    ->id());
  $nodes[] = $this
    ->createBookNode($book
    ->id());
  return $nodes;
}