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