-->

TYPO3 4.5 extbase test backend module

2019-08-27 22:58发布

问题:

I search for a way to test my extbase-extension. I work with two different templatepaths for front- and backend.

module.myext{
    view {
        templateRootPath = myext/Resources/Private/Backend/Templates/
        partialRootPath = myext/Resources/Private/Backend/Partials/
        layoutRootPath = myext/Resources/Private/Backend/Layouts/
    }
}

The backendmodule works without any problem, but my test will not get the different templatepath. If i write the view.templateRootPath to config.tx_extbase in the ext_typoscript_setup.txt it works, but in this case all my frontendtests do not work any more. The simplest way to resolve this issue is to merge the templatepaths and work with only one, but there must be a way around this solution.

Does somebody has an idea?

回答1:

Did you statically include the extension setup in your root page?

Then the backend module should work as long as you include it in the web tools and select the root page in the page-tree...

If you include your module in the user tools, this is a known bug. See here:

http://lists.typo3.org/pipermail/typo3-project-typo3v4mvc/2011-December/011174.html

You could put this code in your *ext_localconf.php*:

if (TYPO3_MODE === 'BE') {
    t3lib_extMgm::addTypoScript($_EXTKEY, 'constants', $tsIncludeConstants);
    t3lib_extMgm::addTypoScript($_EXTKEY, 'setup', $tsIncludeSetup);
}

where $tsIncludeXXis your TS code to include the configuration files of your extension:

$tsIncludeConstants = "<INCLUDE_TYPOSCRIPT: source=FILE:EXT:$_EXTKEY/Configuration/TypoScript/constants.txt>";
$tsIncludeSetup = "<INCLUDE_TYPOSCRIPT: source=FILE:EXT:$_EXTKEY/Configuration/TypoScript/setup.txt>";

This is kind of brute force, but it works...