TYPO3  7.6
FAL/PublishAll/ActionTest.php
Go to the documentation of this file.
1 <?php
2 namespace TYPO3\CMS\Workspaces\Tests\Functional\DataHandling\FAL\PublishAll;
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/PublishAll/DataSet/';
26 
35  public function modifyContent()
36  {
37  parent::modifyContent();
38  $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
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->publishWorkspace(self::VALUE_WorkspaceId);
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->publishWorkspace(self::VALUE_WorkspaceId);
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->publishWorkspace(self::VALUE_WorkspaceId);
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  // @todo Values in sys_file_reference are not copied during localization...
99  /*
100  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
101  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentImage)
102  ->setTable(self::TABLE_FileReference)->setField('title')->setValues('This is Kasper', 'Taken at T3BOARD')->setStrict(TRUE));
103  */
104  }
105 
110  public function changeContentSorting()
111  {
112  parent::changeContentSorting();
113  $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
114  $this->assertAssertionDataSet('changeContentSorting');
115 
116  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
117  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
118  ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #1', 'Regular Element #2'));
119  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
120  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentImage)
121  ->setTable(self::TABLE_FileReference)->setField('title')->setValues('Kasper', 'T3BOARD'));
122  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
123  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentImage)
124  ->setTable(self::TABLE_FileReference)->setField('title')->setValues('This is Kasper', 'Taken at T3BOARD')->setStrict(true));
125  }
126 
131  public function moveContentToDifferentPage()
132  {
133  parent::moveContentToDifferentPage();
134  $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
135  $this->assertAssertionDataSet('moveContentToDifferentPage');
136 
137  $responseSectionsSource = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
138  $this->assertThat($responseSectionsSource, $this->getRequestSectionHasRecordConstraint()
139  ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #1'));
140  $this->assertThat($responseSectionsSource, $this->getRequestSectionStructureHasRecordConstraint()
141  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentImage)
142  ->setTable(self::TABLE_FileReference)->setField('title')->setValues('Kasper', 'T3BOARD')->setStrict(true));
143  $responseSectionsTarget = $this->getFrontendResponse(self::VALUE_PageIdTarget)->getResponseSections();
144  $this->assertThat($responseSectionsTarget, $this->getRequestSectionHasRecordConstraint()
145  ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #2'));
146  $this->assertThat($responseSectionsTarget, $this->getRequestSectionStructureHasRecordConstraint()
147  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentImage)
148  ->setTable(self::TABLE_FileReference)->setField('title')->setValues('This is Kasper', 'Taken at T3BOARD')->setStrict(true));
149  }
150 
156  {
157  parent::moveContentToDifferentPageAndChangeSorting();
158  $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
159  $this->assertAssertionDataSet('moveContentToDifferentPageNChangeSorting');
160 
161  $responseSections = $this->getFrontendResponse(self::VALUE_PageIdTarget)->getResponseSections();
162  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
163  ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #1', 'Regular Element #2'));
164  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
165  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentImage)
166  ->setTable(self::TABLE_FileReference)->setField('title')->setValues('Kasper', 'T3BOARD')->setStrict(true));
167  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
168  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentImage)
169  ->setTable(self::TABLE_FileReference)->setField('title')->setValues('This is Kasper', 'Taken at T3BOARD')->setStrict(true));
170  }
171 
181  {
182  parent::createContentWithFileReference();
183  $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
184  $this->assertAssertionDataSet('createContentWFileReference');
185 
186  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
187  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
188  ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1'));
189  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
190  ->setRecordIdentifier(self::TABLE_Content . ':' . $this->recordIds['newContentId'])->setRecordField(self::FIELD_ContentImage)
191  ->setTable(self::TABLE_FileReference)->setField('title')->setValues('Image #1')->setStrict(true));
192  }
193 
199  {
200  parent::modifyContentWithFileReference();
201  $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
202  $this->assertAssertionDataSet('modifyContentWFileReference');
203 
204  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
205  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
206  ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1'));
207  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
208  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentImage)
209  ->setTable(self::TABLE_FileReference)->setField('title')->setValues('Taken at T3BOARD', 'Image #1')->setStrict(true));
210  }
211 
217  {
218  parent::modifyContentAndAddFileReference();
219  $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
220  $this->assertAssertionDataSet('modifyContentNAddFileReference');
221 
222  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
223  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
224  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentImage)
225  ->setTable(self::TABLE_FileReference)->setField('title')->setValues('Taken at T3BOARD', 'This is Kasper', 'Image #3')->setStrict(true));
226  }
227 
233  {
234  parent::modifyContentAndDeleteFileReference();
235  $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
236  $this->assertAssertionDataSet('modifyContentNDeleteFileReference');
237 
238  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
239  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
240  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentImage)
241  ->setTable(self::TABLE_FileReference)->setField('title')->setValues('This is Kasper')->setStrict(true));
242  $this->assertThat($responseSections, $this->getRequestSectionStructureDoesNotHaveRecordConstraint()
243  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentImage)
244  ->setTable(self::TABLE_FileReference)->setField('title')->setValues('Taken at T3BOARD'));
245  }
246 
252  {
253  parent::modifyContentAndDeleteAllFileReference();
254  $this->actionService->publishWorkspace(self::VALUE_WorkspaceId);
255  $this->assertAssertionDataSet('modifyContentNDeleteAllFileReference');
256 
257  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
258  $this->assertThat($responseSections, $this->getRequestSectionStructureDoesNotHaveRecordConstraint()
259  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentImage)
260  ->setTable(self::TABLE_FileReference)->setField('title')->setValues('Taken at T3BOARD', 'This is Kasper'));
261  }
262 }