[CLEANUP] Remove obsolete require_once from test files
[Packages/TYPO3.CMS.git] / typo3 / sysext / core / Tests / Functional / DataHandling / FAL / AbstractActionTestCase.php
1 <?php
2 namespace TYPO3\CMS\Core\Tests\Functional\DataHandling\FAL;
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
17 /**
18 * Functional test for the DataHandler
19 */
20 abstract class AbstractActionTestCase extends \TYPO3\CMS\Core\Tests\Functional\DataHandling\AbstractDataHandlerActionTestCase {
21
22 const VALUE_PageId = 89;
23 const VALUE_PageIdTarget = 90;
24 const VALUE_PageIdWebsite = 1;
25 const VALUE_ContentIdFirst = 330;
26 const VALUE_ContentIdLast = 331;
27 const VALUE_FileIdFirst = 1;
28 const VALUE_FileIdLast = 21;
29 const VALUE_LanguageId = 1;
30
31 const VALUE_FileReferenceContentFirstFileFirst = 126;
32 const VALUE_FileReferenceContentFirstFileLast = 127;
33 const VALUE_FileReferenceContentLastFileLast = 128;
34 const VALUE_FileReferenceContentLastFileFirst = 129;
35
36 const TABLE_Page = 'pages';
37 const TABLE_Content = 'tt_content';
38 const TABLE_File = 'sys_file';
39 const TABLE_FileMetadata = 'sys_file_metadata';
40 const TABLE_FileReference = 'sys_file_reference';
41
42 const FIELD_ContentImage = 'image';
43 const FIELD_FileReferenceImage = 'uid_local';
44
45 /**
46 * @var string
47 */
48 protected $scenarioDataSetDirectory = 'typo3/sysext/core/Tests/Functional/DataHandling/FAL/DataSet/';
49
50 protected function setUp() {
51 parent::setUp();
52 $this->importScenarioDataSet('LiveDefaultPages');
53 $this->importScenarioDataSet('LiveDefaultElements');
54 $this->importDataSet(ORIGINAL_ROOT . 'typo3/sysext/core/Tests/Functional/Fixtures/sys_file_storage.xml');
55
56 $this->setUpFrontendRootPage(1, array('typo3/sysext/core/Tests/Functional/Fixtures/Frontend/JsonRenderer.ts'));
57 $this->backendUser->workspace = 0;
58 }
59
60 /**
61 * Content records
62 */
63
64 /**
65 * @see DataSet/Assertion/modifyContentRecord.csv
66 */
67 public function modifyContent() {
68 $this->actionService->modifyRecord(self::TABLE_Content, self::VALUE_ContentIdLast, array('header' => 'Testing #1'));
69 }
70
71 /**
72 * @see DataSet/Assertion/deleteContentRecord.csv
73 */
74 public function deleteContent() {
75 $this->actionService->deleteRecord(self::TABLE_Content, self::VALUE_ContentIdLast);
76 }
77
78 /**
79 * @see DataSet/Assertion/copyContentRecord.csv
80 */
81 public function copyContent() {
82 $newTableIds = $this->actionService->copyRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_PageId);
83 $this->recordIds['copiedContentId'] = $newTableIds[self::TABLE_Content][self::VALUE_ContentIdLast];
84 }
85
86 /**
87 * @see DataSet/Assertion/localizeContentRecord.csv
88 */
89 public function localizeContent() {
90 $newTableIds = $this->actionService->localizeRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_LanguageId);
91 $this->recordIds['localizedContentId'] = $newTableIds[self::TABLE_Content][self::VALUE_ContentIdLast];
92 }
93
94 /**
95 * @see DataSet/Assertion/changeContentRecordSorting.csv
96 */
97 public function changeContentSorting() {
98 $this->actionService->moveRecord(self::TABLE_Content, self::VALUE_ContentIdFirst, -self::VALUE_ContentIdLast);
99 }
100
101 /**
102 * @see DataSet/Assertion/moveContentRecordToDifferentPage.csv
103 */
104 public function moveContentToDifferentPage() {
105 $this->actionService->moveRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_PageIdTarget);
106 }
107
108 /**
109 * @see DataSet/Assertion/moveContentRecordToDifferentPageAndChangeSorting.csv
110 */
111 public function moveContentToDifferentPageAndChangeSorting() {
112 $this->actionService->moveRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_PageIdTarget);
113 $this->actionService->moveRecord(self::TABLE_Content, self::VALUE_ContentIdFirst, -self::VALUE_ContentIdLast);
114 }
115
116 /**
117 * File references
118 */
119
120 public function createContentWithFileReference() {
121 $newTableIds = $this->actionService->createNewRecords(
122 self::VALUE_PageId,
123 array(
124 self::TABLE_Content => array('header' => 'Testing #1', self::FIELD_ContentImage => '__nextUid'),
125 self::TABLE_FileReference => array('title' => 'Image #1', self::FIELD_FileReferenceImage => self::VALUE_FileIdFirst),
126 )
127 );
128 $this->recordIds['newContentId'] = $newTableIds[self::TABLE_Content][0];
129 }
130
131 public function modifyContentWithFileReference() {
132 $this->actionService->modifyRecords(
133 self::VALUE_PageId,
134 array(
135 self::TABLE_Content => array('uid' => self::VALUE_ContentIdLast, 'header' => 'Testing #1', self::FIELD_ContentImage => self::VALUE_FileReferenceContentLastFileLast . ',' . self::VALUE_FileReferenceContentLastFileFirst),
136 self::TABLE_FileReference => array('uid' => self::VALUE_FileReferenceContentLastFileFirst, 'title' => 'Image #1'),
137 )
138 );
139 }
140
141 public function modifyContentAndAddFileReference() {
142 $this->actionService->modifyRecords(
143 self::VALUE_PageId,
144 array(
145 self::TABLE_Content => array('uid' => self::VALUE_ContentIdLast, self::FIELD_ContentImage => self::VALUE_FileReferenceContentLastFileLast . ',' . self::VALUE_FileReferenceContentLastFileFirst . ',__nextUid'),
146 self::TABLE_FileReference => array('uid' => '__NEW', 'title' => 'Image #3', self::FIELD_FileReferenceImage => self::VALUE_FileIdFirst),
147 )
148 );
149 }
150
151 public function modifyContentAndDeleteFileReference() {
152 $this->actionService->modifyRecord(
153 self::TABLE_Content,
154 self::VALUE_ContentIdLast,
155 array(self::FIELD_ContentImage => self::VALUE_FileReferenceContentLastFileFirst),
156 array(self::TABLE_FileReference => array(self::VALUE_FileReferenceContentLastFileLast))
157 );
158 }
159
160 public function modifyContentAndDeleteAllFileReference() {
161 $this->actionService->modifyRecord(
162 self::TABLE_Content,
163 self::VALUE_ContentIdLast,
164 array(self::FIELD_ContentImage => ''),
165 array(self::TABLE_FileReference => array(self::VALUE_FileReferenceContentLastFileFirst, self::VALUE_FileReferenceContentLastFileLast))
166 );
167 }
168
169 }