TYPO3 CMS  TYPO3_6-2
ActionTest.php
Go to the documentation of this file.
1 <?php
3 
17 require_once dirname(dirname(__FILE__)) . '/AbstractActionTestCase.php';
18 
23 
27  protected $assertionDataSetDirectory = 'typo3/sysext/core/Tests/Functional/DataHandling/Select/Modify/DataSet/';
28 
37  public function addElementRelation() {
38  parent::addElementRelation();
39  $this->assertAssertionDataSet('addElementRelation');
40 
41  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
42  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
43  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentElement)
44  ->setTable(self::TABLE_Element)->setField('title')->setValues('Element #1', 'Element #2', 'Element #3'));
45  }
46 
51  public function deleteElementRelation() {
52  parent::deleteElementRelation();
53  $this->assertAssertionDataSet('deleteElementRelation');
54 
55  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
56  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
57  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentElement)
58  ->setTable(self::TABLE_Element)->setField('title')->setValues('Element #1'));
59  $this->assertThat($responseSections, $this->getRequestSectionStructureDoesNotHaveRecordConstraint()
60  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentElement)
61  ->setTable(self::TABLE_Element)->setField('title')->setValues('Element #2', 'Element #3'));
62  }
63 
68  public function changeElementSorting() {
69  parent::changeElementSorting();
70  $this->assertAssertionDataSet('changeElementSorting');
71 
72  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
73  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
74  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentElement)
75  ->setTable(self::TABLE_Element)->setField('title')->setValues('Element #1', 'Element #2'));
76  }
77 
82  public function changeElementRelationSorting() {
83  parent::changeElementRelationSorting();
84  $this->assertAssertionDataSet('changeElementRelationSorting');
85 
86  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
87  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
88  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentElement)
89  ->setTable(self::TABLE_Element)->setField('title')->setValues('Element #1', 'Element #2'));
90  }
91 
97  parent::createContentAndAddElementRelation();
98  $this->assertAssertionDataSet('createContentNAddRelation');
99 
100  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
101  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
102  ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1'));
103  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
104  ->setRecordIdentifier(self::TABLE_Content . ':' . $this->recordIds['newContentId'])->setRecordField(self::FIELD_ContentElement)
105  ->setTable(self::TABLE_Element)->setField('title')->setValues('Element #1'));
106  }
107 
113  parent::createContentAndCreateElementRelation();
114  $this->assertAssertionDataSet('createContentNCreateRelation');
115 
116  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
117  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
118  ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1'));
119  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
120  ->setRecordIdentifier(self::TABLE_Content . ':' . $this->recordIds['newContentId'])->setRecordField(self::FIELD_ContentElement)
121  ->setTable(self::TABLE_Element)->setField('title')->setValues('Testing #1'));
122  }
123 
128  public function modifyElementOfRelation() {
129  parent::modifyElementOfRelation();
130  $this->assertAssertionDataSet('modifyElementOfRelation');
131 
132  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
133  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
134  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentElement)
135  ->setTable(self::TABLE_Element)->setField('title')->setValues('Testing #1', 'Element #2'));
136  }
137 
142  public function modifyContentOfRelation() {
143  parent::modifyContentOfRelation();
144  $this->assertAssertionDataSet('modifyContentOfRelation');
145 
146  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
147  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
148  ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1'));
149  }
150 
155  public function modifyBothSidesOfRelation() {
156  parent::modifyBothSidesOfRelation();
157  $this->assertAssertionDataSet('modifyBothSidesOfRelation');
158 
159  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
160  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
161  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentElement)
162  ->setTable(self::TABLE_Element)->setField('title')->setValues('Testing #1', 'Element #2'));
163  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
164  ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1'));
165  }
166 
171  public function deleteContentOfRelation() {
172  parent::deleteContentOfRelation();
173  $this->assertAssertionDataSet('deleteContentOfRelation');
174 
175  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
176  $this->assertThat($responseSections, $this->getRequestSectionDoesNotHaveRecordConstraint()
177  ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1'));
178  }
179 
184  public function deleteElementOfRelation() {
185  parent::deleteElementOfRelation();
186  $this->assertAssertionDataSet('deleteElementOfRelation');
187 
188  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
189  $this->assertThat($responseSections, $this->getRequestSectionStructureDoesNotHaveRecordConstraint()
190  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentElement)
191  ->setTable(self::TABLE_Element)->setField('title')->setValues('Element #1'));
192  }
193 
198  public function copyContentOfRelation() {
199  parent::copyContentOfRelation();
200  $this->assertAssertionDataSet('copyContentOfRelation');
201 
202  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
203  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
204  ->setRecordIdentifier(self::TABLE_Content . ':' . $this->recordIds['copiedContentId'])->setRecordField(self::FIELD_ContentElement)
205  ->setTable(self::TABLE_Element)->setField('title')->setValues('Element #2', 'Element #3'));
206  }
207 
212  public function copyElementOfRelation() {
213  parent::copyElementOfRelation();
214  $this->assertAssertionDataSet('copyElementOfRelation');
215 
216  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
217  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
218  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentElement)
219  ->setTable(self::TABLE_Element)->setField('title')->setValues('Element #1'));
220  // Referenced elements are not updated at the "parent", which is expected and correct
221  $this->assertThat($responseSections, $this->getRequestSectionStructureDoesNotHaveRecordConstraint()
222  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentElement)
223  ->setTable(self::TABLE_Element)->setField('title')->setValues('Element #1 (copy 1)'));
224  }
225 
230  public function localizeContentOfRelation() {
231  parent::localizeContentOfRelation();
232  $this->assertAssertionDataSet('localizeContentOfRelation');
233 
234  $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageId)->getResponseSections();
235  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
236  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentElement)
237  ->setTable(self::TABLE_Element)->setField('title')->setValues('Element #2', 'Element #3'));
238  }
239 
244  public function localizeElementOfRelation() {
245  parent::localizeElementOfRelation();
246  $this->assertAssertionDataSet('localizeElementOfRelation');
247 
248  $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageId)->getResponseSections();
249  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
250  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentElement)
251  ->setTable(self::TABLE_Element)->setField('title')->setValues('[Translate to Dansk:] Element #1', 'Element #2'));
252  }
253 
259  parent::moveContentOfRelationToDifferentPage();
260  $this->assertAssertionDataSet('moveContentOfRelationToDifferentPage');
261 
262  $responseSections = $this->getFrontendResponse(self::VALUE_PageIdTarget)->getResponseSections();
263  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
264  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentElement)
265  ->setTable(self::TABLE_Element)->setField('title')->setValues('Element #2', 'Element #3'));
266  }
267 
268 }
getFrontendResponse($pageId, $languageId=0, $backendUserId=0, $workspaceId=0, $failOnFailure=TRUE)