‪TYPO3CMS  9.5
PagesAndTtContentWithImagesInEmptyDatabaseTest.php
Go to the documentation of this file.
1 <?php
3 
4 /*
5  * This file is part of the TYPO3 CMS project.
6  *
7  * It is free software; you can redistribute it and/or modify it under
8  * the terms of the GNU General Public License, either version 2
9  * of the License, or any later version.
10  *
11  * For the full copyright and license information, please read the
12  * LICENSE.txt file that was distributed with this source code.
13  *
14  * The TYPO3 project - inspiring people to share!
15  */
16 
21 
26 {
31  {
32  $subject = GeneralUtility::makeInstance(Import::class);
33  $subject->init();
34 
35  if (!$this->‪isCaseSensitiveFilesystem()) {
36  $this->markTestSkipped('Test not available on case insensitive filesystems.');
37  }
38 
39  $subject->loadFile(
40  __DIR__ . '/../Fixtures/XmlImports/pages-and-ttcontent-with-image.xml',
41  1
42  );
43  $subject->importData(0);
44 
45  $this->testFilesToDelete[] = ‪Environment::getPublicPath() . '/fileadmin/user_upload/typo3_image2.jpg';
46 
47  $this->assertCSVDataSet('EXT:impexp/Tests/Functional/Fixtures/DatabaseAssertions/importPagesAndRelatedTtContentWithImagesOnCaseSensitiveFilesystems.csv');
48 
49  $this->assertFileEquals(__DIR__ . '/../Fixtures/Folders/fileadmin/user_upload/typo3_image2.jpg', ‪Environment::getPublicPath() . '/fileadmin/user_upload/typo3_image2.jpg');
50  }
51 
56  {
57  $subject = GeneralUtility::makeInstance(Import::class);
58  $subject->init();
59 
60  if ($this->‪isCaseSensitiveFilesystem()) {
61  $this->markTestSkipped('Test not available on case sensitive filesystems.');
62  }
63 
64  $subject->loadFile(
65  __DIR__ . '/../Fixtures/XmlImports/pages-and-ttcontent-with-image.xml',
66  1
67  );
68  $subject->importData(0);
69 
70  $this->testFilesToDelete[] = ‪Environment::getPublicPath() . '/fileadmin/user_upload/typo3_image2.jpg';
71 
72  $this->assertCSVDataSet('EXT:impexp/Tests/Functional/Fixtures/DatabaseAssertions/importPagesAndRelatedTtContentWithImagesOnCaseInsensitiveFilesystems.csv');
73 
74  $this->assertFileEquals(__DIR__ . '/../Fixtures/Folders/fileadmin/user_upload/typo3_image2.jpg', ‪Environment::getPublicPath() . '/fileadmin/user_upload/typo3_image2.jpg');
75  }
76 
81  {
82  $subject = GeneralUtility::makeInstance(Import::class);
83  $subject->init();
84 
85  if (!$this->‪isCaseSensitiveFilesystem()) {
86  $this->markTestSkipped('Test not available on case insensitive filesystems.');
87  }
88 
89  $subject->loadFile(
90  __DIR__ . '/../Fixtures/XmlImports/pages-and-ttcontent-with-image-without-storage.xml',
91  1
92  );
93  $subject->importData(0);
94 
95  $this->testFilesToDelete[] = ‪Environment::getPublicPath() . '/fileadmin/user_upload/typo3_image2.jpg';
96 
97  $this->assertCSVDataSet('EXT:impexp/Tests/Functional/Fixtures/DatabaseAssertions/importPagesAndRelatedTtContentWithImagesButWithoutStorageOnCaseSensitiveFilesystems.csv');
98 
99  $this->assertFileEquals(__DIR__ . '/../Fixtures/Folders/fileadmin/user_upload/typo3_image2.jpg', ‪Environment::getPublicPath() . '/fileadmin/user_upload/typo3_image2.jpg');
100  }
101 
106  {
107  $subject = GeneralUtility::makeInstance(Import::class);
108  $subject->init();
109 
110  if ($this->‪isCaseSensitiveFilesystem()) {
111  $this->markTestSkipped('Test not available on case sensitive filesystems.');
112  }
113 
114  $subject->loadFile(
115  __DIR__ . '/../Fixtures/XmlImports/pages-and-ttcontent-with-image-without-storage.xml',
116  1
117  );
118  $subject->importData(0);
119 
120  $this->testFilesToDelete[] = ‪Environment::getPublicPath() . '/fileadmin/user_upload/typo3_image2.jpg';
121 
122  $this->assertCSVDataSet('EXT:impexp/Tests/Functional/Fixtures/DatabaseAssertions/importPagesAndRelatedTtContentWithImagesButWithoutStorageOnCaseInsensitiveFilesystems.csv');
123 
124  $this->assertFileEquals(__DIR__ . '/../Fixtures/Folders/fileadmin/user_upload/typo3_image2.jpg', ‪Environment::getPublicPath() . '/fileadmin/user_upload/typo3_image2.jpg');
125  }
126 
131  {
132  $subject = GeneralUtility::makeInstance(Import::class);
133  $subject->init();
134 
135  $subject->loadFile(
136  __DIR__ . '/../Fixtures/XmlImports/pages-and-ttcontent-with-image-with-spaces-in-path.xml',
137  1
138  );
139  $subject->importData(0);
140 
141  $this->testFilesToDelete[] = ‪Environment::getPublicPath() . '/fileadmin/user_upload/folder_with_spaces/typo3_image2.jpg';
142  $this->testFilesToDelete[] = ‪Environment::getPublicPath() . '/fileadmin/user_upload/folder_with_spaces/typo3_image3.jpg';
143 
144  $this->assertCSVDataSet('EXT:impexp/Tests/Functional/Fixtures/DatabaseAssertions/importPagesAndRelatedTtContentWithImagesWithSpacesInPath.csv');
145 
146  $this->assertFileEquals(__DIR__ . '/../Fixtures/Folders/fileadmin/user_upload/typo3_image2.jpg', ‪Environment::getPublicPath() . '/fileadmin/user_upload/folder_with_spaces/typo3_image2.jpg');
147  $this->assertFileEquals(__DIR__ . '/../Fixtures/Folders/fileadmin/user_upload/typo3_image3.jpg', ‪Environment::getPublicPath() . '/fileadmin/user_upload/folder_with_spaces/typo3_image3.jpg');
148  }
149 
154  {
155  $subject = GeneralUtility::makeInstance(Import::class);
156  $subject->init();
157 
158  $subject->loadFile(
159  // Files are parallel to the fixture .xml file in a folder - impexp tests for /../ not allowed in path, so we set an absolute path here
160  ‪Environment::getFrameworkBasePath() . '/impexp/Tests/Functional/Fixtures/XmlImports/pages-and-ttcontent-with-image-but-not-included.xml',
161  1
162  );
163  $subject->importData(0);
164 
165  $this->testFilesToDelete[] = ‪Environment::getPublicPath() . '/fileadmin/user_upload/typo3_image2.jpg';
166 
167  $this->assertCSVDataSet('EXT:impexp/Tests/Functional/Fixtures/DatabaseAssertions/importPagesAndRelatedTtContentWithImagesButNotIncluded.csv');
168 
169  $this->assertFileEquals(__DIR__ . '/../Fixtures/Folders/fileadmin/user_upload/typo3_image2.jpg', ‪Environment::getPublicPath() . '/fileadmin/user_upload/typo3_image2.jpg');
170  }
171 
177  {
178  $subject = GeneralUtility::makeInstance(Import::class);
179  $subject->init();
180 
181  $subject->loadFile(
182  __DIR__ . '/../Fixtures/XmlImports/pages-and-ttcontent-with-image-with-forced-uids.xml',
183  1
184  );
185  $subject->force_all_UIDS = true;
186  $subject->importData(0);
187 
188  $this->testFilesToDelete[] = ‪Environment::getPublicPath() . '/fileadmin/user_upload/typo3_image2.jpg';
189 
190  $this->assertCSVDataSet('EXT:impexp/Tests/Functional/Fixtures/DatabaseAssertions/importPagesAndRelatedTtContentWithImageWithForcedUids.csv');
191 
192  $this->assertFileEquals(__DIR__ . '/../Fixtures/Folders/fileadmin/user_upload/typo3_image2.jpg', ‪Environment::getPublicPath() . '/fileadmin/user_upload/typo3_image2.jpg');
193 
194  $expectedErrors = [
195  'Forcing uids of sys_file records is not supported! They will be imported as new records!'
196  ];
197  ‪$errors = $subject->errorLog;
198  $this->assertSame($expectedErrors, ‪$errors);
199  }
200 }
‪TYPO3\CMS\Core\Core\Environment\getPublicPath
‪static string getPublicPath()
Definition: Environment.php:153
‪TYPO3\CMS\Impexp\Tests\Functional\Import\PagesAndTtContentWithImagesInEmptyDatabaseTest\importPagesAndRelatedTtContentWithImagesButWithoutStorageOnCaseSensitiveFilesystems
‪importPagesAndRelatedTtContentWithImagesButWithoutStorageOnCaseSensitiveFilesystems()
Definition: PagesAndTtContentWithImagesInEmptyDatabaseTest.php:80
‪TYPO3\CMS\Impexp\Tests\Functional\AbstractImportExportTestCase\isCaseSensitiveFilesystem
‪bool isCaseSensitiveFilesystem()
Definition: AbstractImportExportTestCase.php:170
‪TYPO3\CMS\Impexp\Tests\Functional\Import
Definition: GroupFileAndFileReferenceItemInFlexFormTest.php:2
‪TYPO3\CMS\Core\Core\Environment\getFrameworkBasePath
‪static string getFrameworkBasePath()
Definition: Environment.php:234
‪TYPO3\CMS\Impexp\Tests\Functional\Import\PagesAndTtContentWithImagesInEmptyDatabaseTest\importPagesAndRelatedTtContentWithImagesWithSpacesInPath
‪importPagesAndRelatedTtContentWithImagesWithSpacesInPath()
Definition: PagesAndTtContentWithImagesInEmptyDatabaseTest.php:130
‪TYPO3\CMS\Impexp\Tests\Functional\Import\PagesAndTtContentWithImagesInEmptyDatabaseTest
Definition: PagesAndTtContentWithImagesInEmptyDatabaseTest.php:26
‪TYPO3\CMS\Impexp\Tests\Functional\Import\PagesAndTtContentWithImagesInEmptyDatabaseTest\importPagesAndRelatedTtContentWithImagesButNotIncluded
‪importPagesAndRelatedTtContentWithImagesButNotIncluded()
Definition: PagesAndTtContentWithImagesInEmptyDatabaseTest.php:153
‪TYPO3\CMS\Impexp\Import
Definition: Import.php:40
‪TYPO3\CMS\Impexp\Tests\Functional\Import\PagesAndTtContentWithImagesInEmptyDatabaseTest\importPagesAndRelatedTtContentWithImagesOnCaseInsensitiveFilesystems
‪importPagesAndRelatedTtContentWithImagesOnCaseInsensitiveFilesystems()
Definition: PagesAndTtContentWithImagesInEmptyDatabaseTest.php:55
‪TYPO3\CMS\Impexp\Tests\Functional\Import\PagesAndTtContentWithImagesInEmptyDatabaseTest\importPagesAndRelatedTtContentWithImageWithForcedUids
‪importPagesAndRelatedTtContentWithImageWithForcedUids()
Definition: PagesAndTtContentWithImagesInEmptyDatabaseTest.php:176
‪$errors
‪$errors
Definition: annotationChecker.php:115
‪TYPO3\CMS\Impexp\Tests\Functional\Import\PagesAndTtContentWithImagesInEmptyDatabaseTest\importPagesAndRelatedTtContentWithImagesOnCaseSensitiveFilesystems
‪importPagesAndRelatedTtContentWithImagesOnCaseSensitiveFilesystems()
Definition: PagesAndTtContentWithImagesInEmptyDatabaseTest.php:30
‪TYPO3\CMS\Impexp\Tests\Functional\AbstractImportExportTestCase
Definition: AbstractImportExportTestCase.php:30
‪TYPO3\CMS\Impexp\Tests\Functional\Import\PagesAndTtContentWithImagesInEmptyDatabaseTest\importPagesAndRelatedTtContentWithImagesButWithoutStorageOnCaseInsensitiveFilesystems
‪importPagesAndRelatedTtContentWithImagesButWithoutStorageOnCaseInsensitiveFilesystems()
Definition: PagesAndTtContentWithImagesInEmptyDatabaseTest.php:105
‪TYPO3\CMS\Core\Core\Environment
Definition: Environment.php:39
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:45