checkBookNode example

// Create two books.     $book_1_nodes = $this->createBook(['moderation_state[0][state]' => 'published']);
    $book_1 = $this->book;

    $this->createBook(['moderation_state[0][state]' => 'published']);
    $book_2 = $this->book;

    $this->drupalLogin($this->bookAuthor);

    // Check that book pages display along with the correct outlines.     $this->book = $book_1;
    $this->checkBookNode($book_1[$book_1_nodes[0]$book_1_nodes[3]$book_1_nodes[4]], FALSE, FALSE, $book_1_nodes[0][]);
    $this->checkBookNode($book_1_nodes[0][$book_1_nodes[1]$book_1_nodes[2]]$book_1$book_1$book_1_nodes[1][$book_1]);

    // Create a new book page without actually attaching it to a book and create     // a draft.     $edit = [
      'title[0][value]' => $this->randomString(),
      'moderation_state[0][state]' => 'published',
    ];
    $this->drupalGet('node/add/book');
    $this->submitForm($edit, 'Save');
    $node = $this->drupalGetNodeByTitle($edit['title[0][value]']);
    

  public function testBook() {
    // Create new book.     $nodes = $this->createBook();
    $book = $this->book;

    $this->drupalLogin($this->webUser);

    // Check that book pages display along with the correct outlines and     // previous/next links.     $this->checkBookNode($book[$nodes[0]$nodes[3]$nodes[4]], FALSE, FALSE, $nodes[0][]);
    $this->checkBookNode($nodes[0][$nodes[1]$nodes[2]]$book$book$nodes[1][$book]);
    $this->checkBookNode($nodes[1], NULL, $nodes[0]$nodes[0]$nodes[2][$book$nodes[0]]);
    $this->checkBookNode($nodes[2], NULL, $nodes[1]$nodes[0]$nodes[3][$book$nodes[0]]);
    $this->checkBookNode($nodes[3], NULL, $nodes[2]$book$nodes[4][$book]);
    $this->checkBookNode($nodes[4], NULL, $nodes[3]$book, FALSE, [$book]);

    $this->drupalLogout();
    $this->drupalLogin($this->bookAuthor);

    // Check the presence of expected cache tags.     $this->drupalGet('node/add/book');
    
Home | Imprint | This part of the site doesn't use cookies.