TYPO3 CMS  TYPO3_8-7
IndexConfigVisibleFieldsTest.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 IndexConfigVisibleFieldsTest extends \TYPO3\TestingFramework\Core\Functional\FunctionalTestCase
22 {
23  protected static $commonIndexConfigFields = [
24  'title',
25  'starttime',
26  'hidden',
27  'description',
28  'timer_next_indexing',
29  'timer_offset',
30  'timer_frequency',
31  'type',
32  ];
33 
34  protected static $indexConfigFieldsByType = [
35  '0' => [],
36  '1' => [
37  'table2index',
38  'alternative_source_pid',
39  'fieldlist',
40  'get_params',
41  'chashcalc',
42  'recordsbatch',
43  'records_indexonchange',
44  ],
45  '2' => [
46  'filepath',
47  'extensions',
48  'depth',
49  ],
50  '3' => [
51  'externalUrl',
52  'depth',
53  'url_deny',
54  ],
55  '4' => [
56  'alternative_source_pid',
57  'depth',
58  ],
59  ];
60 
61  protected static $metaIndexConfigFields = [
62  'title',
63  'description',
64  'type',
65  'indexcfgs',
66  ];
67 
68  protected $coreExtensionsToLoad = ['indexed_search'];
69 
74  {
75  $this->setUpBackendUserFromFixture(1);
76  $GLOBALS['LANG'] = GeneralUtility::makeInstance(LanguageService::class);
77 
78  $formEngineTestService = GeneralUtility::makeInstance(FormTestService::class);
79 
80  foreach (static::$indexConfigFieldsByType as $type => $additionalFields) {
81  $formResult = $formEngineTestService->createNewRecordForm('index_config', ['type' => $type]);
82  $expectedFields = array_merge(static::$commonIndexConfigFields, $additionalFields);
83 
84  foreach ($expectedFields as $expectedField) {
85  $this->assertNotFalse(
86  $formEngineTestService->formHtmlContainsField($expectedField, $formResult['html']),
87  'The field ' . $expectedField . ' is not in the form HTML for index type ' . $type
88  );
89  }
90 
91  $this->assertNotFalse(
92  strpos($formResult['html'], 'Session ID'),
93  'The field Session ID is not in the form HTML'
94  );
95  }
96  }
97 
102  {
103  $this->setUpBackendUserFromFixture(1);
104  $GLOBALS['LANG'] = GeneralUtility::makeInstance(LanguageService::class);
105 
106  $formEngineTestService = GeneralUtility::makeInstance(FormTestService::class);
107  $formResult = $formEngineTestService->createNewRecordForm('index_config', ['type' => '5']);
108 
109  foreach (static::$metaIndexConfigFields as $expectedField) {
110  $this->assertNotFalse(
111  $formEngineTestService->formHtmlContainsField($expectedField, $formResult['html']),
112  'The field ' . $expectedField . ' is not in the form HTML for index type ' . $type
113  );
114  }
115  }
116 }
static makeInstance($className,... $constructorArguments)
if(TYPO3_MODE==='BE') $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tsfebeuserauth.php']['frontendEditingController']['default']