‪TYPO3CMS  11.5
ExportCommandTest.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 
20 use Symfony\Component\Console\Tester\CommandTester;
24 
29 {
34  {
35  $input = [
36  'filename' => 'empty_export',
37  '--type' => ‪Export::FILETYPE_T3D,
38  '--pid' => 123,
40  '--table' => ['tt_content'],
41  '--record' => ['sys_category:6'],
42  '--list' => ['sys_category:123'],
43  '--include-related' => ['be_users'],
44  // @deprecated since v11, will be removed in v12. Drop the lowerCamelCase options.
45  '--includeRelated' => ['be_groups'],
46  '--include-static' => ['sys_category'],
47  '--includeStatic' => ['sys_language'],
48  '--exclude' => ['be_users:3'],
49  '--exclude-disabled-records' => false,
50  '--excludeDisabledRecords' => true,
51  '--exclude-html-css' => false,
52  '--excludeHtmlCss' => true,
53  '--title' => 'Export Command',
54  '--description' => 'The export which considers all arguments passed on the command line.',
55  '--notes' => 'This export is not for production use.',
56  '--dependency' => ['bootstrap_package'],
57  '--save-files-outside-export-file' => false,
58  '--saveFilesOutsideExportFile' => true,
59  ];
60 
61  $exportMock = $this->getAccessibleMock(Export::class, [
62  'setExportFileType', 'setExportFileName', 'setPid', 'setLevels', 'setTables', 'setRecord', 'setList',
63  'setRelOnlyTables', 'setRelStaticTables', 'setExcludeMap', 'setExcludeDisabledRecords',
64  'setIncludeExtFileResources', 'setTitle', 'setDescription', 'setNotes', 'setExtensionDependencies',
65  'setSaveFilesOutsideExportFile',
66  ]);
67  $exportMock->expects(self::once())->method('setExportFileName')->with(self::equalTo('empty_export'));
68  $exportMock->expects(self::once())->method('setExportFileType')->with(self::equalTo(‪Export::FILETYPE_T3D));
69  $exportMock->expects(self::once())->method('setPid')->with(self::equalTo(123));
70  $exportMock->expects(self::once())->method('setLevels')->with(self::equalTo(‪Export::LEVELS_RECORDS_ON_THIS_PAGE));
71  $exportMock->expects(self::once())->method('setTables')->with(self::equalTo(['tt_content']));
72  $exportMock->expects(self::once())->method('setRecord')->with(self::equalTo(['sys_category:6']));
73  $exportMock->expects(self::once())->method('setList')->with(self::equalTo(['sys_category:123']));
74  $exportMock->expects(self::once())->method('setRelOnlyTables')->with(self::equalTo(['be_groups', 'be_users']));
75  $exportMock->expects(self::once())->method('setRelStaticTables')->with(self::equalTo(['sys_language', 'sys_category']));
76  $exportMock->expects(self::once())->method('setExcludeMap')->with(self::equalTo(['be_users:3']));
77  $exportMock->expects(self::once())->method('setExcludeDisabledRecords')->with(self::equalTo(true));
78  $exportMock->expects(self::once())->method('setIncludeExtFileResources')->with(self::equalTo(false));
79  $exportMock->expects(self::once())->method('setTitle')->with(self::equalTo('Export Command'));
80  $exportMock->expects(self::once())->method('setDescription')->with(self::equalTo('The export which considers all arguments passed on the command line.'));
81  $exportMock->expects(self::once())->method('setNotes')->with(self::equalTo('This export is not for production use.'));
82  $exportMock->expects(self::once())->method('setExtensionDependencies')->with(self::equalTo(['bootstrap_package']));
83  $exportMock->expects(self::once())->method('setSaveFilesOutsideExportFile')->with(self::equalTo(true));
84 
85  $tester = new CommandTester(new ‪ExportCommand($exportMock));
86  $tester->execute($input);
87  }
88 }
‪TYPO3\CMS\Impexp\Tests\FunctionalDeprecated\Command
Definition: ExportCommandTest.php:18
‪TYPO3\CMS\Impexp\Export\FILETYPE_T3D
‪const FILETYPE_T3D
Definition: Export.php:54
‪TYPO3\CMS\Impexp\Tests\FunctionalDeprecated\Command\ExportCommandTest
Definition: ExportCommandTest.php:29
‪TYPO3\CMS\Impexp\Export\LEVELS_RECORDS_ON_THIS_PAGE
‪const LEVELS_RECORDS_ON_THIS_PAGE
Definition: Export.php:49
‪TYPO3\CMS\Impexp\Tests\Functional\AbstractImportExportTestCase
Definition: AbstractImportExportTestCase.php:34
‪TYPO3\CMS\Impexp\Export
Definition: Export.php:48
‪TYPO3\CMS\Impexp\Tests\FunctionalDeprecated\Command\ExportCommandTest\exportCommandPassesArgumentsToExportObject
‪exportCommandPassesArgumentsToExportObject()
Definition: ExportCommandTest.php:33
‪TYPO3\CMS\Impexp\Command\ExportCommand
Definition: ExportCommand.php:34