private function XBBCodeFilterTest::checkMarkup in Extensible BBCode 4.0.x
Same name and namespace in other branches
- 8.3 tests/src/Kernel/XBBCodeFilterTest.php \Drupal\Tests\xbbcode\Kernel\XBBCodeFilterTest::checkMarkup()
Render a text through the filter system, returning the full render array.
Parameters
string $text: The text to be filtered.
string|null $format_id: (optional) The machine name of the filter format to be used to filter the text. Defaults to the fallback format. See filter_fallback_format().
Return value
array The render array, including #markup and #attached.
1 call to XBBCodeFilterTest::checkMarkup()
- XBBCodeFilterTest::testFilter in tests/
src/ Kernel/ XBBCodeFilterTest.php - Test a few basic aspects of the filter.
File
- tests/
src/ Kernel/ XBBCodeFilterTest.php, line 204
Class
- XBBCodeFilterTest
- Test the filter.
Namespace
Drupal\Tests\xbbcode\KernelCode
private function checkMarkup(string $text, string $format_id = NULL) : array {
$build = [
'#type' => 'processed_text',
'#text' => $text,
'#format' => $format_id,
];
try {
$this->renderer
->renderPlain($build);
} catch (\Exception $e) {
$build['#markup'] = '';
}
return $build;
}