function BookMultilingualTest::assertToCEntryIsCorrectlyTranslated
Same name in other branches
- 10 core/modules/book/tests/src/Kernel/BookMultilingualTest.php \Drupal\Tests\book\Kernel\BookMultilingualTest::assertToCEntryIsCorrectlyTranslated()
- 11.x 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.
1 call to BookMultilingualTest::assertToCEntryIsCorrectlyTranslated()
- BookMultilingualTest::testMultilingualBookManager in core/
modules/ book/ tests/ src/ Kernel/ BookMultilingualTest.php - Tests various book manager methods return correct translations.
File
-
core/
modules/ book/ tests/ src/ Kernel/ BookMultilingualTest.php, line 334
Class
- BookMultilingualTest
- Tests multilingual books.
Namespace
Drupal\Tests\book\KernelCode
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]);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.