function FilterHtmlTest::testSetConfiguration

Same name and namespace in other branches
  1. 9 core/modules/filter/tests/src/Unit/FilterHtmlTest.php \Drupal\Tests\filter\Unit\FilterHtmlTest::testSetConfiguration()
  2. 10 core/modules/filter/tests/src/Unit/FilterHtmlTest.php \Drupal\Tests\filter\Unit\FilterHtmlTest::testSetConfiguration()
  3. 11.x core/modules/filter/tests/src/Unit/FilterHtmlTest.php \Drupal\Tests\filter\Unit\FilterHtmlTest::testSetConfiguration()

@covers ::setConfiguration

File

core/modules/filter/tests/src/Unit/FilterHtmlTest.php, line 85

Class

FilterHtmlTest
@coversDefaultClass <a href="/api/drupal/core%21modules%21filter%21src%21Plugin%21Filter%21FilterHtml.php/class/FilterHtml/8.9.x" title="Provides a filter to limit allowed HTML tags." class="local">\Drupal\filter\Plugin\Filter\FilterHtml</a> @group filter

Namespace

Drupal\Tests\filter\Unit

Code

public function testSetConfiguration() {
    $configuration['settings'] = [
        // New lines and spaces are replaced with a single space.
'allowed_html' => "<a>  <br>\r\n  <p>",
        'filter_html_help' => 1,
        'filter_html_nofollow' => 0,
    ];
    $filter = new FilterHtml($configuration, 'filter_html', [
        'provider' => 'test',
    ]);
    $this->assertSame('<a> <br> <p>', $filter->getConfiguration()['settings']['allowed_html']);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.