You are here

public function BookTest::testEmptyBook in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/book/tests/src/Functional/BookTest.php \Drupal\Tests\book\Functional\BookTest::testEmptyBook()
  2. 10 core/modules/book/tests/src/Functional/BookTest.php \Drupal\Tests\book\Functional\BookTest::testEmptyBook()

Tests saving the book outline on an empty book.

File

core/modules/book/tests/src/Functional/BookTest.php, line 155

Class

BookTest
Create a book, add pages, and test book interface.

Namespace

Drupal\Tests\book\Functional

Code

public function testEmptyBook() {

  // Create a new empty book.
  $this
    ->drupalLogin($this->bookAuthor);
  $book = $this
    ->createBookNode('new');
  $this
    ->drupalLogout();

  // Log in as a user with access to the book outline and save the form.
  $this
    ->drupalLogin($this->adminUser);
  $this
    ->drupalGet('admin/structure/book/' . $book
    ->id());
  $this
    ->submitForm([], 'Save book pages');
  $this
    ->assertSession()
    ->pageTextContains('Updated book ' . $book
    ->label() . '.');
}