Unverified Commit d8be5575 authored by Lauri Timmanee's avatar Lauri Timmanee
Browse files

Issue #3303033 by nod_, bnjmnm: Book tests should not rely on Classy

parent d1860b9d
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -21,7 +21,7 @@ class BookBreadcrumbTest extends BrowserTestBase {
  /**
   * {@inheritdoc}
   */
  protected $defaultTheme = 'classy';
  protected $defaultTheme = 'stark';

  /**
   * A book node.
@@ -156,7 +156,7 @@ public function testBreadcrumbTitleUpdates() {

    $this->drupalGet($nodes[4]->toUrl());
    // Fetch each node title in the current breadcrumb.
    $links = $this->xpath('//nav[@class="breadcrumb"]/ol/li/a');
    $links = $this->xpath('//nav[@aria-labelledby="system-breadcrumb"]/ol/li/a');
    $got_breadcrumb = [];
    foreach ($links as $link) {
      $got_breadcrumb[] = $link->getText();
@@ -171,7 +171,7 @@ public function testBreadcrumbTitleUpdates() {
    $this->submitForm($edit, 'Save');
    $this->drupalGet($nodes[4]->toUrl());
    // Fetch each node title in the current breadcrumb.
    $links = $this->xpath('//nav[@class="breadcrumb"]/ol/li/a');
    $links = $this->xpath('//nav[@aria-labelledby="system-breadcrumb"]/ol/li/a');
    $got_breadcrumb = [];
    foreach ($links as $link) {
      $got_breadcrumb[] = $link->getText();
@@ -193,7 +193,7 @@ public function testBreadcrumbAccessUpdates() {
    $this->drupalGet($nodes[3]->toUrl('edit-form'));
    $this->submitForm($edit, 'Save');
    $this->drupalGet($nodes[4]->toUrl());
    $links = $this->xpath('//nav[@class="breadcrumb"]/ol/li/a');
    $links = $this->xpath('//nav[@aria-labelledby="system-breadcrumb"]/ol/li/a');
    $got_breadcrumb = [];
    foreach ($links as $link) {
      $got_breadcrumb[] = $link->getText();
@@ -203,7 +203,7 @@ public function testBreadcrumbAccessUpdates() {
    $config = $this->container->get('config.factory')->getEditable('book_breadcrumb_test.settings');
    $config->set('hide', TRUE)->save();
    $this->drupalGet($nodes[4]->toUrl());
    $links = $this->xpath('//nav[@class="breadcrumb"]/ol/li/a');
    $links = $this->xpath('//nav[@aria-labelledby="system-breadcrumb"]/ol/li/a');
    $got_breadcrumb = [];
    foreach ($links as $link) {
      $got_breadcrumb[] = $link->getText();
+1 −1
Original line number Diff line number Diff line
@@ -30,7 +30,7 @@ class BookContentModerationTest extends BrowserTestBase {
  /**
   * {@inheritdoc}
   */
  protected $defaultTheme = 'classy';
  protected $defaultTheme = 'stark';

  /**
   * {@inheritdoc}
+1 −1
Original line number Diff line number Diff line
@@ -31,7 +31,7 @@ class BookTest extends BrowserTestBase {
  /**
   * {@inheritdoc}
   */
  protected $defaultTheme = 'classy';
  protected $defaultTheme = 'stark';

  /**
   * A user with permission to view a book and access printer-friendly version.
+2 −4
Original line number Diff line number Diff line
@@ -92,7 +92,6 @@ public function checkBookNode(EntityInterface $node, $nodes, $previous, $up, $ne
    // since it uniquely identifies each call to checkBookNode().
    static $number = 0;
    $this->drupalGet('node/' . $node->id());

    // Check outline structure.
    if ($nodes !== NULL) {
      $this->assertSession()->responseMatches($this->generateOutlinePattern($nodes));
@@ -130,7 +129,7 @@ public function checkBookNode(EntityInterface $node, $nodes, $previous, $up, $ne
    }

    // Fetch links in the current breadcrumb.
    $links = $this->xpath('//nav[@class="breadcrumb"]/ol/li/a');
    $links = $this->xpath('//nav[@aria-labelledby="system-breadcrumb"]/ol/li/a');
    $got_breadcrumb = [];
    foreach ($links as $link) {
      $got_breadcrumb[] = $link->getAttribute('href');
@@ -161,8 +160,7 @@ public function generateOutlinePattern($nodes) {
    foreach ($nodes as $node) {
      $outline .= '(node\/' . $node->id() . ')(.*?)(' . $node->label() . ')(.*?)';
    }

    return '/<nav id="book-navigation-' . $this->book->id() . '"(.*?)<ul(.*?)' . $outline . '<\/ul>/s';
    return '/<nav role="navigation" aria-labelledby="book-label-' . $this->book->id() . '"(.*?)<ul(.*?)' . $outline . '<\/ul>/s';
  }

  /**