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