‪TYPO3CMS  ‪main
FileConverterTest.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
5 /*
6  * This file is part of the TYPO3 CMS project.
7  *
8  * It is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU General Public License, either version 2
10  * of the License, or any later version.
11  *
12  * For the full copyright and license information, please read the
13  * LICENSE.txt file that was distributed with this source code.
14  *
15  * The TYPO3 project - inspiring people to share!
16  */
17 
19 
20 use PHPUnit\Framework\Attributes\Test;
24 use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase;
25 
26 final class ‪FileConverterTest extends FunctionalTestCase
27 {
28  #[Test]
29  public function ‪convertReturnsFileObject(): void
30  {
31  ‪$GLOBALS['BE_USER'] = new ‪BackendUserAuthentication();
32  ‪$GLOBALS['BE_USER']->user = ['admin' => true];
33 
34  $this->importCSVDataSet(__DIR__ . '/../Fixtures/DatabaseImports/sys_file.csv');
35  $this->importCSVDataSet(__DIR__ . '/../Fixtures/DatabaseImports/sys_file_storage.csv');
36 
37  $propertyMapper = $this->get(PropertyMapper::class);
38 
40  $file = $propertyMapper->convert(
41  1,
42  File::class
43  );
44 
45  self::assertInstanceOf(File::class, $file);
46  self::assertSame(1, $file->getOriginalResource()->getUid());
47  }
48 }
‪TYPO3\CMS\Extbase\Domain\Model\File
Definition: File.php:28
‪TYPO3\CMS\Extbase\Tests\Functional\Property\TypeConverter\FileConverterTest
Definition: FileConverterTest.php:27
‪TYPO3\CMS\Extbase\Tests\Functional\Property\TypeConverter
Definition: ArrayConverterTest.php:18
‪TYPO3\CMS\Extbase\Tests\Functional\Property\TypeConverter\FileConverterTest\convertReturnsFileObject
‪convertReturnsFileObject()
Definition: FileConverterTest.php:29
‪TYPO3\CMS\Core\Authentication\BackendUserAuthentication
Definition: BackendUserAuthentication.php:62
‪TYPO3\CMS\Extbase\Property\PropertyMapper
Definition: PropertyMapper.php:30
‪$GLOBALS
‪$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['adminpanel']['modules']
Definition: ext_localconf.php:25