diff -u b/core/modules/book/tests/src/Functional/BookTest.php b/core/modules/book/tests/src/Functional/BookTest.php --- b/core/modules/book/tests/src/Functional/BookTest.php +++ b/core/modules/book/tests/src/Functional/BookTest.php @@ -501,7 +501,7 @@ */ public function testBookListing() { // Create a new book. - $nodes = $this->createBook(); + $this->createBook(); // Must be a user with 'node test view' permission since node_access_test is installed. $this->drupalLogin($this->webUser); @@ -510,24 +510,6 @@ $this->drupalGet('book'); $this->assertText($this->book->label(), 'The book title is displayed on the book listing page.'); - - // Unpublish the top book page and confirm that the created book title is - // not displayed for anonymous. - $this->book->setUnpublished(); - $this->book->save(); - - $this->drupalGet('book'); - $this->assertSession()->responseNotContains($this->book->label()); - - // Publish the top book page and unpublish a page in the book and confirm - // that the created book title is displayed for anonymous. - $this->book->setPublished(); - $this->book->save(); - $nodes[0]->setUnpublished(); - $nodes[0]->save(); - - $this->drupalGet('book'); - $this->assertSession()->responseContains($this->book->label()); } /** @@ -561,6 +543,24 @@ $this->drupalGet('book'); $this->assertText($this->book->label(), 'The book title is displayed on the book listing page.'); + + // Unpublish the top book page and confirm that the created book title is + // not displayed for anonymous. + $this->book->setUnpublished(); + $this->book->save(); + + $this->drupalGet('book'); + $this->assertSession()->responseNotContains($this->book->label()); + + // Publish the top book page and unpublish a page in the book and confirm + // that the created book title is displayed for anonymous. + $this->book->setPublished(); + $this->book->save(); + $nodes[0]->setUnpublished(); + $nodes[0]->save(); + + $this->drupalGet('book'); + $this->assertSession()->responseContains($this->book->label()); } /**