-
Notifications
You must be signed in to change notification settings - Fork 53
Description
What are you trying to achieve?
Use executeFrontendSubRequest() to test some plugin rendering.
How to reproduce the issue?
I my extension, i execute some tests and i load some extension like this
protected array $testExtensionsToLoad = [
'sng/sngpackage',
__DIR__ . '/../Fixtures/Extensions/sngpackagedemo',
];My plugin in "sngpackagedemo" is correctly initialized, and in my test class, i can check that $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['extbase']['extensions'] contain the description of my plugin and action.
If i use executeFrontendSubRequest() , i have an error like InvalidArgumentException: The default controller for extension "Sngpackagedemo" and plugin "xxx" can not be determined. Please check for TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin() in your ext_localconf.php.
After some research i find the problem in this function and its when bootstrapping in :
$container = Bootstrap::init(ClassLoadingInformation::getClassLoader());If i debug before init() my extension is in $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['extbase']['extensions'].
If i debug after, i lose my plugin description in $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['extbase']['extensions'].
If i do something like this in the code :
$save = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['extbase']['extensions'];
$container = Bootstrap::init(ClassLoadingInformation::getClassLoader());
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['extbase']['extensions'] = $save;Everything is working. This is ugly, but its only for testing purpose.
Another thing i test is forcing the declaration :
protected array $configurationToUseInTestInstance = [
'FE' => [
'cacheHash' => [
'enforceValidation' => false,
],
],
'EXTCONF' => [
'extbase' => [
'extensions' => [
'Sngpackagedemo' => [
'plugins' => [
'Displayusers' => [
'controllers' => [
'Sng\Sngpackagedemo\Controller\FrontendUserController' => [
'className' => 'Sng\Sngpackagedemo\Controller\FrontendUserController',
'alias' => 'FrontendUser',
'actions' => [
'list',
],
'nonCacheableActions' => [
'list',
],
],
],
'pluginType' => 'CType',
],
],
],
],
],
],
];With this code it works perfectly. But it seems strange to me :-)
Is there anything i miss? Why the new Bootstrap::init() doesn't read or execute the configurePlugin() in my custom extension ? I debug the code and everything are loaded in this request.
Additional information you would like to provide?
Composer
PHP : 8.4
TYPO3 : 13.4.19
typo3/testing-framework : 9.2.0