function DevelDumperTestTrait::assertContainsDumpExport

Same name in other branches
  1. 4.x tests/src/Kernel/DevelDumperTestTrait.php \Drupal\Tests\devel\Kernel\DevelDumperTestTrait::assertContainsDumpExport()

Asserts that a haystack contains the dump export output.

Use \Drupal\devel\DevelDumperManager::export().

Parameters

string $haystack: The string that contains the dump output to test.

mixed $data: The variable to dump.

string $name: (optional) The label to output before variable, defaults to NULL.

string $message: (optional) A message to display with the assertion.

File

tests/src/Kernel/DevelDumperTestTrait.php, line 46

Class

DevelDumperTestTrait
Provides a class for checking dumper output.

Namespace

Drupal\Tests\devel\Kernel

Code

public function assertContainsDumpExport($haystack, mixed $data, $name = NULL, $message = '') : void {
    // As at 18.04.2020 assertContainsDumpExport() is not actually used in any
    // devel tests in any current code branch.
    $output = $this->getDumperExportDump($data, $name);
    $this->assertStringContainsString($output, (string) $haystack, $message);
}