You are here

public function BookTestTrait::generateOutlinePattern in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/book/tests/src/Functional/BookTestTrait.php \Drupal\Tests\book\Functional\BookTestTrait::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 BookTestTrait::generateOutlinePattern()
BookTestTrait::checkBookNode in core/modules/book/tests/src/Functional/BookTestTrait.php
Checks the outline of sub-pages; previous, up, and next.

File

core/modules/book/tests/src/Functional/BookTestTrait.php, line 159

Class

BookTestTrait
Provides common functionality for Book test classes.

Namespace

Drupal\Tests\book\Functional

Code

public 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';
}