You are here

function BookTest::testEmptyBook in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/book/src/Tests/BookTest.php \Drupal\book\Tests\BookTest::testEmptyBook()

Tests saving the book outline on an empty book.

File

core/modules/book/src/Tests/BookTest.php, line 157
Contains \Drupal\book\Tests\BookTest.

Class

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

Namespace

Drupal\book\Tests

Code

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(), array(), t('Save book pages'));
  $this
    ->assertText(t('Updated book @book.', array(
    '@book' => $book
      ->label(),
  )));
}