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

FluidTYPO3 / vhs / 28588690713

02 Jul 2026 12:06PM UTC coverage: 70.321% (+0.4%) from 69.971%
28588690713

Pull #1986

github

web-flow
Merge 072edf753 into a434c98d5
Pull Request #1986: [TASK] Update test base class

21 of 32 new or added lines in 7 files covered. (65.63%)

81 existing lines in 10 files now uncovered.

4836 of 6877 relevant lines covered (70.32%)

4.41 hits per line

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

83.33
/Classes/ViewHelpers/Condition/Page/IsChildPageViewHelper.php
1
<?php
2
namespace FluidTYPO3\Vhs\ViewHelpers\Condition\Page;
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\Service\PageService;
12
use FluidTYPO3\Vhs\Utility\RequestResolver;
13
use TYPO3\CMS\Core\Utility\GeneralUtility;
14
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
15
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractConditionViewHelper;
16

17
/**
18
 * ### Condition: Page is child page
19
 *
20
 * Condition ViewHelper which renders the `then` child if current
21
 * page or page with provided UID is a child of some other page in
22
 * the page tree. If $respectSiteRoot is set to TRUE root pages are
23
 * never considered child pages even if they are.
24
 */
25
class IsChildPageViewHelper extends AbstractConditionViewHelper
26
{
27
    public function initializeArguments(): void
28
    {
29
        parent::initializeArguments();
2✔
30
        $this->registerArgument('pageUid', 'integer', 'value to check');
2✔
31
        $this->registerArgument('respectSiteRoot', 'boolean', 'value to check', false, false);
2✔
32
    }
33

34
    public static function verdict(array $arguments, RenderingContextInterface $renderingContext): bool
35
    {
36
        /** @var int $pageUid */
37
        $pageUid = $arguments['pageUid'];
2✔
38
        $respectSiteRoot = (bool) $arguments['respectSiteRoot'];
2✔
39

40
        if (empty($pageUid)) {
2✔
41
            /** @var int $pageUid */
NEW
UNCOV
42
            $pageUid = RequestResolver::getPageUid();
×
43
        }
44
        /** @var PageService $pageService */
45
        $pageService = GeneralUtility::makeInstance(PageService::class);
2✔
46
        $page = $pageService->getPageRepository()->getPage($pageUid);
2✔
47

48
        if ($respectSiteRoot && ($page['is_siteroot'] ?? false)) {
2✔
49
            return false;
2✔
50
        }
UNCOV
51
        return ($page['pid'] ?? 0) > 0;
×
52
    }
53
}
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