protected function XBBCodeFilterTest::setUp 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::setUp()
Throws
\Exception
Overrides KernelTestBase::setUp
File
- tests/
src/ Kernel/ XBBCodeFilterTest.php, line 41
Class
- XBBCodeFilterTest
- Test the filter.
Namespace
Drupal\Tests\xbbcode\KernelCode
protected function setUp() : void {
parent::setUp();
$this
->installConfig([
'system',
'filter',
'xbbcode',
'xbbcode_test_plugin',
]);
$tag = Tag::create([
'id' => 'bad_tag',
'label' => 'Bad Tag',
'description' => 'Renders the outer source of itself.',
'default_name' => 'bad_tag',
'sample' => '[{{ name }}]Content[/{{ name }}]',
'template_code' => '<{{ tag.name }}>{{ tag.outerSource }}</{{ tag.name }}>',
]);
$tag
->save();
$tag_set = TagSet::create([
'id' => 'test_set',
'label' => 'Test Set',
'tags' => [
'test_plugin' => [
'id' => 'test_plugin_id',
],
'test_tag' => [
'id' => 'xbbcode_tag:test_tag_id',
],
'test_template' => [
'id' => 'xbbcode_tag:test_tag_external',
],
'bad_tag' => [
'id' => 'xbbcode_tag:bad_tag',
],
],
]);
$tag_set
->save();
// Set up a BBCode filter format.
$xbbcode_format = FilterFormat::create([
'format' => 'xbbcode_test',
'name' => 'XBBCode Test',
'filters' => [
'filter_html_escape' => [
'status' => 1,
'weight' => 0,
],
'xbbcode' => [
'status' => 1,
'weight' => 1,
'settings' => [
'tags' => 'test_set',
'linebreaks' => FALSE,
],
],
],
]);
$xbbcode_format
->save();
$this->renderer = \Drupal::service('renderer');
}