protected function BookMultilingualTest::assertToCEntryIsCorrectlyTranslated in Drupal 9
Same name and namespace in other branches
- 10 core/modules/book/tests/src/Kernel/BookMultilingualTest.php \Drupal\Tests\book\Kernel\BookMultilingualTest::assertToCEntryIsCorrectlyTranslated()
Asserts one entry in the table of contents is correct.
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 328
Class
- BookMultilingualTest
- Tests multilingual books.
Namespace
Drupal\Tests\book\KernelCode
protected function assertToCEntryIsCorrectlyTranslated(array $toc, string $langcode, int $nid, string $indent) {
$node = Node::load($nid);
$node_label = $node
->getTranslation($langcode)
->label();
$this
->assertSame($indent . ' ' . $node_label, $toc[$nid]);
}