/** * Check if a file is supported by this ImageIO. This check is based on the extension. * @param File file to check if it is supported * @param mixed supportedExtensions string of an extension or array with extension strings */ protected function checkIfFileIsSupported(File $file, $supportedExtensions) { if (!$file->hasExtension($supportedExtensions)) { throw new ImageException($file->getPath() . ' is not supported'); } return true; }
/** * @dataProvider providerHasExtension */ public function testHasExtension($expected, $value) { $file = new File('test.txt'); $result = $file->hasExtension($value); $this->assertEquals($expected, $result, var_export($value, true)); }