* @copyright Meritoo * * @internal * @covers \Meritoo\Common\Exception\ValueObject\Template\TemplateNotFoundException */ class TemplateNotFoundExceptionTest extends BaseTestCase { public function testConstructor(): void { static::assertConstructorVisibilityAndArguments( TemplateNotFoundException::class, OopVisibilityType::IS_PUBLIC, 3 ); } /** * @param string $description Description of test * @param string $index Index that should contain template, but it was not found * @param TemplateNotFoundException $expected Expected exception * * @dataProvider provideIndexAndException */ public function testCreate(string $description, string $index, TemplateNotFoundException $expected): void { $created = TemplateNotFoundException::create($index); static::assertEquals($expected, $created, $description); } public function provideIndexAndException(): ?Generator { $template = 'Template with \'%s\' index was not found. Did you provide all required templates?'; yield[ 'An empty string', '', new TemplateNotFoundException(sprintf($template, '')), ]; yield[ 'Non-empty string', 'test', new TemplateNotFoundException(sprintf($template, 'test')), ]; yield[ 'Integer', '2', new TemplateNotFoundException(sprintf($template, 2)), ]; } }