class HTMLRestrictionsTest extends UnitTestCase
{ /**
* @covers ::__construct
* @dataProvider providerConstruct
*/
public function testConstructor(array
$elements, ?string
$expected_exception_message): void
{ if ($expected_exception_message !== NULL
) { $this->
expectException(\InvalidArgumentException::
class);
$this->
expectExceptionMessage($expected_exception_message);
} new HTMLRestrictions($elements);
} public function providerConstruct(): \Generator
{ // Fundamental structure.
yield 'INVALID: list instead of key-value pairs' =>
[ ['<foo>', '<bar>'
],
'An array of key-value pairs must be provided, with HTML tag names as keys.',
];
// Invalid HTML tag names.
yield 'INVALID: key-value pairs now, but invalid keys due to angular brackets' =>
[ [