You are here

protected function XBBCodeFilterTest::setUp in Extensible BBCode 8.3

Same name and namespace in other branches
  1. 4.0.x tests/src/Kernel/XBBCodeFilterTest.php \Drupal\Tests\xbbcode\Kernel\XBBCodeFilterTest::setUp()

Throws

\Exception

Overrides KernelTestBase::setUp

File

tests/src/Kernel/XBBCodeFilterTest.php, line 42

Class

XBBCodeFilterTest
Test the filter.

Namespace

Drupal\Tests\xbbcode\Kernel

Code

protected function setUp() : void {
  parent::setUp();
  $this
    ->installConfig([
    'system',
    'filter',
    'xbbcode',
    'xbbcode_test_plugin',
  ]);
  $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',
      ],
    ],
  ]);
  $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');
}