TYPO3 CMS  TYPO3_6-2
AbstractActionTestCase.php
Go to the documentation of this file.
1 <?php
3 
17 require_once __DIR__ . '/../../../../../core/Tests/Functional/DataHandling/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  const VALUE_WorkspaceId = 1;
33 
34  const TABLE_Page = 'pages';
35  const TABLE_Content = 'tt_content';
36  const TABLE_Category = 'sys_category';
37  const TABLE_ContentCategory_ManyToMany = 'sys_category_record_mm';
38 
42  protected $scenarioDataSetDirectory = 'typo3/sysext/workspaces/Tests/Functional/DataHandling/ManyToMany/DataSet/';
43 
47  protected $coreExtensionsToLoad = array(
48  'fluid',
49  'version',
50  'workspaces',
51  );
52 
53  public function setUp() {
54  parent::setUp();
55  $this->importScenarioDataSet('LiveDefaultPages');
56  $this->importScenarioDataSet('LiveDefaultElements');
57  $this->importScenarioDataSet('ReferenceIndex');
58 
59  $this->setUpFrontendRootPage(1, array('typo3/sysext/core/Tests/Functional/Fixtures/Frontend/JsonRenderer.ts'));
60  $this->backendUser->workspace = self::VALUE_WorkspaceId;
61  }
62 
71  public function addCategoryRelation() {
72  $this->actionService->modifyReferences(
73  self::TABLE_Content, self::VALUE_ContentIdFirst, 'categories', array(self::VALUE_CategoryIdFirst, self::VALUE_CategoryIdSecond, self::VALUE_CategoryIdLast)
74  );
75  }
76 
81  public function deleteCategoryRelation() {
82  $this->actionService->modifyReferences(
83  self::TABLE_Content, self::VALUE_ContentIdFirst, 'categories', array(self::VALUE_CategoryIdFirst)
84  );
85  }
86 
91  public function changeCategoryRelationSorting() {
92  $this->actionService->modifyReferences(
93  self::TABLE_Content, self::VALUE_ContentIdFirst, 'categories', array(self::VALUE_CategoryIdSecond, self::VALUE_CategoryIdFirst)
94  );
95  }
96 
101  public function createContentAndAddRelation() {
102  $newTableIds = $this->actionService->createNewRecord(
103  self::TABLE_Content, self::VALUE_PageId, array('header' => 'Testing #1', 'categories' => self::VALUE_CategoryIdSecond)
104  );
105  $this->recordIds['newContentId'] = $newTableIds[self::TABLE_Content][0];
106  }
107 
112  public function createCategoryAndAddRelation() {
113  $newTableIds = $this->actionService->createNewRecord(
114  self::TABLE_Category, 0, array('title' => 'Testing #1', 'items' => 'tt_content_' . self::VALUE_ContentIdFirst)
115  );
116  $this->recordIds['newCategoryId'] = $newTableIds[self::TABLE_Category][0];
117  }
118 
123  public function createContentAndCreateRelation() {
124  $newTableIds = $this->actionService->createNewRecords(
125  self::VALUE_PageId,
126  array(
127  self::TABLE_Category => array('pid' => 0, 'title' => 'Testing #1'),
128  self::TABLE_Content => array('header' => 'Testing #1', 'categories' => '__previousUid'),
129  )
130  );
131  $this->recordIds['newCategoryId'] = $newTableIds[self::TABLE_Category][0];
132  $this->recordIds['newContentId'] = $newTableIds[self::TABLE_Content][0];
133  }
134 
140  $newTableIds = $this->actionService->createNewRecords(
141  self::VALUE_PageId,
142  array(
143  self::TABLE_Content => array('header' => 'Testing #1',),
144  self::TABLE_Category => array('pid' => 0, 'title' => 'Testing #1', 'items' => 'tt_content___previousUid'),
145  )
146  );
147  $this->recordIds['newContentId'] = $newTableIds[self::TABLE_Content][0];
148  $this->recordIds['newCategoryId'] = $newTableIds[self::TABLE_Category][0];
149  }
150 
154  public function modifyCategoryOfRelation() {
155  $this->actionService->modifyRecord(self::TABLE_Category, self::VALUE_CategoryIdFirst, array('title' => 'Testing #1'));
156  }
157 
161  public function modifyContentOfRelation() {
162  $this->actionService->modifyRecord(self::TABLE_Content, self::VALUE_ContentIdFirst, array('header' => 'Testing #1'));
163  }
164 
168  public function modifyBothsOfRelation() {
169  $this->actionService->modifyRecord(self::TABLE_Category, self::VALUE_CategoryIdFirst, array('title' => 'Testing #1'));
170  $this->actionService->modifyRecord(self::TABLE_Content, self::VALUE_ContentIdFirst, array('header' => 'Testing #1'));
171  }
172 
176  public function deleteContentOfRelation() {
177  $this->actionService->deleteRecord(self::TABLE_Content, self::VALUE_ContentIdLast);
178  }
179 
183  public function deleteCategoryOfRelation() {
184  $this->actionService->deleteRecord(self::TABLE_Category, self::VALUE_CategoryIdFirst);
185  }
186 
190  public function copyContentOfRelation() {
191  $newTableIds = $this->actionService->copyRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_PageId);
192  $this->recordIds['newContentId'] = $newTableIds[self::TABLE_Content][self::VALUE_ContentIdLast];
193  }
194 
198  public function copyCategoryOfRelation() {
199  $newTableIds = $this->actionService->copyRecord(self::TABLE_Category, self::VALUE_CategoryIdFirst, 0);
200  $this->recordIds['newCategoryId'] = $newTableIds[self::TABLE_Category][self::VALUE_CategoryIdFirst];
201  }
202 
206  public function localizeContentOfRelation() {
207  $localizedTableIds = $this->actionService->localizeRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_LanguageId);
208  $this->recordIds['localizedContentId'] = $localizedTableIds[self::TABLE_Content][self::VALUE_ContentIdLast];
209  }
210 
214  public function localizeCategoryOfRelation() {
215  $localizedTableIds = $this->actionService->localizeRecord(self::TABLE_Category, self::VALUE_CategoryIdFirst, self::VALUE_LanguageId);
216  $this->recordIds['localizedCategoryId'] = $localizedTableIds[self::TABLE_Category][self::VALUE_CategoryIdFirst];
217  }
218 
223  $this->actionService->moveRecord(self::TABLE_Content, self::VALUE_ContentIdLast, self::VALUE_PageIdTarget);
224  }
225 
229  public function copyPage() {
230  $newTableIds = $this->actionService->copyRecord(self::TABLE_Page, self::VALUE_PageId, self::VALUE_PageIdTarget);
231  $this->recordIds['newPageId'] = $newTableIds[self::TABLE_Page][self::VALUE_PageId];
232  $this->recordIds['newContentIdFirst'] = $newTableIds[self::TABLE_Content][self::VALUE_ContentIdFirst];
233  $this->recordIds['newContentIdLast'] = $newTableIds[self::TABLE_Content][self::VALUE_ContentIdLast];
234  }
235 
236 }
setUpFrontendRootPage($pageId, array $typoScriptFiles=array())