‪TYPO3CMS  10.4
ContentVisibleFieldsTest.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
5 /*
6  * This file is part of the TYPO3 CMS project.
7  *
8  * It is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU General Public License, either version 2
10  * of the License, or any later version.
11  *
12  * For the full copyright and license information, please read the
13  * LICENSE.txt file that was distributed with this source code.
14  *
15  * The TYPO3 project - inspiring people to share!
16  */
17 
19 
24 use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase;
25 
26 class ‪ContentVisibleFieldsTest extends FunctionalTestCase
27 {
31  protected ‪$coreExtensionsToLoad = ['felogin'];
32 
36  protected static ‪$contentFields = [
37  'CType',
38  'colPos',
39  'sys_language_uid',
40  'header',
41  'header_layout',
42  'date',
43  'header_link',
44  'starttime',
45  'endtime',
46  'fe_group',
47  'editlock',
48  'rowDescription',
49  'categories',
50  'pi_flexform'
51  ];
52 
56  public function ‪piBaseLoginFormContainsExpectedFields(): void
57  {
58  ‪$GLOBALS['TYPO3_CONF_VARS']['SYS']['features']['felogin.extbase'] = false;
59  // Reload TCA now, as the TCA is different based on the feature toggle
61  $this->setUpBackendUserFromFixture(1);
62  ‪$GLOBALS['LANG'] = GeneralUtility::makeInstance(LanguageService::class);
63 
64  $formEngineTestService = GeneralUtility::makeInstance(FormTestService::class);
65  $formResult = $formEngineTestService->createNewRecordForm('tt_content', ['CType' => 'login']);
66 
67  foreach (static::$contentFields as $expectedField) {
68  self::assertNotFalse(
69  $formEngineTestService->formHtmlContainsField($expectedField, $formResult['html']),
70  'The field ' . $expectedField . ' is not in the form HTML'
71  );
72  }
73  }
74 
78  public function ‪loginFormContainsExpectedFields(): void
79  {
80  $this->setUpBackendUserFromFixture(1);
81  ‪$GLOBALS['LANG'] = GeneralUtility::makeInstance(LanguageService::class);
82 
83  $formEngineTestService = GeneralUtility::makeInstance(FormTestService::class);
84  $formResult = $formEngineTestService->createNewRecordForm('tt_content', ['CType' => 'felogin_login']);
85 
86  foreach (static::$contentFields as $expectedField) {
87  self::assertNotFalse(
88  $formEngineTestService->formHtmlContainsField($expectedField, $formResult['html']),
89  'The field ' . $expectedField . ' is not in the form HTML'
90  );
91  }
92  }
93 }
‪TYPO3\CMS\FrontendLogin\Tests\Functional\Tca\ContentVisibleFieldsTest\$coreExtensionsToLoad
‪array $coreExtensionsToLoad
Definition: ContentVisibleFieldsTest.php:30
‪TYPO3\CMS\FrontendLogin\Tests\Functional\Tca\ContentVisibleFieldsTest\piBaseLoginFormContainsExpectedFields
‪piBaseLoginFormContainsExpectedFields()
Definition: ContentVisibleFieldsTest.php:54
‪TYPO3\CMS\FrontendLogin\Tests\Functional\Tca\ContentVisibleFieldsTest\loginFormContainsExpectedFields
‪loginFormContainsExpectedFields()
Definition: ContentVisibleFieldsTest.php:76
‪TYPO3\CMS\FrontendLogin\Tests\Functional\Tca\ContentVisibleFieldsTest\$contentFields
‪static array $contentFields
Definition: ContentVisibleFieldsTest.php:34
‪TYPO3\CMS\Core\Core\Bootstrap\loadBaseTca
‪static loadBaseTca(bool $allowCaching=true, FrontendInterface $coreCache=null)
Definition: Bootstrap.php:516
‪$GLOBALS
‪$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['adminpanel']['modules']
Definition: ext_localconf.php:5
‪TYPO3\CMS\Core\Core\Bootstrap
Definition: Bootstrap.php:66
‪TYPO3\CMS\Backend\Tests\Functional\Form\FormTestService
Definition: FormTestService.php:27
‪TYPO3\CMS\Core\Localization\LanguageService
Definition: LanguageService.php:42
‪TYPO3\CMS\FrontendLogin\Tests\Functional\Tca\ContentVisibleFieldsTest
Definition: ContentVisibleFieldsTest.php:27
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:46
‪TYPO3\CMS\FrontendLogin\Tests\Functional\Tca
Definition: ContentVisibleFieldsTest.php:18