public function WebformHtmlHelperTest::testToHtmlMarkup in Webform 6.x
Same name and namespace in other branches
- 8.5 tests/src/Unit/Utility/WebformHtmlHelperTest.php \Drupal\Tests\webform\Unit\Utility\WebformHtmlHelperTest::testToHtmlMarkup()
Tests WebformHtmlHelper::containsToHtmlMarkup().
@dataProvider providerToHtmlMarkup
Parameters
string $text: Text to run through WebformHtmlHelper::toHtmlMarkup().
string $expected: The expected result from calling the function.
See also
\Drupal\webform\Utility\WebformHtmlHelper::toHtmlMarkup()
File
- tests/
src/ Unit/ Utility/ WebformHtmlHelperTest.php, line 70
Class
- WebformHtmlHelperTest
- Tests webform HTML helper.
Namespace
Drupal\Tests\webform\Unit\UtilityCode
public function testToHtmlMarkup($text, $expected) {
$config_factory = $this
->getConfigFactoryStub([
'webform.settings' => [
'element' => [
'allowed_tags' => 'b',
],
],
]);
$container = new ContainerBuilder();
$container
->set('config.factory', $config_factory);
\Drupal::setContainer($container);
/**************************************************************************/
$result = WebformHtmlHelper::toHtmlMarkup($text);
$this
->assertEquals((string) $expected, (string) $result, $text);
}