function BookTestTrait::generateOutlinePattern

Same name and namespace in other branches
  1. 9 core/modules/book/tests/src/Functional/BookTestTrait.php \Drupal\Tests\book\Functional\BookTestTrait::generateOutlinePattern()
  2. 8.9.x core/modules/book/tests/src/Functional/BookTestTrait.php \Drupal\Tests\book\Functional\BookTestTrait::generateOutlinePattern()
  3. 11.x 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.

Deprecated

in drupal:10.1.0 and is removed from drupal:11.0.0. Use methods from \Drupal\Tests\WebAssert instead.

See also

https://www.drupal.org/node/3325904

File

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

Class

BookTestTrait
Provides common functionality for Book test classes.

Namespace

Drupal\Tests\book\Functional

Code

public function generateOutlinePattern($nodes) {
    @trigger_error(__METHOD__ . ' is deprecated in drupal:10.1.0 and is removed from drupal:11.0.0. Use methods from \\Drupal\\Tests\\WebAssert instead. See https://www.drupal.org/node/3325904', E_USER_DEPRECATED);
    $outline = '';
    foreach ($nodes as $node) {
        $outline .= '(node\\/' . $node->id() . ')(.*?)(' . $node->label() . ')(.*?)';
    }
    return '/<nav role="navigation" aria-labelledby="book-label-' . $this->book
        ->id() . '"(.*?)<ul(.*?)' . $outline . '<\\/ul>/s';
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.