You are here

protected function BookMultilingualTest::assertToCEntryIsCorrectlyTranslated in Drupal 10

Same name and namespace in other branches
  1. 9 core/modules/book/tests/src/Kernel/BookMultilingualTest.php \Drupal\Tests\book\Kernel\BookMultilingualTest::assertToCEntryIsCorrectlyTranslated()

Asserts one entry in the table of contents is correct.

@internal

Parameters

array $toc: The entire table of contents array.

string $langcode: The language code for the requested translation.

int $nid: The node ID.

string $indent: The indentation before the actual table of contents label.

File

core/modules/book/tests/src/Kernel/BookMultilingualTest.php, line 334

Class

BookMultilingualTest
Tests multilingual books.

Namespace

Drupal\Tests\book\Kernel

Code

protected function assertToCEntryIsCorrectlyTranslated(array $toc, string $langcode, int $nid, string $indent) : void {
  $node = Node::load($nid);
  $node_label = $node
    ->getTranslation($langcode)
    ->label();
  $this
    ->assertSame($indent . ' ' . $node_label, $toc[$nid]);
}