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_1ncsv_hotel';
37  const TABLE_Offer = 'tx_irretutorial_1ncsv_offer';
38 
39  const FIELD_ContentHotel = 'tx_irretutorial_1ncsv_hotels';
40  const FIELD_HotelOffer = 'offers';
41 
45  protected $scenarioDataSetDirectory = 'typo3/sysext/core/Tests/Functional/DataHandling/IRRE/CSV/DataSet/';
46 
47  public function setUp() {
48  parent::setUp();
49  $this->importScenarioDataSet('LiveDefaultPages');
50  $this->importScenarioDataSet('LiveDefaultElements');
51 
52  $this->setUpFrontendRootPage(1, array('typo3/sysext/core/Tests/Functional/Fixtures/Frontend/JsonRenderer.ts'));
53  $this->backendUser->workspace = 0;
54  }
55 
63  public function createParentContent() {
64  $this->actionService->createNewRecord(self::TABLE_Content, self::VALUE_PageId, array('header' => 'Testing #1'));
65  }
66 
70  public function modifyParentContent() {
71  $this->actionService->modifyRecord(self::TABLE_Content, self::VALUE_ContentIdLast, array('header' => 'Testing #1'));
72  }
73 
77  public function deleteParentContent() {
78  $this->actionService->deleteRecord(self::TABLE_Content, self::VALUE_ContentIdLast);
79  }
80 
84  public function copyParentContent() {
85  $newTableIds = $this->actionService->copyRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_PageId);
86  $this->recordIds['newContentId'] = $newTableIds[self::TABLE_Content][self::VALUE_ContentIdLast];
87  }
88 
93  $newTableIds = $this->actionService->copyRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_PageIdTarget);
94  $this->recordIds['newContentId'] = $newTableIds[self::TABLE_Content][self::VALUE_ContentIdLast];
95  }
96 
101  $GLOBALS['TCA'][self::TABLE_Content]['columns'][self::FIELD_ContentHotel]['config']['behaviour']['localizationMode'] = 'keep';
102  $GLOBALS['TCA'][self::TABLE_Content]['columns'][self::FIELD_ContentHotel]['config']['behaviour']['localizeChildrenAtParentLocalization'] = FALSE;
103  $GLOBALS['TCA'][self::TABLE_Hotel]['columns'][self::FIELD_HotelOffer]['config']['behaviour']['localizeChildrenAtParentLocalization'] = FALSE;
104  $newTableIds = $this->actionService->localizeRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_LanguageId);
105  $this->recordIds['localizedContentId'] = $newTableIds[self::TABLE_Content][self::VALUE_ContentIdLast];
106  }
107 
112  $GLOBALS['TCA'][self::TABLE_Content]['columns'][self::FIELD_ContentHotel]['config']['behaviour']['localizationMode'] = 'keep';
113  $GLOBALS['TCA'][self::TABLE_Content]['columns'][self::FIELD_ContentHotel]['config']['behaviour']['localizeChildrenAtParentLocalization'] = TRUE;
114  $GLOBALS['TCA'][self::TABLE_Hotel]['columns'][self::FIELD_HotelOffer]['config']['behaviour']['localizeChildrenAtParentLocalization'] = TRUE;
115  $newTableIds = $this->actionService->localizeRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_LanguageId);
116  $this->recordIds['localizedContentId'] = $newTableIds[self::TABLE_Content][self::VALUE_ContentIdLast];
117  }
118 
123  $GLOBALS['TCA'][self::TABLE_Content]['columns'][self::FIELD_ContentHotel]['config']['behaviour']['localizationMode'] = 'select';
124  $GLOBALS['TCA'][self::TABLE_Content]['columns'][self::FIELD_ContentHotel]['config']['behaviour']['localizeChildrenAtParentLocalization'] = FALSE;
125  $GLOBALS['TCA'][self::TABLE_Hotel]['columns'][self::FIELD_HotelOffer]['config']['behaviour']['localizeChildrenAtParentLocalization'] = FALSE;
126  $newTableIds = $this->actionService->localizeRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_LanguageId);
127  $this->recordIds['localizedContentId'] = $newTableIds[self::TABLE_Content][self::VALUE_ContentIdLast];
128  }
129 
134  $GLOBALS['TCA'][self::TABLE_Content]['columns'][self::FIELD_ContentHotel]['config']['behaviour']['localizationMode'] = 'select';
135  $GLOBALS['TCA'][self::TABLE_Content]['columns'][self::FIELD_ContentHotel]['config']['behaviour']['localizeChildrenAtParentLocalization'] = TRUE;
136  $GLOBALS['TCA'][self::TABLE_Hotel]['columns'][self::FIELD_HotelOffer]['config']['behaviour']['localizeChildrenAtParentLocalization'] = TRUE;
137  $newTableIds = $this->actionService->localizeRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_LanguageId);
138  $this->recordIds['localizedContentId'] = $newTableIds[self::TABLE_Content][self::VALUE_ContentIdLast];
139  }
140 
144  public function changeParentContentSorting() {
145  $this->actionService->moveRecord(self::TABLE_Content, self::VALUE_ContentIdFirst, -self::VALUE_ContentIdLast);
146  }
147 
152  $this->actionService->moveRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_PageIdTarget);
153  }
154 
159  $this->actionService->moveRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_PageIdTarget);
160  $this->actionService->moveRecord(self::TABLE_Content, self::VALUE_ContentIdFirst, -self::VALUE_ContentIdLast);
161  }
162 
170  public function modifyPage() {
171  $this->actionService->modifyRecord(self::TABLE_Page, self::VALUE_PageId, array('title' => 'Testing #1'));
172  }
173 
177  public function deletePage() {
178  $this->actionService->deleteRecord(self::TABLE_Page, self::VALUE_PageId);
179  }
180 
184  public function copyPage() {
185  $newTableIds = $this->actionService->copyRecord(self::TABLE_Page, self::VALUE_PageId, self::VALUE_PageIdTarget);
186  $this->recordIds['newPageId'] = $newTableIds[self::TABLE_Page][self::VALUE_PageId];
187  }
188 
193  // Ensure hotels get processed first
194  $GLOBALS['TCA'] = array_merge(
195  array(self::TABLE_Hotel => $GLOBALS['TCA'][self::TABLE_Hotel]),
196  $GLOBALS['TCA']
197  );
198 
199  $newTableIds = $this->actionService->copyRecord(self::TABLE_Page, self::VALUE_PageId, self::VALUE_PageIdTarget);
200  $this->recordIds['newPageId'] = $newTableIds[self::TABLE_Page][self::VALUE_PageId];
201  }
202 
211  $newTableIds = $this->actionService->createNewRecords(
212  self::VALUE_PageId,
213  array(
214  self::TABLE_Content => array('header' => 'Testing #1', self::FIELD_ContentHotel => '__nextUid'),
215  self::TABLE_Hotel => array('title' => 'Hotel #1', self::FIELD_HotelOffer => '__nextUid'),
216  self::TABLE_Offer => array('title' => 'Offer #1'),
217  )
218  );
219  $this->recordIds['newContentId'] = $newTableIds[self::TABLE_Content][0];
220  }
221 
226  $newTableIds = $this->actionService->createNewRecords(
227  self::VALUE_PageId,
228  array(
229  self::TABLE_Content => array('header' => 'Testing #1', self::FIELD_ContentHotel => '__nextUid'),
230  self::TABLE_Hotel => array('title' => 'Hotel #1', self::FIELD_HotelOffer => '__nextUid'),
231  self::TABLE_Offer => array('title' => 'Offer #1'),
232  )
233  );
234  $this->recordIds['newContentId'] = $newTableIds[self::TABLE_Content][0];
235  $this->recordIds['newHotelId'] = $newTableIds[self::TABLE_Hotel][0];
236  $copiedTableIds = $this->actionService->copyRecord(self::TABLE_Content, $this->recordIds['newContentId'], self::VALUE_PageId);
237  $this->recordIds['copiedContentId'] = $copiedTableIds[self::TABLE_Content][$this->recordIds['newContentId']];
238  $this->recordIds['copiedHotelId'] = $copiedTableIds[self::TABLE_Hotel][$this->recordIds['newHotelId']];
239  }
240 
245  $newTableIds = $this->actionService->createNewRecords(
246  self::VALUE_PageId,
247  array(
248  self::TABLE_Content => array('header' => 'Testing #1', self::FIELD_ContentHotel => '__nextUid'),
249  self::TABLE_Hotel => array('title' => 'Hotel #1', self::FIELD_HotelOffer => '__nextUid'),
250  self::TABLE_Offer => array('title' => 'Offer #1'),
251  )
252  );
253  $this->recordIds['newContentId'] = $newTableIds[self::TABLE_Content][0];
254  $this->recordIds['newHotelId'] = $newTableIds[self::TABLE_Hotel][0];
255  $localizedTableIds = $this->actionService->localizeRecord(self::TABLE_Content, $this->recordIds['newContentId'], self::VALUE_LanguageId);
256  $this->recordIds['localizedHotelId'] = $localizedTableIds[self::TABLE_Hotel][$this->recordIds['newHotelId']];
257  }
258 
262  public function modifyOnlyHotelChild() {
263  $this->actionService->modifyRecord(self::TABLE_Hotel, 4, array('title' => 'Testing #1'));
264  }
265 
270  $this->actionService->modifyRecord(self::TABLE_Content, self::VALUE_ContentIdFirst, array(self::FIELD_ContentHotel => '4,3'));
271  }
272 
276  public function modifyParentWithHotelChild() {
277  $this->actionService->modifyRecords(
278  self::VALUE_PageId,
279  array(
280  self::TABLE_Content => array('uid' => self::VALUE_ContentIdFirst, self::FIELD_ContentHotel => '3,4'),
281  self::TABLE_Hotel => array('uid' => 4, 'title' => 'Testing #1'),
282  )
283  );
284  }
285 
289  public function modifyParentAndAddHotelChild() {
290  $this->actionService->modifyRecords(
291  self::VALUE_PageId,
292  array(
293  self::TABLE_Content => array('uid' => self::VALUE_ContentIdLast, self::FIELD_ContentHotel => '5,__nextUid'),
294  self::TABLE_Hotel => array('uid' => '__NEW', 'title' => 'Hotel #2'),
295  )
296  );
297  }
298 
303  $this->actionService->modifyRecord(
304  self::TABLE_Content,
305  self::VALUE_ContentIdFirst,
306  array(self::FIELD_ContentHotel => '3'),
307  array(self::TABLE_Hotel => array(4))
308  );
309  }
310 
311 }
setUpFrontendRootPage($pageId, array $typoScriptFiles=array())
if(!defined('TYPO3_MODE')) $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][]