function DebugDump::encodeDump

Encodes the dump for storing.

Parameters

string $testId: The id of the test from where the dump was called.

string|null $file: The path of the file from where the dump was called.

int|null $line: The line number from where the dump was called.

array $dump: The dump as an array of lines.

Return value

string An encoded string.

1 call to DebugDump::encodeDump()
DebugDump::cliHandler in core/tests/Drupal/TestTools/Extension/Dump/DebugDump.php
A CLI handler for \Symfony\Component\VarDumper\VarDumper.

File

core/tests/Drupal/TestTools/Extension/Dump/DebugDump.php, line 129

Class

DebugDump
Drupal's extension for printing dump() output results.

Namespace

Drupal\TestTools\Extension\Dump

Code

private static function encodeDump(string $testId, ?string $file, ?int $line, array $dump) : string {
    $data = [
        'test' => $testId,
        'file' => $file,
        'line' => $line,
        'dump' => $dump,
    ];
    $jsonData = json_encode($data);
    return base64_encode($jsonData);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.