You are here

public function BookTest::testAdminBookNodeListing in Drupal 8

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

Tests the administrative listing of all book pages in a book.

File

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

Class

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

Namespace

Drupal\Tests\book\Functional

Code

public function testAdminBookNodeListing() {

  // Create a new book.
  $this
    ->createBook();
  $this
    ->drupalLogin($this->adminUser);

  // Load the book page list and assert the created book title is displayed
  // and action links are shown on list items.
  $this
    ->drupalGet('admin/structure/book/' . $this->book
    ->id());
  $this
    ->assertText($this->book
    ->label(), 'The book title is displayed on the administrative book listing page.');
  $elements = $this
    ->xpath('//table//ul[@class="dropbutton"]/li/a');
  $this
    ->assertEqual($elements[0]
    ->getText(), 'View', 'View link is found from the list.');
}