function DevelDumperTestTrait::assertContainsDump

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

Asserts that a haystack contains the dump output.

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

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.

1 call to DevelDumperTestTrait::assertContainsDump()
DevelTwigExtensionTest::testDumpFunctions in tests/src/Kernel/DevelTwigExtensionTest.php
Tests that the Twig extension's dump functions produce the expected output.

File

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

Class

DevelDumperTestTrait
Provides a class for checking dumper output.

Namespace

Drupal\Tests\devel\Kernel

Code

public function assertContainsDump($haystack, mixed $data, $name = NULL, $message = '') : void {
    $output = $this->getDumperDump($data, $name);
    $this->assertStringContainsString($output, (string) $haystack, $message);
}