TYPO3  7.6
FAL/Publish/ActionTest.php
Go to the documentation of this file.
1 <?php
2 namespace TYPO3\CMS\Workspaces\Tests\Functional\DataHandling\FAL\Publish;
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  // @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->publishRecord(self::TABLE_Content, self::VALUE_ContentIdFirst);
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->publishRecord(self::TABLE_Content, self::VALUE_ContentIdLast);
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->publishRecords(
159  array(
160  self::TABLE_Content => array(self::VALUE_ContentIdFirst, self::VALUE_ContentIdLast),
161  )
162  );
163  $this->assertAssertionDataSet('moveContentToDifferentPageNChangeSorting');
164 
165  $responseSections = $this->getFrontendResponse(self::VALUE_PageIdTarget)->getResponseSections();
166  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
167  ->setTable(self::TABLE_Content)->setField('header')->setValues('Regular Element #1', 'Regular Element #2'));
168  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
169  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdFirst)->setRecordField(self::FIELD_ContentImage)
170  ->setTable(self::TABLE_FileReference)->setField('title')->setValues('Kasper', 'T3BOARD')->setStrict(true));
171  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
172  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentImage)
173  ->setTable(self::TABLE_FileReference)->setField('title')->setValues('This is Kasper', 'Taken at T3BOARD')->setStrict(true));
174  }
175 
185  {
186  parent::createContentWithFileReference();
187  $this->actionService->publishRecord(self::TABLE_Content, $this->recordIds['newContentId']);
188  $this->assertAssertionDataSet('createContentWFileReference');
189 
190  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
191  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
192  ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1'));
193  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
194  ->setRecordIdentifier(self::TABLE_Content . ':' . $this->recordIds['newContentId'])->setRecordField(self::FIELD_ContentImage)
195  ->setTable(self::TABLE_FileReference)->setField('title')->setValues('Image #1')->setStrict(true));
196  }
197 
203  {
204  parent::modifyContentWithFileReference();
205  $this->actionService->publishRecord(self::TABLE_Content, self::VALUE_ContentIdLast);
206  $this->assertAssertionDataSet('modifyContentWFileReference');
207 
208  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
209  $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
210  ->setTable(self::TABLE_Content)->setField('header')->setValues('Testing #1'));
211  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
212  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentImage)
213  ->setTable(self::TABLE_FileReference)->setField('title')->setValues('Taken at T3BOARD', 'Image #1')->setStrict(true));
214  }
215 
221  {
222  parent::modifyContentAndAddFileReference();
223  $this->actionService->publishRecord(self::TABLE_Content, self::VALUE_ContentIdLast);
224  $this->assertAssertionDataSet('modifyContentNAddFileReference');
225 
226  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
227  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
228  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentImage)
229  ->setTable(self::TABLE_FileReference)->setField('title')->setValues('Taken at T3BOARD', 'This is Kasper', 'Image #3')->setStrict(true));
230  }
231 
237  {
238  parent::modifyContentAndDeleteFileReference();
239  $this->actionService->publishRecord(self::TABLE_Content, self::VALUE_ContentIdLast);
240  $this->assertAssertionDataSet('modifyContentNDeleteFileReference');
241 
242  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
243  $this->assertThat($responseSections, $this->getRequestSectionStructureHasRecordConstraint()
244  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentImage)
245  ->setTable(self::TABLE_FileReference)->setField('title')->setValues('This is Kasper')->setStrict(true));
246  $this->assertThat($responseSections, $this->getRequestSectionStructureDoesNotHaveRecordConstraint()
247  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentImage)
248  ->setTable(self::TABLE_FileReference)->setField('title')->setValues('Taken at T3BOARD'));
249  }
250 
256  {
257  parent::modifyContentAndDeleteAllFileReference();
258  $this->actionService->publishRecord(self::TABLE_Content, self::VALUE_ContentIdLast);
259  $this->assertAssertionDataSet('modifyContentNDeleteAllFileReference');
260 
261  $responseSections = $this->getFrontendResponse(self::VALUE_PageId)->getResponseSections();
262  $this->assertThat($responseSections, $this->getRequestSectionStructureDoesNotHaveRecordConstraint()
263  ->setRecordIdentifier(self::TABLE_Content . ':' . self::VALUE_ContentIdLast)->setRecordField(self::FIELD_ContentImage)
264  ->setTable(self::TABLE_FileReference)->setField('title')->setValues('Taken at T3BOARD', 'This is Kasper'));
265  }
266 }