diff --git a/core/modules/book/lib/Drupal/book/Tests/BookTest.php b/core/modules/book/lib/Drupal/book/Tests/BookTest.php index a1a88c4..bfe25da 100644 --- a/core/modules/book/lib/Drupal/book/Tests/BookTest.php +++ b/core/modules/book/lib/Drupal/book/Tests/BookTest.php @@ -43,7 +43,7 @@ function setUp() { node_access_rebuild(); // Create users. - $this->book_author = $this->drupalCreateUser(array('create new books', 'create book content', 'edit own book content', 'add content to books')); + $this->book_author = $this->drupalCreateUser(array('create new books', 'create book content', 'edit own book content', 'add content to books', 'view own unpublished content', 'access printer-friendly version')); $this->web_user = $this->drupalCreateUser(array('access printer-friendly version', 'node test view')); $this->admin_user = $this->drupalCreateUser(array('create new books', 'create book content', 'edit own book content', 'add content to books', 'administer blocks', 'administer permissions', 'administer book outlines', 'node test view')); } @@ -66,6 +66,8 @@ function createBook() { * |- Node 2 * |- Node 3 * |- Node 4 + * |- Node 5 (unpublished) + * |- Node 6 */ $nodes = array(); $nodes[] = $this->createBookNode($book->nid); // Node 0. @@ -73,6 +75,15 @@ function createBook() { $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. + // Test an unpublished node - set the default to unpublished. + $options = variable_get('node_options_book', array()); + $options['status'] = 0; + variable_set('node_options_book', $options); + $nodes[] = $this->createBookNode($book->nid, NULL); // Node 5 (unpublished). + // Reset status to published. + $options['status'] = 1; + variable_set('node_options_book', $options); + $nodes[] = $this->createBookNode($book->nid, $nodes[5]->book['mlid']); // Node 6. $this->drupalLogout(); @@ -102,6 +113,7 @@ function testBook() { // Create a second book, and move an existing book page into it. $this->drupalLogin($this->book_author); + $this->checkBookNode($nodes[6], NULL, $nodes[5], $nodes[5], FALSE, array($book, $nodes[5])); $other_book = $this->createBookNode('new'); $node = $this->createBookNode($book->nid); $edit = array('book[bid]' => $other_book->nid);