‪TYPO3CMS  ‪main
ImportExportTest.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 
18 use PHPUnit\Framework\Attributes\Test;
19 use PHPUnit\Framework\MockObject\MockObject;
23 use TYPO3\TestingFramework\Core\AccessibleObjectInterface;
24 
26 {
27  protected array ‪$testExtensionsToLoad = [
28  'typo3/sysext/core/Tests/Functional/Fixtures/Extensions/test_irre_csv',
29  'typo3/sysext/core/Tests/Functional/Fixtures/Extensions/test_irre_mm',
30  'typo3/sysext/core/Tests/Functional/Fixtures/Extensions/test_irre_mnsymmetric',
31  'typo3/sysext/core/Tests/Functional/Fixtures/Extensions/test_irre_foreignfield',
32  'typo3/sysext/core/Tests/Functional/Fixtures/Extensions/test_irre_mnattributeinline',
33  'typo3/sysext/core/Tests/Functional/Fixtures/Extensions/test_irre_mnattributesimple',
34  ];
35 
36  protected ‪Export&MockObject&AccessibleObjectInterface ‪$exportMock;
37 
38  protected function ‪setUp(): void
39  {
40  parent::setUp();
41  $this->exportMock = $this->getAccessibleMock(Export::class, ['setMetaData']);
42  }
43 
44  #[Test]
45  public function ‪importExportPingPongSucceeds(): void
46  {
47  $recordTypesIncludeFields = include __DIR__ . '/Fixtures/IrreRecordsIncludeFields.php';
48 
49  $import = GeneralUtility::makeInstance(Import::class);
50  $import->setPid(0);
51  $import->loadFile('EXT:impexp/Tests/Functional/Fixtures/XmlImports/irre-records.xml');
52  $import->setForceAllUids(true);
53  $import->importData();
54 
55  $this->exportMock->setPid(1);
56  $this->exportMock->setLevels(‪Export::LEVELS_INFINITE);
57  $this->exportMock->setTables(['_ALL']);
58  $this->exportMock->setRelOnlyTables(['_ALL']);
59  $this->exportMock->setRecordTypesIncludeFields($recordTypesIncludeFields);
60  $this->exportMock->process();
61  $actual = $this->exportMock->render();
62 
63  // @todo Use self::assertXmlStringEqualsXmlFile() instead when sqlite issue is sorted out
65  __DIR__ . '/Fixtures/XmlImports/irre-records.xml',
66  $actual
67  );
68  }
69 }
‪TYPO3\CMS\Impexp\Tests\Functional\ImportExportTest\importExportPingPongSucceeds
‪importExportPingPongSucceeds()
Definition: ImportExportTest.php:45
‪TYPO3\CMS\Impexp\Tests\Functional\ImportExportTest
Definition: ImportExportTest.php:26
‪TYPO3\CMS\Impexp\Tests\Functional\ImportExportTest\$testExtensionsToLoad
‪array $testExtensionsToLoad
Definition: ImportExportTest.php:27
‪TYPO3\CMS\Impexp\Tests\Functional
Definition: AbstractImportExportTestCase.php:18
‪TYPO3\CMS\Impexp\Tests\Functional\AbstractImportExportTestCase\assertXmlStringEqualsXmlFileWithIgnoredSqliteTypeInteger
‪assertXmlStringEqualsXmlFileWithIgnoredSqliteTypeInteger(string $expectedFile, string $actualXml)
Definition: AbstractImportExportTestCase.php:92
‪TYPO3\CMS\Impexp\Export\LEVELS_INFINITE
‪const LEVELS_INFINITE
Definition: Export.php:54
‪TYPO3\CMS\Impexp\Import
Definition: Import.php:51
‪TYPO3\CMS\Impexp\Tests\Functional\ImportExportTest\setUp
‪setUp()
Definition: ImportExportTest.php:38
‪TYPO3\CMS\Impexp\Tests\Functional\AbstractImportExportTestCase
Definition: AbstractImportExportTestCase.php:33
‪TYPO3\CMS\Impexp\Export
Definition: Export.php:52
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:52
‪TYPO3\CMS\Impexp\Tests\Functional\ImportExportTest\$exportMock
‪Export &MockObject &AccessibleObjectInterface $exportMock
Definition: ImportExportTest.php:36