‪TYPO3CMS  ‪main
ImagesWithStoragesTest.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;
25 
27 {
28  #[Test]
30  {
33 
34  $subject = GeneralUtility::makeInstance(Import::class);
35  $subject->setPid(0);
36  $subject->loadFile('EXT:impexp/Tests/Functional/Fixtures/XmlImports/images-with-storages.xml');
37  $subject->importData();
38 
39  $this->assertCSVDataSet(__DIR__ . '/../Fixtures/DatabaseAssertions/importImagesWithStorages.csv');
40  self::assertFileExists(‪Environment::getPublicPath() . '/fileadmin-1/user_upload/typo3_image3.jpg');
41  self::assertFileExists(‪Environment::getPublicPath() . '/fileadmin-3/user_upload/typo3_image2.jpg');
42  }
43 
44  #[Test]
46  {
47  ‪GeneralUtility::mkdir(‪Environment::getPublicPath() . '/fileadmin_invalid_path');
48 
49  $this->importCSVDataSet(__DIR__ . '/../Fixtures/DatabaseImports/sys_file_storages.csv');
50 
51  $subject = GeneralUtility::makeInstance(Import::class);
52  $subject->setPid(0);
53  $subject->loadFile('EXT:impexp/Tests/Functional/Fixtures/XmlImports/images-with-static-and-fallback-storages.xml');
54  $subject->importData();
55 
56  self::assertFileExists(‪Environment::getPublicPath() . '/fileadmin_invalid_path/user_upload/typo3_image2.jpg');
57  self::assertFileExists(‪Environment::getPublicPath() . '/fileadmin_invalid_path/user_upload/typo3_image3.jpg');
58  self::assertFileExists(‪Environment::getPublicPath() . '/fileadmin_invalid_path/user_upload/typo3_image5.jpg');
59  self::assertFileExists(‪Environment::getPublicPath() . '/typo3conf/ext/template_extension/Resources/Public/Templates/Empty.html');
60  }
61 }
‪TYPO3\CMS\Core\Utility\GeneralUtility\mkdir
‪static bool mkdir(string $newFolder)
Definition: GeneralUtility.php:1638
‪TYPO3\CMS\Impexp\Tests\Functional\Import\ImagesWithStoragesTest
Definition: ImagesWithStoragesTest.php:27
‪TYPO3\CMS\Core\Core\Environment\getPublicPath
‪static getPublicPath()
Definition: Environment.php:187
‪TYPO3\CMS\Impexp\Tests\Functional\Import
Definition: ImagesWithStoragesTest.php:18
‪TYPO3\CMS\Impexp\Tests\Functional\Import\ImagesWithStoragesTest\importMultipleImagesWithMultipleStorages
‪importMultipleImagesWithMultipleStorages()
Definition: ImagesWithStoragesTest.php:29
‪TYPO3\CMS\Impexp\Import
Definition: Import.php:51
‪TYPO3\CMS\Impexp\Tests\Functional\AbstractImportExportTestCase
Definition: AbstractImportExportTestCase.php:33
‪TYPO3\CMS\Core\Core\Environment
Definition: Environment.php:41
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:52
‪TYPO3\CMS\Impexp\Tests\Functional\Import\ImagesWithStoragesTest\importImagesWithStaticAndFallbackStorages
‪importImagesWithStaticAndFallbackStorages()
Definition: ImagesWithStoragesTest.php:45