* @copyright Meritoo * * @internal * @covers \Meritoo\Common\Exception\File\NotExistingFileException */ class NotExistingFileExceptionTest extends BaseTestCase { public function testConstructorVisibilityAndArguments() { static::assertConstructorVisibilityAndArguments(NotExistingFileException::class, OopVisibilityType::IS_PUBLIC, 3); } /** * @param string $notExistingFilePath Path of not existing (or not readable) file * @param string $expectedMessage Expected exception's message * * @dataProvider providePathOfFile */ public function testConstructorMessage($notExistingFilePath, $expectedMessage) { $exception = NotExistingFileException::create($notExistingFilePath); static::assertSame($expectedMessage, $exception->getMessage()); } /** * Provides path of not existing file and expected exception's message * * @return Generator */ public function providePathOfFile() { $template = 'File with path \'%s\' does not exist (or is not readable). Did you provide path of proper file?'; yield[ 'aa/bb/cc', sprintf($template, 'aa/bb/cc'), ]; yield[ 'images/show/car.jpg', sprintf($template, 'images/show/car.jpg'), ]; } }