TYPO3 CMS  TYPO3_7-6
AbstractActionTestCase.php
Go to the documentation of this file.
1 <?php
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 
21 {
22  const VALUE_PageId = 89;
23  const VALUE_PageIdTarget = 90;
24  const VALUE_ContentIdFirst = 297;
25  const VALUE_ContentIdLast = 298;
26  const VALUE_LanguageId = 1;
30 
31  const TABLE_Content = 'tt_content';
32  const TABLE_Element = 'tx_testdatahandler_element';
33 
34  const FIELD_ContentElement = 'tx_testdatahandler_group';
35 
39  protected $scenarioDataSetDirectory = 'typo3/sysext/core/Tests/Functional/DataHandling/Group/DataSet/';
40 
41  protected function setUp()
42  {
43  $this->testExtensionsToLoad[] = 'typo3/sysext/core/Tests/Functional/Fixtures/Extensions/test_datahandler';
44 
45  parent::setUp();
46  $this->importScenarioDataSet('LiveDefaultPages');
47  $this->importScenarioDataSet('LiveDefaultElements');
48  $this->importScenarioDataSet('ReferenceIndex');
49 
50  $this->setUpFrontendRootPage(1, ['typo3/sysext/core/Tests/Functional/Fixtures/Frontend/JsonRenderer.ts']);
51  }
52 
61  public function addElementRelation()
62  {
63  $this->actionService->modifyReferences(
64  self::TABLE_Content, self::VALUE_ContentIdFirst, self::FIELD_ContentElement, [self::VALUE_ElementIdFirst, self::VALUE_ElementIdSecond, self::VALUE_ElementIdThird]
65  );
66  }
67 
72  public function deleteElementRelation()
73  {
74  $this->actionService->modifyReferences(
75  self::TABLE_Content, self::VALUE_ContentIdFirst, self::FIELD_ContentElement, [self::VALUE_ElementIdFirst]
76  );
77  }
78 
83  public function changeElementSorting()
84  {
85  $this->actionService->moveRecord(self::TABLE_Element, self::VALUE_ElementIdFirst, -self::VALUE_ElementIdSecond);
86  }
87 
92  public function changeElementRelationSorting()
93  {
94  $this->actionService->modifyReferences(
95  self::TABLE_Content, self::VALUE_ContentIdFirst, self::FIELD_ContentElement, [self::VALUE_ElementIdSecond, self::VALUE_ElementIdFirst]
96  );
97  }
98 
104  {
105  $newTableIds = $this->actionService->createNewRecord(
106  self::TABLE_Content, self::VALUE_PageId, ['header' => 'Testing #1', self::FIELD_ContentElement => self::VALUE_ElementIdFirst]
107  );
108  $this->recordIds['newContentId'] = $newTableIds[self::TABLE_Content][0];
109  }
110 
116  {
117  $newElementIds = $this->actionService->createNewRecord(self::TABLE_Element, self::VALUE_PageId, ['title' => 'Testing #1']);
118  $this->recordIds['newElementId'] = $newElementIds[self::TABLE_Element][0];
119  // It's not possible to use "NEW..." values for the TCA type 'group'
120  $newContentIds = $this->actionService->createNewRecord(self::TABLE_Content, self::VALUE_PageId, ['header' => 'Testing #1', self::FIELD_ContentElement => $this->recordIds['newElementId']]);
121  $this->recordIds['newContentId'] = $newContentIds[self::TABLE_Content][0];
122  }
123 
128  public function modifyElementOfRelation()
129  {
130  $this->actionService->modifyRecord(self::TABLE_Element, self::VALUE_ElementIdFirst, ['title' => 'Testing #1']);
131  }
132 
137  public function modifyContentOfRelation()
138  {
139  $this->actionService->modifyRecord(self::TABLE_Content, self::VALUE_ContentIdFirst, ['header' => 'Testing #1']);
140  }
141 
146  public function modifyBothSidesOfRelation()
147  {
148  $this->actionService->modifyRecord(self::TABLE_Element, self::VALUE_ElementIdFirst, ['title' => 'Testing #1']);
149  $this->actionService->modifyRecord(self::TABLE_Content, self::VALUE_ContentIdFirst, ['header' => 'Testing #1']);
150  }
151 
156  public function deleteContentOfRelation()
157  {
158  $this->actionService->deleteRecord(self::TABLE_Content, self::VALUE_ContentIdLast);
159  }
160 
165  public function deleteElementOfRelation()
166  {
167  $this->actionService->deleteRecord(self::TABLE_Element, self::VALUE_ElementIdFirst);
168  }
169 
174  public function copyContentOfRelation()
175  {
176  $newTableIds = $this->actionService->copyRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_PageId);
177  $this->recordIds['copiedContentId'] = $newTableIds[self::TABLE_Content][self::VALUE_ContentIdLast];
178  }
179 
184  public function copyElementOfRelation()
185  {
186  $newTableIds = $this->actionService->copyRecord(self::TABLE_Element, self::VALUE_ElementIdFirst, self::VALUE_PageId);
187  $this->recordIds['copiedElementId'] = $newTableIds[self::TABLE_Element][self::VALUE_ElementIdFirst];
188  }
189 
195  {
196  $newTableIds = $this->actionService->copyRecordToLanguage(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_LanguageId);
197  $this->recordIds['localizedContentId'] = $newTableIds[self::TABLE_Content][self::VALUE_ContentIdLast];
198  }
199 
205  {
206  $newTableIds = $this->actionService->copyRecordToLanguage(self::TABLE_Element, self::VALUE_ElementIdFirst, self::VALUE_LanguageId);
207  $this->recordIds['localizedElementId'] = $newTableIds[self::TABLE_Element][self::VALUE_ElementIdFirst];
208  }
209 
214  public function localizeContentOfRelation()
215  {
216  $newTableIds = $this->actionService->localizeRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_LanguageId);
217  $this->recordIds['localizedContentId'] = $newTableIds[self::TABLE_Content][self::VALUE_ContentIdLast];
218  }
219 
224  public function localizeElementOfRelation()
225  {
226  $newTableIds = $this->actionService->localizeRecord(self::TABLE_Element, self::VALUE_ElementIdFirst, self::VALUE_LanguageId);
227  $this->recordIds['localizedElementId'] = $newTableIds[self::TABLE_Element][self::VALUE_ElementIdFirst];
228  }
229 
235  {
236  $this->actionService->moveRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_PageIdTarget);
237  }
238 }
setUpFrontendRootPage($pageId, array $typoScriptFiles=[])