TYPO3 CMS  TYPO3_7-6
ActionTest.php
Go to the documentation of this file.
1 <?php
3 
4 /*
5  * This file is part of the TYPO3 CMS project.
6  *
7  * It is free software; you can redistribute it and/or modify it under
8  * the terms of the GNU General Public License, either version 2
9  * of the License, or any later version.
10  *
11  * For the full copyright and license information, please read the
12  * LICENSE.txt file that was distributed with this source code.
13  *
14  * The TYPO3 project - inspiring people to share!
15  */
16 
21 {
25  protected $assertionDataSetDirectory = 'typo3/sysext/workspaces/Tests/Functional/DataHandling/FAL/Publish/DataSet/';
26 
35  public function modifyContent()
36  {
37  parent::modifyContent();
38  $this->actionService->publishRecord(self::TABLE_Content, self::VALUE_ContentIdLast);
39  $this->assertAssertionDataSet('modifyContent');
40 
41  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
42  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
43  ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1'));
44  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
45  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentImage)
46  ->setTable(self::TABLE_FileReference)->setField('title')->setValues('This is Kasper', 'Taken at T3BOARD')->setStrict(true));
47  }
48 
53  public function deleteContent()
54  {
55  parent::deleteContent();
56  $this->actionService->publishRecord(self::TABLE_Content, self::VALUE_ContentIdLast);
57  $this->assertAssertionDataSet('deleteContent');
58 
59  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
60  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
61  ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #1'));
62  $this->assertThat($responseSections, $this->getRequestSectionDoesNotHaveRecordConstraint()
63  ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #2'));
64  }
65 
70  public function copyContent()
71  {
72  parent::copyContent();
73  $this->actionService->publishRecord(self::TABLE_Content, $this->recordIds['copiedContentId']);
74  $this->assertAssertionDataSet('copyContent');
75 
76  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
77  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
78  ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #2 (copy 1)'));
79  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
80  ->setRecordIdentifier(self::TABLE_Content . ':' . $this->recordIds['copiedContentId'])->setRecordField(self::FIELD_ContentImage)
81  ->setTable(self::TABLE_FileReference)->setField('title')->setValues('This is Kasper', 'Taken at T3BOARD')->setStrict(true));
82  }
83 
88  public function localizeContent()
89  {
90  parent::localizeContent();
91  $this->actionService->publishRecord(self::TABLE_Content, $this->recordIds['localizedContentId']);
92  $this->assertAssertionDataSet('localizeContent');
93 
94  $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageId)->getResponseSections();
95  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
96  ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #1', '[Translate to Dansk:] Regular Element #2'));
97 
98  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
99  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentImage)
100  ->setTable(self::TABLE_FileReference)->setField('title')->setValues('[Translate to Dansk:] This is Kasper', '[Translate to Dansk:] Taken at T3BOARD')->setStrict(true));
101  }
102 
107  public function changeContentSorting()
108  {
109  parent::changeContentSorting();
110  $this->actionService->publishRecord(self::TABLE_Content, self::VALUE_ContentIdFirst);
111  $this->assertAssertionDataSet('changeContentSorting');
112 
113  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
114  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
115  ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #1', 'Regular Element #2'));
116  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
117  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentImage)
118  ->setTable(self::TABLE_FileReference)->setField('title')->setValues('Kasper', 'T3BOARD'));
119  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
120  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentImage)
121  ->setTable(self::TABLE_FileReference)->setField('title')->setValues('This is Kasper', 'Taken at T3BOARD')->setStrict(true));
122  }
123 
128  public function moveContentToDifferentPage()
129  {
130  parent::moveContentToDifferentPage();
131  $this->actionService->publishRecord(self::TABLE_Content, self::VALUE_ContentIdLast);
132  $this->assertAssertionDataSet('moveContentToDifferentPage');
133 
134  $responseSectionsSource = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
135  $this->assertThat($responseSectionsSource, $this->getRequestSectionHasRecordConstraint()
136  ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #1'));
137  $this->assertThat($responseSectionsSource, $this->getRequestSectionStructureHasRecordConstraint()
138  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentImage)
139  ->setTable(self::TABLE_FileReference)->setField('title')->setValues('Kasper', 'T3BOARD')->setStrict(true));
140  $responseSectionsTarget = $this->getFrontendResponse(self::VALUE_PageIdTarget)->getResponseSections();
141  $this->assertThat($responseSectionsTarget, $this->getRequestSectionHasRecordConstraint()
142  ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #2'));
143  $this->assertThat($responseSectionsTarget, $this->getRequestSectionStructureHasRecordConstraint()
144  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentImage)
145  ->setTable(self::TABLE_FileReference)->setField('title')->setValues('This is Kasper', 'Taken at T3BOARD')->setStrict(true));
146  }
147 
153  {
154  parent::moveContentToDifferentPageAndChangeSorting();
155  $this->actionService->publishRecords(
156  [
157  self::TABLE_Content => [self::VALUE_ContentIdFirst, self::VALUE_ContentIdLast],
158  ]
159  );
160  $this->assertAssertionDataSet('moveContentToDifferentPageNChangeSorting');
161 
162  $responseSections = $this->getFrontendResponse(self::VALUE_PageIdTarget)->getResponseSections();
163  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
164  ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #1', 'Regular Element #2'));
165  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
166  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentImage)
167  ->setTable(self::TABLE_FileReference)->setField('title')->setValues('Kasper', 'T3BOARD')->setStrict(true));
168  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
169  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentImage)
170  ->setTable(self::TABLE_FileReference)->setField('title')->setValues('This is Kasper', 'Taken at T3BOARD')->setStrict(true));
171  }
172 
182  {
183  parent::createContentWithFileReference();
184  $this->actionService->publishRecord(self::TABLE_Content, $this->recordIds['newContentId']);
185  $this->assertAssertionDataSet('createContentWFileReference');
186 
187  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
188  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
189  ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1'));
190  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
191  ->setRecordIdentifier(self::TABLE_Content . ':' . $this->recordIds['newContentId'])->setRecordField(self::FIELD_ContentImage)
192  ->setTable(self::TABLE_FileReference)->setField('title')->setValues('Image #1')->setStrict(true));
193  }
194 
200  {
201  parent::modifyContentWithFileReference();
202  $this->actionService->publishRecord(self::TABLE_Content, self::VALUE_ContentIdLast);
203  $this->assertAssertionDataSet('modifyContentWFileReference');
204 
205  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
206  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
207  ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1'));
208  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
209  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentImage)
210  ->setTable(self::TABLE_FileReference)->setField('title')->setValues('Taken at T3BOARD', 'Image #1')->setStrict(true));
211  }
212 
218  {
219  parent::modifyContentAndAddFileReference();
220  $this->actionService->publishRecord(self::TABLE_Content, self::VALUE_ContentIdLast);
221  $this->assertAssertionDataSet('modifyContentNAddFileReference');
222 
223  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
224  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
225  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentImage)
226  ->setTable(self::TABLE_FileReference)->setField('title')->setValues('Taken at T3BOARD', 'This is Kasper', 'Image #3')->setStrict(true));
227  }
228 
234  {
235  parent::modifyContentAndDeleteFileReference();
236  $this->actionService->publishRecord(self::TABLE_Content, self::VALUE_ContentIdLast);
237  $this->assertAssertionDataSet('modifyContentNDeleteFileReference');
238 
239  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
240  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
241  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentImage)
242  ->setTable(self::TABLE_FileReference)->setField('title')->setValues('This is Kasper')->setStrict(true));
243  $this->assertThat($responseSections, $this->getRequestSectionStructureDoesNotHaveRecordConstraint()
244  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentImage)
245  ->setTable(self::TABLE_FileReference)->setField('title')->setValues('Taken at T3BOARD'));
246  }
247 
253  {
254  parent::modifyContentAndDeleteAllFileReference();
255  $this->actionService->publishRecord(self::TABLE_Content, self::VALUE_ContentIdLast);
256  $this->assertAssertionDataSet('modifyContentNDeleteAllFileReference');
257 
258  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
259  $this->assertThat($responseSections, $this->getRequestSectionStructureDoesNotHaveRecordConstraint()
260  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentImage)
261  ->setTable(self::TABLE_FileReference)->setField('title')->setValues('Taken at T3BOARD', 'This is Kasper'));
262  }
263 }
getFrontendResponse($pageId, $languageId=0, $backendUserId=0, $workspaceId=0, $failOnFailure=true, $frontendUserId=0)