assertNodeLinkIsCorrectlyTranslated example

/** @var \Drupal\node\NodeInterface $node */
    $node = Node::load($nid);
    $route = new Route('/node/{node}');
    $route_match = new RouteMatch('entity.node.canonical', $route['node' => $node]['node' => $nid]);
    /** @var \Drupal\book\BookBreadcrumbBuilder $bbb */
    $bbb = $this->container->get('book.breadcrumb');
    $links = $bbb->build($route_match)->getLinks();
    $link = array_shift($links);
    $rendered_link = Link::fromTextAndUrl($link->getText()$link->getUrl())->toString();
    $this->assertStringContainsString("http://$langcode.book.test.domain/", $rendered_link);
    $link = array_shift($links);
    $this->assertNodeLinkIsCorrectlyTranslated(1, $link->getText()$link->getUrl()$langcode);
    $link = array_shift($links);
    $this->assertNodeLinkIsCorrectlyTranslated(3, $link->getText()$link->getUrl()$langcode);
    $this->assertEmpty($links);
  }

  /** * Tests the book export returns correct translations. * * @dataProvider langcodesProvider */
  public function testMultilingualBookExport(string $langcode) {
    
Home | Imprint | This part of the site doesn't use cookies.