TYPO3 CMS  TYPO3_6-2
AbstractActionTestCase.php
Go to the documentation of this file.
1 <?php
3 
17 require_once dirname(dirname(__FILE__)) . '/AbstractDataHandlerActionTestCase.php';
18 
23 
24  const VALUE_PageId = 89;
25  const VALUE_PageIdTarget = 90;
26  const VALUE_ContentIdFirst = 297;
27  const VALUE_ContentIdLast = 298;
28  const VALUE_LanguageId = 1;
32 
33  const TABLE_Content = 'tt_content';
34  const TABLE_Element = 'tx_testdatahandler_element';
35 
36  const FIELD_ContentElement = 'tx_testdatahandler_group';
37 
41  protected $scenarioDataSetDirectory = 'typo3/sysext/core/Tests/Functional/DataHandling/Group/DataSet/';
42 
43  public function setUp() {
44  $this->testExtensionsToLoad[] = 'typo3/sysext/core/Tests/Functional/Fixtures/Extensions/test_datahandler';
45 
46  parent::setUp();
47  $this->importScenarioDataSet('LiveDefaultPages');
48  $this->importScenarioDataSet('LiveDefaultElements');
49  $this->importScenarioDataSet('ReferenceIndex');
50 
51  $this->setUpFrontendRootPage(1, array('typo3/sysext/core/Tests/Functional/Fixtures/Frontend/JsonRenderer.ts'));
52  }
53 
62  public function addElementRelation() {
63  $this->actionService->modifyReferences(
64  self::TABLE_Content, self::VALUE_ContentIdFirst, self::FIELD_ContentElement, array(self::VALUE_ElementIdFirst, self::VALUE_ElementIdSecond, self::VALUE_ElementIdThird)
65  );
66  }
67 
72  public function deleteElementRelation() {
73  $this->actionService->modifyReferences(
74  self::TABLE_Content, self::VALUE_ContentIdFirst, self::FIELD_ContentElement, array(self::VALUE_ElementIdFirst)
75  );
76  }
77 
82  public function changeElementSorting() {
83  $this->actionService->moveRecord(self::TABLE_Element, self::VALUE_ElementIdFirst, -self::VALUE_ElementIdSecond);
84  }
85 
90  public function changeElementRelationSorting() {
91  $this->actionService->modifyReferences(
92  self::TABLE_Content, self::VALUE_ContentIdFirst, self::FIELD_ContentElement, array(self::VALUE_ElementIdSecond, self::VALUE_ElementIdFirst)
93  );
94  }
95 
101  $newTableIds = $this->actionService->createNewRecord(
102  self::TABLE_Content, self::VALUE_PageId, array('header' => 'Testing #1', self::FIELD_ContentElement => self::VALUE_ElementIdFirst)
103  );
104  $this->recordIds['newContentId'] = $newTableIds[self::TABLE_Content][0];
105  }
106 
112  $newElementIds = $this->actionService->createNewRecord(self::TABLE_Element, self::VALUE_PageId, array('title' => 'Testing #1'));
113  $this->recordIds['newElementId'] = $newElementIds[self::TABLE_Element][0];
114  // It's not possible to use "NEW..." values for the TCA type 'group'
115  $newContentIds = $this->actionService->createNewRecord(self::TABLE_Content, self::VALUE_PageId, array('header' => 'Testing #1', self::FIELD_ContentElement => $this->recordIds['newElementId']));
116  $this->recordIds['newContentId'] = $newContentIds[self::TABLE_Content][0];
117  }
118 
123  public function modifyElementOfRelation() {
124  $this->actionService->modifyRecord(self::TABLE_Element, self::VALUE_ElementIdFirst, array('title' => 'Testing #1'));
125  }
126 
131  public function modifyContentOfRelation() {
132  $this->actionService->modifyRecord(self::TABLE_Content, self::VALUE_ContentIdFirst, array('header' => 'Testing #1'));
133  }
134 
139  public function modifyBothSidesOfRelation() {
140  $this->actionService->modifyRecord(self::TABLE_Element, self::VALUE_ElementIdFirst, array('title' => 'Testing #1'));
141  $this->actionService->modifyRecord(self::TABLE_Content, self::VALUE_ContentIdFirst, array('header' => 'Testing #1'));
142  }
143 
148  public function deleteContentOfRelation() {
149  $this->actionService->deleteRecord(self::TABLE_Content, self::VALUE_ContentIdLast);
150  }
151 
156  public function deleteElementOfRelation() {
157  $this->actionService->deleteRecord(self::TABLE_Element, self::VALUE_ElementIdFirst);
158  }
159 
164  public function copyContentOfRelation() {
165  $newTableIds = $this->actionService->copyRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_PageId);
166  $this->recordIds['copiedContentId'] = $newTableIds[self::TABLE_Content][self::VALUE_ContentIdLast];
167  }
168 
173  public function copyElementOfRelation() {
174  $newTableIds = $this->actionService->copyRecord(self::TABLE_Element, self::VALUE_ElementIdFirst, self::VALUE_PageId);
175  $this->recordIds['copiedElementId'] = $newTableIds[self::TABLE_Element][self::VALUE_ElementIdFirst];
176  }
177 
182  public function localizeContentOfRelation() {
183  $newTableIds = $this->actionService->localizeRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_LanguageId);
184  $this->recordIds['localizedContentId'] = $newTableIds[self::TABLE_Content][self::VALUE_ContentIdLast];
185  }
186 
191  public function localizeElementOfRelation() {
192  $newTableIds = $this->actionService->localizeRecord(self::TABLE_Element, self::VALUE_ElementIdFirst, self::VALUE_LanguageId);
193  $this->recordIds['localizedElementId'] = $newTableIds[self::TABLE_Element][self::VALUE_ElementIdFirst];
194  }
195 
201  $this->actionService->moveRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_PageIdTarget);
202  }
203 
204 }
setUpFrontendRootPage($pageId, array $typoScriptFiles=array())