diff --git a/core/modules/filter/tests/src/Unit/FilterHtmlTest.php b/core/modules/filter/tests/src/Unit/FilterHtmlTest.php index 53b583c..9196f17 100644 --- a/core/modules/filter/tests/src/Unit/FilterHtmlTest.php +++ b/core/modules/filter/tests/src/Unit/FilterHtmlTest.php @@ -173,4 +173,24 @@ public function stringArrayConversionTestCases() { ]; } + /** + * Test the legacy allowed_html format works when using the FilterHtml plugin. + */ + public function testLegacyAllowedHtmlFormat() { + $legacy_format = '

'; + $structured_format = [ + 'h1' => [], + 'h2' => [], + 'a' => [ + 'href' => '*', + ], + ]; + // Test the legacy format is accepted when constructing the plugin directly. + $filter = new FilterHtml(['settings' => ['allowed_html' => $legacy_format]], 'filter_html', ['provider' => 'test']); + $this->assertSame($structured_format, $filter->getConfiguration()['settings']['allowed_html']); + // Test the legacy format is accepted when setting the configuration. + $filter->setConfiguration(['settings' => ['allowed_html' => $legacy_format]]); + $this->assertSame($structured_format, $filter->getConfiguration()['settings']['allowed_html']); + } + }