• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

FluidTYPO3 / vhs / 28590230059

02 Jul 2026 12:32PM UTC coverage: 70.857%. First build
28590230059

push

github

NamelessCoder
[TASK] Migrate View-operating code to predictable View type

18 of 24 new or added lines in 4 files covered. (75.0%)

4853 of 6849 relevant lines covered (70.86%)

4.46 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

75.86
/Classes/View/UncacheTemplateView.php
1
<?php
2
namespace FluidTYPO3\Vhs\View;
3

4
/*
5
 * This file is part of the FluidTYPO3/Vhs project under GPLv2 or later.
6
 *
7
 * For the full copyright and license information, please read the
8
 * LICENSE.md file that was distributed with this source code.
9
 */
10

11
use FluidTYPO3\Vhs\Utility\VersionUtility;
12
use Psr\Http\Message\ServerRequestInterface;
13
use TYPO3\CMS\Core\Attribute\AsAllowedCallable;
14
use TYPO3\CMS\Core\Utility\GeneralUtility;
15
use TYPO3\CMS\Extbase\Mvc\Controller\ControllerContext;
16
use TYPO3\CMS\Extbase\Mvc\ExtbaseRequestParameters;
17
use TYPO3\CMS\Fluid\Compatibility\TemplateParserBuilder;
18
use TYPO3\CMS\Fluid\Core\Rendering\RenderingContextFactory;
19
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
20
use TYPO3Fluid\Fluid\View\TemplateView;
21

22
class UncacheTemplateView extends TemplateView
23
{
24
    public function callUserFunction(string $postUserFunc, array $conf): string
25
    {
26
        $partial = $conf['partial'] ?? null;
4✔
27
        $section = $conf['section'] ?? null;
4✔
28
        $arguments = $conf['arguments'] ?? [];
4✔
29
        $parameters = $conf['controllerContext'] ?? null;
4✔
30
        $extensionName = $parameters instanceof ExtbaseRequestParameters
4✔
31
            ? $parameters->getControllerExtensionName()
×
32
            : $parameters['extensionName'] ?? null;
4✔
33

34
        if (empty($partial)) {
4✔
35
            return '';
2✔
36
        }
37

38
        $request = $parameters instanceof ExtbaseRequestParameters
2✔
NEW
39
            ? $GLOBALS['TYPO3_REQUEST']->withAttribute('extbase', $parameters)
×
40
            : clone $GLOBALS['TYPO3_REQUEST'];
2✔
41

42
        $renderingContext = $this->createRenderingContextWithRenderingContextFactory();
2✔
43
        if (VersionUtility::isCoreAtLeast13()) {
2✔
44
            $renderingContext->setAttribute(ServerRequestInterface::class, $request);
1✔
45
        } elseif (method_exists($renderingContext, 'setRequest')) {
1✔
46
            $renderingContext->setRequest($request);
1✔
47
        }
48

49
        $templatePaths = $renderingContext->getTemplatePaths();
2✔
50

51
        if (!empty($conf['partialRootPaths'])) {
2✔
52
            $templatePaths->setPartialRootPaths($conf['partialRootPaths']);
2✔
53
        } elseif ($extensionName) {
×
54
            $extensionKey = GeneralUtility::camelCaseToLowerCaseUnderscored($extensionName);
×
NEW
55
            $templatePaths->setTemplateRootPaths(['EXT:' . $extensionKey . '/Resources/Private/Templates/']);
×
NEW
56
            $templatePaths->setPartialRootPaths(['EXT:' . $extensionKey . '/Resources/Private/Partials/']);
×
NEW
57
            $templatePaths->setLayoutRootPaths(['EXT:' . $extensionKey . '/Resources/Private/Layouts/']);
×
58
        }
59

60
        $this->prepareContextsForUncachedRendering($renderingContext);
2✔
61

62
        /** @var mixed $output */
63
        $output = $this->renderPartial($partial, $section, $arguments);
2✔
64

65
        return is_scalar($output) ? (string) $output : '';
2✔
66
    }
67

68
    protected function prepareContextsForUncachedRendering(RenderingContextInterface $renderingContext): void
69
    {
70
        $this->setRenderingContext($renderingContext);
4✔
71
    }
72

73
    /**
74
     * @codeCoverageIgnore
75
     */
76
    protected function createRenderingContextWithRenderingContextFactory(): RenderingContextInterface
77
    {
78
        /** @var RenderingContextFactory $renderingContextFactory */
79
        $renderingContextFactory = GeneralUtility::makeInstance(RenderingContextFactory::class);
80
        return $renderingContextFactory->create();
81
    }
82
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc