Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. File.php

function File::render

Same name in this branch
  1. 11.1.x core/modules/file/src/Plugin/views/field/File.php \Drupal\file\Plugin\views\field\File::render()

File

vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/File.php, line 187

Class

File
@internal This class is not covered by the backward compatibility promise for phpunit/php-code-coverage

Namespace

SebastianBergmann\CodeCoverage\Report\Html

Code

public function render(FileNode $node, string $file) : void {
    $templateName = $this->templatePath . ($this->hasBranchCoverage ? 'file_branch.html' : 'file.html');
    $template = new Template($templateName, '{{', '}}');
    $this->setCommonTemplateVariables($template, $node);
    $template->setVar([
        'items' => $this->renderItems($node),
        'lines' => $this->renderSourceWithLineCoverage($node),
        'legend' => '<p><span class="legend covered-by-small-tests">Covered by small (and larger) tests</span><span class="legend covered-by-medium-tests">Covered by medium (and large) tests</span><span class="legend covered-by-large-tests">Covered by large tests (and tests of unknown size)</span><span class="legend not-covered">Not covered</span><span class="legend not-coverable">Not coverable</span></p>',
        'structure' => '',
    ]);
    try {
        $template->renderTo($file . '.html');
    } catch (Exception $e) {
        throw new FileCouldNotBeWrittenException($e->getMessage(), $e->getCode(), $e);
    }
    if ($this->hasBranchCoverage) {
        $template->setVar([
            'items' => $this->renderItems($node),
            'lines' => $this->renderSourceWithBranchCoverage($node),
            'legend' => '<p><span class="success"><strong>Fully covered</strong></span><span class="warning"><strong>Partially covered</strong></span><span class="danger"><strong>Not covered</strong></span></p>',
            'structure' => $this->renderBranchStructure($node),
        ]);
        try {
            $template->renderTo($file . '_branch.html');
        } catch (Exception $e) {
            throw new FileCouldNotBeWrittenException($e->getMessage(), $e->getCode(), $e);
        }
        $template->setVar([
            'items' => $this->renderItems($node),
            'lines' => $this->renderSourceWithPathCoverage($node),
            'legend' => '<p><span class="success"><strong>Fully covered</strong></span><span class="warning"><strong>Partially covered</strong></span><span class="danger"><strong>Not covered</strong></span></p>',
            'structure' => $this->renderPathStructure($node),
        ]);
        try {
            $template->renderTo($file . '_path.html');
        } catch (Exception $e) {
            throw new FileCouldNotBeWrittenException($e->getMessage(), $e->getCode(), $e);
        }
    }
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal