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