$this->
assertNotEmpty($definition['label'
], 'Topic ' .
$id . ' has a non-empty label'
);
// Test the syntax and contents of the Twig file (without the front
// matter, which is tested in other ways above). We need to render the
// template several times with variations, so read it in once.
$template =
file_get_contents($definition[HelpTopicDiscovery::FILE_KEY
]);
$template_text = FrontMatter::
create($template)->
getContent();
// Verify that the body is not empty and is valid HTML.
$text =
$this->
renderHelpTopic($template_text, 'bare_body'
);
$this->
assertNotEmpty($text, 'Topic ' .
$id . ' contains some text outside of front matter'
);
$this->
validateHtml($text,
$id);
$max_chunk_num = HelpTestTwigNodeVisitor::
getState()['max_chunk'
];
$this->
assertTrue($max_chunk_num >= 0, 'Topic ' .
$id . ' has at least one translated chunk'
);
// Verify that each chunk of the translated text is locale-safe and
// valid HTML.
$chunk_num = 0;
$number_checked = 0;
while ($chunk_num <=
$max_chunk_num) { $chunk_str =
$id . ' section ' .
$chunk_num;
// Render the topic, asking for just one chunk, and extract the chunk.