public function BookTest::testEmptyBook in Drupal 8
Same name and namespace in other branches
- 9 core/modules/book/tests/src/Functional/BookTest.php \Drupal\Tests\book\Functional\BookTest::testEmptyBook()
- 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 143 
Class
- BookTest
- Create a book, add pages, and test book interface.
Namespace
Drupal\Tests\book\FunctionalCode
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
    ->drupalPostForm('admin/structure/book/' . $book
    ->id(), [], t('Save book pages'));
  $this
    ->assertText(t('Updated book @book.', [
    '@book' => $book
      ->label(),
  ]));
}