1 book.test | BookTestCase::createBook() |
Creates a new book with a page hierarchy.
File
- core/
modules/ book/ tests/ book.test, line 58 - Tests for book.module.
Class
- BookTestCase
- Tests the functionality of the Book module.
Code
function createBook() {
// Create new book.
$this->backdropLogin($this->book_author);
$this->book = $this->createBookNode('new');
$book = $this->book;
/*
* Add page hierarchy to book.
* Book
* |- Node 0
* |- Node 1
* |- Node 2
* |- Node 3
* |- Node 4
*/
$nodes = array();
$nodes[] = $this->createBookNode($book->nid); // Node 0.
$nodes[] = $this->createBookNode($book->nid, $nodes[0]->book['mlid']); // Node 1.
$nodes[] = $this->createBookNode($book->nid, $nodes[0]->book['mlid']); // Node 2.
$nodes[] = $this->createBookNode($book->nid); // Node 3.
$nodes[] = $this->createBookNode($book->nid); // Node 4.
$this->backdropLogout();
return $nodes;
}