18 use org\bovigo\vfs\vfsStream;
23 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
36 $className = \TYPO3\CMS\Core\Type\File\ImageInfo::class;
37 $classInstance = new \TYPO3\CMS\Core\Type\File\ImageInfo(
'FooFileName');
38 $this->assertInstanceOf($className, $classInstance);
47 [
'Invalid XML.', 0, 0],
49 '<?xml version="1.0" encoding="utf-8"?>
50 <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd" [
51 <!ENTITY ns_a "http://ns.typo3.com/test/a/1.0/">
52 <!ENTITY ns_b "http://ns.typo3.com/test/b/1.0/">
56 xmlns="http://www.w3.org/2000/svg"
57 xmlns:xlink="http://www.w3.org/1999/xlink"
59 x="0px" y="0px" viewBox="0 0 436 177">
81 $this->resetSingletonInstances =
true;
83 $root = vfsStream::setup(
'root');
84 $testFile =
'test.svg';
85 vfsStream::newFile($testFile)->at($root)->setContent($svg);
87 $GLOBALS[
'TYPO3_CONF_VARS'][
'SYS'][
'FileInfo'][
'fileExtensionToMimeType'] = [
88 'svg' =>
'image/svg+xml',
89 'youtube' =>
'video/youtube',
90 'vimeo' =>
'video/vimeo',
93 $graphicalFunctionsProphecy = $this->prophesize(GraphicalFunctions::class);
94 $graphicalFunctionsProphecy->imageMagickIdentify($root->url() .
'/' . $testFile)->willReturn(
null);
95 GeneralUtility::addInstance(GraphicalFunctions::class, $graphicalFunctionsProphecy->reveal());
97 $loggerProphecy = $this->prophesize(Logger::class);
99 $imageInfo =
new ImageInfo($root->url() .
'/' . $testFile);
100 $imageInfo->setLogger($loggerProphecy->reveal());
102 $this->assertSame($width, $imageInfo->getWidth());
103 $this->assertSame($height, $imageInfo->getHeight());
105 GeneralUtility::makeInstance(GraphicalFunctions::class);
114 'svg' => [
'test.svg', 80, 80],
115 'jpg' => [
'test.jpg', 600, 388],
116 'png' => [
'test.png', 600, 388],
129 $logger = $this->prophesize(Logger::class)->reveal();
130 $imageInfo =
new ImageInfo(__DIR__ .
'/../Fixture/' . $file);
131 $imageInfo->setLogger($logger);
133 $this->assertSame($width, $imageInfo->getWidth());
134 $this->assertSame($height, $imageInfo->getHeight());