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

FluidTYPO3 / vhs / 12968595783

25 Jan 2025 09:30PM UTC coverage: 72.268%. Remained the same
12968595783

Pull #1925

github

web-flow
Merge aa1eb976f into 0ca5a1c10
Pull Request #1925: [BUGFIX] Replace all evaluateCondition methods with verdict methods

19 of 27 new or added lines in 9 files covered. (70.37%)

25 existing lines in 4 files now uncovered.

5548 of 7677 relevant lines covered (72.27%)

13.46 hits per line

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

23.08
/Classes/ViewHelpers/Media/ExistsViewHelper.php
1
<?php
2
namespace FluidTYPO3\Vhs\ViewHelpers\Media;
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\CoreUtility;
12
use TYPO3\CMS\Core\Utility\GeneralUtility;
13
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
14
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractConditionViewHelper;
15

16
/**
17
 * File/Directory Exists Condition ViewHelper.
18
 */
19
class ExistsViewHelper extends AbstractConditionViewHelper
20
{
21
    public function initializeArguments(): void
22
    {
23
        parent::initializeArguments();
6✔
24
        $this->registerArgument('file', 'string', 'Filename which must exist to trigger f:then rendering');
6✔
25
        $this->registerArgument('directory', 'string', 'Directory which must exist to trigger f:then rendering');
6✔
26
    }
27

28
    public static function verdict(array $arguments, RenderingContextInterface $renderingContext): bool
29
    {
NEW
30
        if ($arguments === null) {
×
NEW
31
            return false;
×
32
        }
NEW
33
        $file = GeneralUtility::getFileAbsFileName($arguments['file']);
×
34
        $directory = $arguments['directory'];
×
35
        $evaluation = false;
×
36
        if (isset($arguments['file'])) {
×
37
            $evaluation = ((file_exists($file) || file_exists(CoreUtility::getSitePath() . $file)) && is_file($file));
×
38
        } elseif (isset($arguments['directory'])) {
×
39
            $evaluation = (is_dir($directory) || is_dir(CoreUtility::getSitePath() . $directory));
×
40
        }
41
        return $evaluation;
×
42
    }
43
}
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