You are here

function BookTest::generateOutlinePattern 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::generateOutlinePattern()

Creates a regular expression to check for the sub-nodes in the outline.

Parameters

array $nodes: An array of nodes to check in outline.

Return value

string A regular expression that locates sub-nodes of the outline.

1 call to BookTest::generateOutlinePattern()
BookTest::checkBookNode in core/modules/book/src/Tests/BookTest.php
Checks the outline of sub-pages; previous, up, and next.

File

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

Class

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

Namespace

Drupal\book\Tests

Code

function generateOutlinePattern($nodes) {
  $outline = '';
  foreach ($nodes as $node) {
    $outline .= '(node\\/' . $node
      ->id() . ')(.*?)(' . $node
      ->label() . ')(.*?)';
  }
  return '/<nav id="book-navigation-' . $this->book
    ->id() . '"(.*?)<ul(.*?)' . $outline . '<\\/ul>/s';
}