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

FluidTYPO3 / vhs / 27842785131

19 Jun 2026 06:40PM UTC coverage: 70.695% (-0.005%) from 70.7%
27842785131

push

github

NamelessCoder
[TASK] Correct failing test expectations

5 of 7 new or added lines in 4 files covered. (71.43%)

215 existing lines in 10 files now uncovered.

5517 of 7804 relevant lines covered (70.69%)

14.92 hits per line

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

50.0
/Classes/ViewHelpers/Resource/ImageViewHelper.php
1
<?php
2
namespace FluidTYPO3\Vhs\ViewHelpers\Resource;
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\Traits\TemplateVariableViewHelperTrait;
12

13
/**
14
 * ViewHelper to output or assign a image from FAL.
15
 */
16
class ImageViewHelper extends AbstractImageViewHelper
17
{
18
    use TemplateVariableViewHelperTrait;
19

20
    /**
21
     * name of the tag to be created by this view helper
22
     *
23
     * @var string
24
     * @api
25
     */
26
    protected $tagName = 'img';
27

28
    public function initializeArguments(): void
29
    {
30
        parent::initializeArguments();
7✔
31
        $this->registerUniversalTagAttributes();
7✔
32
        $this->registerTagAttribute(
7✔
33
            'usemap',
7✔
34
            'string',
7✔
35
            'A hash-name reference to a map element with which to associate the image.'
7✔
36
        );
7✔
37
        $this->registerTagAttribute(
7✔
38
            'ismap',
7✔
39
            'string',
7✔
40
            'Specifies that its img element provides access to a server-side image map.'
7✔
41
        );
7✔
42
        $this->registerTagAttribute(
7✔
43
            'alt',
7✔
44
            'string',
7✔
45
            'Equivalent content for those who cannot process images or who have image loading disabled.'
7✔
46
        );
7✔
47
        $this->registerArgument(
7✔
48
            'as',
7✔
49
            'string',
7✔
50
            'If specified, a template variable with this name containing the requested data will be inserted ' .
7✔
51
            'instead of returning it.'
7✔
52
        );
7✔
53
    }
54

55
    public function render(): string
56
    {
57
        $files = (array) $this->getFiles();
7✔
58

59
        $images = $this->preprocessImages($files, true);
7✔
60
        if (empty($images)) {
7✔
61
            return '';
7✔
62
        }
63

UNCOV
64
        $info = [];
×
UNCOV
65
        $tags = [];
×
66

UNCOV
67
        foreach ($images as &$image) {
×
UNCOV
68
            $source = $this->preprocessSourceUri($image['source']);
×
69
            $width = $image['info'][0];
×
70
            $height = $image['info'][1];
×
UNCOV
71
            $alt = $this->arguments['alt'];
×
72
            if (empty($alt)) {
×
73
                $alt = $image['file']['alternative'];
×
74
            }
75

76
            $this->tag->addAttribute('src', $source);
×
77
            $this->tag->addAttribute('width', $width);
×
78
            $this->tag->addAttribute('height', $height);
×
UNCOV
79
            $this->tag->addAttribute('alt', $alt);
×
80

81
            $tag = $this->tag->render();
×
82
            $image['tag'] = $tag;
×
83
            $tags[] = $tag;
×
84

UNCOV
85
            $info[] = [
×
86
                'source' => $source,
×
87
                'width' => $width,
×
88
                'height' => $height,
×
UNCOV
89
                'tag' => $tag
×
90
            ];
×
91
        }
92
        $as = $this->arguments['as'];
×
93
        if (empty($as)) {
×
94
            return implode('', $tags);
×
95
        }
96
        // @TODO: figure out how to allow a ViewHelper to both render tags or return objects
97
        $output = $this->renderChildrenWithVariableOrReturnInput($info);
×
98
        return is_scalar($output) ? (string) $output : '';
×
99
    }
100
}
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