TYPO3 CMS  TYPO3_6-2
AbstractActionTestCase.php
Go to the documentation of this file.
1 <?php
3 
17 require_once dirname(dirname(dirname(__FILE__))) . '/AbstractDataHandlerActionTestCase.php';
18 
23 
24  const VALUE_PageId = 89;
25  const VALUE_PageIdTarget = 90;
27  const VALUE_ContentIdFirst = 297;
28  const VALUE_ContentIdLast = 298;
29  const VALUE_HotelIdFirst = 3;
31  const VALUE_HotelIdThird = 5;
32  const VALUE_LanguageId = 1;
33 
34  const TABLE_Page = 'pages';
35  const TABLE_Content = 'tt_content';
36  const TABLE_Hotel = 'tx_irretutorial_1nff_hotel';
37  const TABLE_Offer = 'tx_irretutorial_1nff_offer';
38 
39  const FIELD_ContentHotel = 'tx_irretutorial_1nff_hotels';
40  const FIELD_HotelOffer = 'offers';
41 
45  protected $scenarioDataSetDirectory = 'typo3/sysext/core/Tests/Functional/DataHandling/IRRE/ForeignField/DataSet/';
46 
47  public function setUp() {
48  parent::setUp();
49  $this->importScenarioDataSet('LiveDefaultPages');
50  $this->importScenarioDataSet('LiveDefaultElements');
51 
52  $this->setUpFrontendRootPage(
53  1,
54  array(
55  'typo3/sysext/core/Tests/Functional/Fixtures/Frontend/JsonRenderer.ts',
56  'typo3/sysext/core/Tests/Functional/Fixtures/Frontend/ExtbaseJsonRenderer.ts',
57  )
58  );
59  $this->backendUser->workspace = 0;
60  }
61 
69  public function createParentContent() {
70  $this->actionService->createNewRecord(self::TABLE_Content, self::VALUE_PageId, array('header' => 'Testing #1'));
71  }
72 
76  public function modifyParentContent() {
77  $this->actionService->modifyRecord(self::TABLE_Content, self::VALUE_ContentIdLast, array('header' => 'Testing #1'));
78  }
79 
83  public function deleteParentContent() {
84  $this->actionService->deleteRecord(self::TABLE_Content, self::VALUE_ContentIdLast);
85  }
86 
90  public function copyParentContent() {
91  $newTableIds = $this->actionService->copyRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_PageId);
92  $this->recordIds['newContentId'] = $newTableIds[self::TABLE_Content][self::VALUE_ContentIdLast];
93  }
94 
99  $newTableIds = $this->actionService->copyRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_PageIdTarget);
100  $this->recordIds['newContentId'] = $newTableIds[self::TABLE_Content][self::VALUE_ContentIdLast];
101  }
102 
107  $GLOBALS['TCA'][self::TABLE_Content]['columns'][self::FIELD_ContentHotel]['config']['behaviour']['localizationMode'] = 'keep';
108  $GLOBALS['TCA'][self::TABLE_Content]['columns'][self::FIELD_ContentHotel]['config']['behaviour']['localizeChildrenAtParentLocalization'] = FALSE;
109  $GLOBALS['TCA'][self::TABLE_Hotel]['columns'][self::FIELD_HotelOffer]['config']['behaviour']['localizeChildrenAtParentLocalization'] = FALSE;
110  $newTableIds = $this->actionService->localizeRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_LanguageId);
111  $this->recordIds['localizedContentId'] = $newTableIds[self::TABLE_Content][self::VALUE_ContentIdLast];
112  }
113 
118  $GLOBALS['TCA'][self::TABLE_Content]['columns'][self::FIELD_ContentHotel]['config']['behaviour']['localizationMode'] = 'keep';
119  $GLOBALS['TCA'][self::TABLE_Content]['columns'][self::FIELD_ContentHotel]['config']['behaviour']['localizeChildrenAtParentLocalization'] = TRUE;
120  $GLOBALS['TCA'][self::TABLE_Hotel]['columns'][self::FIELD_HotelOffer]['config']['behaviour']['localizeChildrenAtParentLocalization'] = TRUE;
121  $newTableIds = $this->actionService->localizeRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_LanguageId);
122  $this->recordIds['localizedContentId'] = $newTableIds[self::TABLE_Content][self::VALUE_ContentIdLast];
123  }
124 
129  $GLOBALS['TCA'][self::TABLE_Content]['columns'][self::FIELD_ContentHotel]['config']['behaviour']['localizationMode'] = 'select';
130  $GLOBALS['TCA'][self::TABLE_Content]['columns'][self::FIELD_ContentHotel]['config']['behaviour']['localizeChildrenAtParentLocalization'] = FALSE;
131  $GLOBALS['TCA'][self::TABLE_Hotel]['columns'][self::FIELD_HotelOffer]['config']['behaviour']['localizeChildrenAtParentLocalization'] = FALSE;
132  $newTableIds = $this->actionService->localizeRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_LanguageId);
133  $this->recordIds['localizedContentId'] = $newTableIds[self::TABLE_Content][self::VALUE_ContentIdLast];
134  }
135 
140  $GLOBALS['TCA'][self::TABLE_Content]['columns'][self::FIELD_ContentHotel]['config']['behaviour']['localizationMode'] = 'select';
141  $GLOBALS['TCA'][self::TABLE_Content]['columns'][self::FIELD_ContentHotel]['config']['behaviour']['localizeChildrenAtParentLocalization'] = TRUE;
142  $GLOBALS['TCA'][self::TABLE_Hotel]['columns'][self::FIELD_HotelOffer]['config']['behaviour']['localizeChildrenAtParentLocalization'] = TRUE;
143  $newTableIds = $this->actionService->localizeRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_LanguageId);
144  $this->recordIds['localizedContentId'] = $newTableIds[self::TABLE_Content][self::VALUE_ContentIdLast];
145  }
146 
150  public function changeParentContentSorting() {
151  $this->actionService->moveRecord(self::TABLE_Content, self::VALUE_ContentIdFirst, -self::VALUE_ContentIdLast);
152  }
153 
158  $this->actionService->moveRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_PageIdTarget);
159  }
160 
165  $this->actionService->moveRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_PageIdTarget);
166  $this->actionService->moveRecord(self::TABLE_Content, self::VALUE_ContentIdFirst, -self::VALUE_ContentIdLast);
167  }
168 
176  public function modifyPage() {
177  $this->actionService->modifyRecord(self::TABLE_Page, self::VALUE_PageId, array('title' => 'Testing #1'));
178  }
179 
183  public function deletePage() {
184  $this->actionService->deleteRecord(self::TABLE_Page, self::VALUE_PageId);
185  }
186 
190  public function copyPage() {
191  $newTableIds = $this->actionService->copyRecord(self::TABLE_Page, self::VALUE_PageId, self::VALUE_PageIdTarget);
192  $this->recordIds['newPageId'] = $newTableIds[self::TABLE_Page][self::VALUE_PageId];
193  }
194 
199  // Ensure hotels get processed first
200  $GLOBALS['TCA'] = array_merge(
201  array(self::TABLE_Hotel => $GLOBALS['TCA'][self::TABLE_Hotel]),
202  $GLOBALS['TCA']
203  );
204 
205  $newTableIds = $this->actionService->copyRecord(self::TABLE_Page, self::VALUE_PageId, self::VALUE_PageIdTarget);
206  $this->recordIds['newPageId'] = $newTableIds[self::TABLE_Page][self::VALUE_PageId];
207  }
208 
217  $newTableIds = $this->actionService->createNewRecords(
218  self::VALUE_PageId,
219  array(
220  self::TABLE_Content => array('header' => 'Testing #1', self::FIELD_ContentHotel => '__nextUid'),
221  self::TABLE_Hotel => array('title' => 'Hotel #1', self::FIELD_HotelOffer => '__nextUid'),
222  self::TABLE_Offer => array('title' => 'Offer #1'),
223  )
224  );
225  $this->recordIds['newContentId'] = $newTableIds[self::TABLE_Content][0];
226  }
227 
232  $newTableIds = $this->actionService->createNewRecords(
233  self::VALUE_PageId,
234  array(
235  self::TABLE_Content => array('header' => 'Testing #1', self::FIELD_ContentHotel => '__nextUid'),
236  self::TABLE_Hotel => array('title' => 'Hotel #1', self::FIELD_HotelOffer => '__nextUid'),
237  self::TABLE_Offer => array('title' => 'Offer #1'),
238  )
239  );
240  $this->recordIds['newContentId'] = $newTableIds[self::TABLE_Content][0];
241  $this->recordIds['newHotelId'] = $newTableIds[self::TABLE_Hotel][0];
242  $copiedTableIds = $this->actionService->copyRecord(self::TABLE_Content, $this->recordIds['newContentId'], self::VALUE_PageId);
243  $this->recordIds['copiedContentId'] = $copiedTableIds[self::TABLE_Content][$this->recordIds['newContentId']];
244  $this->recordIds['copiedHotelId'] = $copiedTableIds[self::TABLE_Hotel][$this->recordIds['newHotelId']];
245  }
246 
251  $newTableIds = $this->actionService->createNewRecords(
252  self::VALUE_PageId,
253  array(
254  self::TABLE_Content => array('header' => 'Testing #1', self::FIELD_ContentHotel => '__nextUid'),
255  self::TABLE_Hotel => array('title' => 'Hotel #1', self::FIELD_HotelOffer => '__nextUid'),
256  self::TABLE_Offer => array('title' => 'Offer #1'),
257  )
258  );
259  $this->recordIds['newContentId'] = $newTableIds[self::TABLE_Content][0];
260  $this->recordIds['newHotelId'] = $newTableIds[self::TABLE_Hotel][0];
261  $this->actionService->localizeRecord(self::TABLE_Content, $this->recordIds['newContentId'], self::VALUE_LanguageId);
262  }
263 
268  unset($GLOBALS['TCA'][self::TABLE_Hotel]['ctrl']['sortby']);
269  $newTableIds = $this->actionService->createNewRecords(
270  self::VALUE_PageId,
271  array(
272  self::TABLE_Content => array('header' => 'Testing #1', self::FIELD_ContentHotel => '__nextUid'),
273  self::TABLE_Hotel => array('title' => 'Hotel #1', self::FIELD_HotelOffer => '__nextUid'),
274  self::TABLE_Offer => array('title' => 'Offer #1'),
275  )
276  );
277  $this->recordIds['newContentId'] = $newTableIds[self::TABLE_Content][0];
278  $this->recordIds['newHotelId'] = $newTableIds[self::TABLE_Hotel][0];
279  $localizedTableIds = $this->actionService->localizeRecord(self::TABLE_Content, $this->recordIds['newContentId'], self::VALUE_LanguageId);
280  $this->recordIds['localizedContentId'] = $localizedTableIds[self::TABLE_Content][$this->recordIds['newContentId']];
281  }
282 
286  public function modifyOnlyHotelChild() {
287  $this->actionService->modifyRecord(self::TABLE_Hotel, 4, array('title' => 'Testing #1'));
288  }
289 
294  $this->actionService->modifyRecord(self::TABLE_Content, self::VALUE_ContentIdFirst, array(self::FIELD_ContentHotel => '4,3'));
295  }
296 
300  public function modifyParentWithHotelChild() {
301  $this->actionService->modifyRecords(
302  self::VALUE_PageId,
303  array(
304  self::TABLE_Content => array('uid' => self::VALUE_ContentIdFirst, self::FIELD_ContentHotel => '3,4'),
305  self::TABLE_Hotel => array('uid' => 4, 'title' => 'Testing #1'),
306  )
307  );
308  }
309 
313  public function modifyParentAndAddHotelChild() {
314  $this->actionService->modifyRecords(
315  self::VALUE_PageId,
316  array(
317  self::TABLE_Content => array('uid' => self::VALUE_ContentIdLast, self::FIELD_ContentHotel => '5,__nextUid'),
318  self::TABLE_Hotel => array('uid' => '__NEW', 'title' => 'Hotel #2'),
319  )
320  );
321  }
322 
327  $this->actionService->modifyRecord(
328  self::TABLE_Content,
329  self::VALUE_ContentIdFirst,
330  array(self::FIELD_ContentHotel => '3'),
331  array(self::TABLE_Hotel => array(4))
332  );
333  }
334 
335 }
setUpFrontendRootPage($pageId, array $typoScriptFiles=array())
if(!defined('TYPO3_MODE')) $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][]