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

Breadcrumb

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

function ResultPrinter::mapTestsWithIssuesEventsToElements

@psalm-param array<string,list<ConsideredRisky|DeprecationTriggered|PhpDeprecationTriggered|PhpunitDeprecationTriggered|ErrorTriggered|NoticeTriggered|PhpNoticeTriggered|WarningTriggered|PhpWarningTriggered|PhpunitErrorTriggered|PhpunitWarningTriggered>> $events

@psalm-return array{numberOfTestsWithIssues: int, numberOfIssues: int, elements: list<array{title: string, body: string}>}

4 calls to ResultPrinter::mapTestsWithIssuesEventsToElements()
ResultPrinter::printDetailsOnTestsThatTriggeredPhpunitDeprecations in vendor/phpunit/phpunit/src/TextUI/Output/Default/ResultPrinter.php
ResultPrinter::printDetailsOnTestsThatTriggeredPhpunitWarnings in vendor/phpunit/phpunit/src/TextUI/Output/Default/ResultPrinter.php
ResultPrinter::printPhpunitErrors in vendor/phpunit/phpunit/src/TextUI/Output/Default/ResultPrinter.php
ResultPrinter::printRiskyTests in vendor/phpunit/phpunit/src/TextUI/Output/Default/ResultPrinter.php

File

vendor/phpunit/phpunit/src/TextUI/Output/Default/ResultPrinter.php, line 526

Class

ResultPrinter
@no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit

Namespace

PHPUnit\TextUI\Output\Default

Code

private function mapTestsWithIssuesEventsToElements(array $events) : array {
    $elements = [];
    $issues = 0;
    foreach ($events as $reasons) {
        $test = $reasons[0]->test();
        $testLocation = $this->testLocation($test);
        $title = $this->name($test);
        $body = '';
        $first = true;
        $single = count($reasons) === 1;
        foreach ($reasons as $reason) {
            if ($first) {
                $first = false;
            }
            else {
                $body .= PHP_EOL;
            }
            $body .= $this->reasonMessage($reason, $single);
            $body .= $this->reasonLocation($reason, $single);
            $issues++;
        }
        if (!empty($testLocation)) {
            $body .= $testLocation;
        }
        $elements[] = [
            'title' => $title,
            'body' => $body,
        ];
    }
    return [
        'numberOfTestsWithIssues' => count($events),
        'numberOfIssues' => $issues,
        'elements' => $elements,
    ];
}
RSS feed
Powered by Drupal