‪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 
24 
26 {
31  {
34 
35  $subject = GeneralUtility::makeInstance(Import::class);
36  $subject->setPid(0);
37  $subject->loadFile(
38  'EXT:impexp/Tests/Functional/Fixtures/XmlImports/images-with-storages.xml',
39  true
40  );
41  $subject->importData();
42 
43  $this->assertCSVDataSet(__DIR__ . '/../Fixtures/DatabaseAssertions/importImagesWithStorages.csv');
44  self::assertFileExists(‪Environment::getPublicPath() . '/fileadmin-1/user_upload/typo3_image3.jpg');
45  self::assertFileExists(‪Environment::getPublicPath() . '/fileadmin-3/user_upload/typo3_image2.jpg');
46  }
47 
52  {
53  ‪GeneralUtility::mkdir(‪Environment::getPublicPath() . '/fileadmin_invalid_path');
54 
55  $this->importCSVDataSet(__DIR__ . '/../Fixtures/DatabaseImports/sys_file_storages.csv');
56 
57  $subject = GeneralUtility::makeInstance(Import::class);
58  $subject->setPid(0);
59  $subject->loadFile(
60  'EXT:impexp/Tests/Functional/Fixtures/XmlImports/images-with-static-and-fallback-storages.xml',
61  true
62  );
63  $subject->importData();
64 
65  self::assertFileExists(‪Environment::getPublicPath() . '/fileadmin_invalid_path/user_upload/typo3_image2.jpg');
66  self::assertFileExists(‪Environment::getPublicPath() . '/fileadmin_invalid_path/user_upload/typo3_image3.jpg');
67  self::assertFileExists(‪Environment::getPublicPath() . '/fileadmin_invalid_path/user_upload/typo3_image5.jpg');
68  self::assertFileExists(‪Environment::getPublicPath() . '/typo3conf/ext/template_extension/Resources/Public/Templates/Empty.html');
69  }
70 }
‪TYPO3\CMS\Core\Utility\GeneralUtility\mkdir
‪static bool mkdir(string $newFolder)
Definition: GeneralUtility.php:1615
‪TYPO3\CMS\Impexp\Tests\Functional\Import\ImagesWithStoragesTest
Definition: ImagesWithStoragesTest.php:26
‪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:30
‪TYPO3\CMS\Impexp\Import
Definition: Import.php:50
‪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:51
‪TYPO3\CMS\Impexp\Tests\Functional\Import\ImagesWithStoragesTest\importImagesWithStaticAndFallbackStorages
‪importImagesWithStaticAndFallbackStorages()
Definition: ImagesWithStoragesTest.php:51