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

Breadcrumb

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

class PlainTextRenderer

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

@internal This class is not covered by the backward compatibility promise for PHPUnit

Hierarchy

  • class \PHPUnit\Logging\TestDox\PlainTextRenderer

Expanded class hierarchy of PlainTextRenderer

1 file declares its use of PlainTextRenderer
Application.php in vendor/phpunit/phpunit/src/TextUI/Application.php

File

vendor/phpunit/phpunit/src/Logging/TestDox/PlainTextRenderer.php, line 19

Namespace

PHPUnit\Logging\TestDox
View source
final class PlainTextRenderer {
    
    /**
     * @psalm-param array<string, TestResultCollection> $tests
     */
    public function render(array $tests) : string {
        $buffer = '';
        foreach ($tests as $prettifiedClassName => $_tests) {
            $buffer .= $prettifiedClassName . "\n";
            foreach ($this->reduce($_tests) as $prettifiedMethodName => $outcome) {
                $buffer .= sprintf(' [%s] %s' . "\n", $outcome, $prettifiedMethodName);
            }
            $buffer .= "\n";
        }
        return $buffer;
    }
    
    /**
     * @psalm-return array<string, 'x'|' '>
     */
    private function reduce(TestResultCollection $tests) : array {
        $result = [];
        foreach ($tests as $test) {
            $prettifiedMethodName = $test->test()
                ->testDox()
                ->prettifiedMethodName();
            $success = true;
            if ($test->status()
                ->isError() || $test->status()
                ->isFailure() || $test->status()
                ->isIncomplete() || $test->status()
                ->isSkipped()) {
                $success = false;
            }
            if (!isset($result[$prettifiedMethodName])) {
                $result[$prettifiedMethodName] = $success ? 'x' : ' ';
                continue;
            }
            if ($success) {
                continue;
            }
            $result[$prettifiedMethodName] = ' ';
        }
        return $result;
    }

}

Members

Title Sort descending Modifiers Object type Summary
PlainTextRenderer::reduce private function @psalm-return array&lt;string, &#039;x&#039;|&#039; &#039;&gt;
PlainTextRenderer::render public function @psalm-param array&lt;string, TestResultCollection&gt; $tests

API Navigation

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