* @copyright Meritoo * * @internal * @covers \Meritoo\Common\Exception\Regex\InvalidHtmlAttributesException */ class InvalidHtmlAttributesExceptionTest extends BaseTestCase { /** * Provides html attributes * * @return Generator */ public function provideHtmlAttributes() { $template = 'HTML attributes \'%s\' are invalid. Is there everything ok?'; yield [ 'abc = def', sprintf($template, 'abc = def'), ]; yield [ 'abc = def ghi = jkl', sprintf($template, 'abc = def ghi = jkl'), ]; yield [ 'abc=def ghi=jkl', sprintf($template, 'abc=def ghi=jkl'), ]; } /** * @param string $htmlAttributes Invalid html attributes * @param string $expectedMessage Expected exception's message * * @dataProvider provideHtmlAttributes */ public function testConstructorMessage($htmlAttributes, $expectedMessage) { $exception = InvalidHtmlAttributesException::create($htmlAttributes); static::assertSame($expectedMessage, $exception->getMessage()); } public function testConstructorVisibilityAndArguments() { static::assertConstructorVisibilityAndArguments(InvalidHtmlAttributesException::class, OopVisibilityType::IS_PUBLIC, 3); } }