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

Breadcrumb

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

function ResultPrinter::printTestsWithFailedAssertions

1 call to ResultPrinter::printTestsWithFailedAssertions()
ResultPrinter::print in vendor/phpunit/phpunit/src/TextUI/Output/Default/ResultPrinter.php

File

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

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 printTestsWithFailedAssertions(TestResult $result) : void {
    if (!$result->hasTestFailedEvents()) {
        return;
    }
    $elements = [];
    foreach ($result->testFailedEvents() as $event) {
        $body = $event->throwable()
            ->asString();
        if (str_starts_with($body, 'AssertionError: ')) {
            $body = substr($body, strlen('AssertionError: '));
        }
        $elements[] = [
            'title' => $this->name($event->test()),
            'body' => $body,
        ];
    }
    $this->printListHeaderWithNumber(count($elements), 'failure');
    $this->printList($elements);
}

API Navigation

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