I'm trying to load the TypoScript setup in a functional test into the TypoScriptFrontendController but failing on a lack of documentation / knowledge. How do you setup the TypoScript setup properly in a FunctionalTestCase so I can use it in the ContentObjectRenderer in TYPO3 CMS 11?
Best regards
To properly set up TypoScript in a Functional Testcase for TYPO3 CMS 11, you need to follow these steps:
Load TypoScript files: You can load TypoScript files in your test case by extending the Load TypoScript files: You can load TypoScript files in your test case by extending the setUpFrontendRootPage method and providing the TypoScript file paths. For example: method and providing the TypoScript file paths. For example:
protected function setUp(): void { parent::setUp(); $this->setUpBackendUserFromFixture(1); $this->setUpFrontendRootPage(1, ['EXT:your_extension/Configuration/TypoScript/YourTypoScriptFile.ts']); }Create a custom FunctionalTestCase: Extend the FunctionalTestCase and override the setUp method to include the loading of TypoScript files. Here's an example:
use TYPO3\CMS\Backend\Domain\Repository\Localization\LocalizationRepository; use TYPO3\CMS\Core\Core\Bootstrap; use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase;
class YourTestCase extends FunctionalTestCase { protected $testExtensionsToLoad = [ 'typo3conf/ext/your_extension/Tests/Functional/Fixtures/Extensions/test_extension', 'typo3conf/ext/base_extension', ];
}
Load additional files: If your system under test works with files, you can provide them by linking or copying them to the test instance. For example:
/**
By following these steps, you should be able to set up TypoScript in your Functional Testcase for TYPO3 CMS 11.
(I'm sorry stackoverflow didn't get the formatting right. I hope it helps anyway.)