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/Group/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  // Referenced elements are not copied with the "parent", which is expected and correct
204  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
205  ->setRecordIdentifier(self::TABLE_Content . ':' . $this->recordIds['copiedContentId'])->setRecordField(self::FIELD_ContentElement)
206  ->setTable(self::TABLE_Element)->setField('title')->setValues('Element #2', 'Element #3'));
207  }
208 
213  public function copyElementOfRelation() {
214  parent::copyElementOfRelation();
215  $this->assertAssertionDataSet('copyElementOfRelation');
216 
217  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
218  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
219  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentElement)
220  ->setTable(self::TABLE_Element)->setField('title')->setValues('Element #1'));
221  // Referenced elements are not updated at the "parent", which is expected and correct
222  $this->assertThat($responseSections, $this->getRequestSectionStructureDoesNotHaveRecordConstraint()
223  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentElement)
224  ->setTable(self::TABLE_Element)->setField('title')->setValues('Element #1 (copy 1)'));
225  }
226 
231  public function localizeContentOfRelation() {
232  parent::localizeContentOfRelation();
233  $this->assertAssertionDataSet('localizeContentOfRelation');
234 
235  $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageId)->getResponseSections();
236  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
237  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentElement)
238  ->setTable(self::TABLE_Element)->setField('title')->setValues('Element #2', 'Element #3'));
239  }
240 
245  public function localizeElementOfRelation() {
246  parent::localizeElementOfRelation();
247  $this->assertAssertionDataSet('localizeElementOfRelation');
248 
249  $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageId)->getResponseSections();
250  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
251  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentElement)
252  ->setTable(self::TABLE_Element)->setField('title')->setValues('[Translate to Dansk:] Element #1', 'Element #2'));
253  }
254 
260  parent::moveContentOfRelationToDifferentPage();
261  $this->assertAssertionDataSet('moveContentOfRelationToDifferentPage');
262 
263  $responseSections = $this->getFrontendResponse(self::VALUE_PageIdTarget)->getResponseSections();
264  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
265  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentElement)
266  ->setTable(self::TABLE_Element)->setField('title')->setValues('Element #2', 'Element #3'));
267  }
268 
269 }
getFrontendResponse($pageId, $languageId=0, $backendUserId=0, $workspaceId=0, $failOnFailure=TRUE)