TYPO3 CMS  TYPO3_8-7
ActionVisibleFieldsTest.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 
20 
21 class ActionVisibleFieldsTest extends \TYPO3\TestingFramework\Core\Functional\FunctionalTestCase
22 {
23  protected $coreExtensionsToLoad = ['sys_action'];
24 
25  protected static $actionCommonFields = [
26  'type',
27  'title',
28  'description',
29  'hidden',
30  'assign_to_groups',
31  ];
32 
33  protected static $actionFieldsByType = [
34  '0' => [],
35  '1' => [
36  't1_userprefix',
37  't1_copy_of_user',
38  't1_allowed_groups',
39  't1_create_user_dir',
40  ],
41  '2' => [],
42  '3' => [
43  't3_listPid',
44  't3_tables',
45  ],
46  '4' => [
47  't4_recordsToEdit',
48  ],
49  '5' => [
50  't3_listPid',
51  't3_tables',
52  ],
53  ];
54 
59  {
60  $this->setUpBackendUserFromFixture(1);
61  $GLOBALS['LANG'] = GeneralUtility::makeInstance(LanguageService::class);
62 
63  $formEngineTestService = GeneralUtility::makeInstance(FormTestService::class);
64 
65  foreach (static::$actionFieldsByType as $type => $additionalFields) {
66  $expectedFields = array_merge(static::$actionCommonFields, $additionalFields);
67  $formResult = $formEngineTestService->createNewRecordForm('sys_action', ['type' => $type]);
68 
69  foreach ($expectedFields as $expectedField) {
70  $this->assertNotFalse(
71  $formEngineTestService->formHtmlContainsField($expectedField, $formResult['html']),
72  'The field ' . $expectedField . ' is not in the form HTML'
73  );
74  }
75  }
76  }
77 }
static makeInstance($className,... $constructorArguments)
if(TYPO3_MODE==='BE') $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tsfebeuserauth.php']['frontendEditingController']['default']