TYPO3 CMS  TYPO3_8-7
PagesLanguageOverlayVisibleFieldsTest.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 
22 class PagesLanguageOverlayVisibleFieldsTest extends \TYPO3\TestingFramework\Core\Functional\FunctionalTestCase
23 {
30  'title',
31  'nav_title',
32  'subtitle',
33  'hidden',
34  'starttime',
35  'endtime',
36  'abstract',
37  'keywords',
38  'description',
39  'author',
40  'author_email',
41  'media',
42  ];
43 
49  protected static $pageFormFields = [
53  'additionalFields' => [
54  'shortcut_mode',
55  'shortcut',
56  ],
57  'hiddenFields' => [
58  'keywords',
59  'description',
60  'content_from_pid',
61  'cache_timeout',
62  'cache_tags',
63  'no_cache',
64  'module',
65  ],
66  ],
68  'hiddenFields' => [
69  'keywords',
70  'description',
71  'content_from_pid',
72  'cache_timeout',
73  'cache_tags',
74  'no_cache',
75  'module',
76  ],
77  ],
79  'additionalFields' => [
80  'urltype',
81  'url',
82  ],
83  'hiddenFields' => [
84  'keywords',
85  'description',
86  'content_from_pid',
87  'cache_timeout',
88  'cache_tags',
89  'no_cache',
90  'module',
91  ],
92  ],
94  'hiddenFields' => [
95  'nav_title',
96  'subtitle',
97  'starttime',
98  'endtime',
99  'abstract',
100  'keywords',
101  'description',
102  'author',
103  'author_email',
104  ],
105  ],
107  'hiddenFields' => [
108  'nav_title',
109  'subtitle',
110  'starttime',
111  'endtime',
112  'abstract',
113  'keywords',
114  'description',
115  'author',
116  'author_email',
117  'media',
118  ],
119  ],
121  'hiddenFields' => [
122  'nav_title',
123  'subtitle',
124  'abstract',
125  'keywords',
126  'description',
127  'author',
128  'author_email',
129  'media',
130  ],
131  ],
132  ];
133 
138  {
139  $pageTypes = [];
140 
141  foreach (static::$pageFormFields as $doktype => $fieldConfig) {
142  $expectedFields = static::$defaultPagesLanguageOverlayFields;
143  $hiddenFields = [];
144  if (array_key_exists('additionalFields', $fieldConfig)) {
145  $expectedFields = array_merge($expectedFields, $fieldConfig['additionalFields']);
146  }
147  if (array_key_exists('hiddenFields', $fieldConfig)) {
148  $hiddenFields = $fieldConfig['hiddenFields'];
149  $expectedFields = array_diff($expectedFields, $hiddenFields);
150  }
151  $pageTypes['page doktype ' . $doktype] = [$doktype, $expectedFields, $hiddenFields];
152  }
153 
154  return $pageTypes;
155  }
156 
165  int $doktype,
166  array $expectedFields,
167  array $hiddenFields
168  ) {
169  $this->setUpBackendUserFromFixture(1);
170  $GLOBALS['LANG'] = GeneralUtility::makeInstance(LanguageService::class);
171 
172  $formEngineTestService = GeneralUtility::makeInstance(FormTestService::class);
173  $formResult = $formEngineTestService->createNewRecordForm('pages_language_overlay', ['doktype' => $doktype]);
174 
175  foreach ($expectedFields as $expectedField) {
176  $this->assertNotFalse(
177  $formEngineTestService->formHtmlContainsField($expectedField, $formResult['html']),
178  'The field ' . $expectedField . ' is not in the form HTML'
179  );
180  }
181 
182  foreach ($hiddenFields as $hiddenField) {
183  $this->assertFalse(
184  $formEngineTestService->formHtmlContainsField($hiddenField, $formResult['html']),
185  'The field ' . $hiddenField . ' is in the form HTML'
186  );
187  }
188  }
189 }
static makeInstance($className,... $constructorArguments)
pagesLanguageOverlayFormContainsExpectedFields(int $doktype, array $expectedFields, array $hiddenFields)
if(TYPO3_MODE==='BE') $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tsfebeuserauth.php']['frontendEditingController']['default']