You are here

public function DevelDumperTestTrait::assertContainsDumpExport in Devel 8.3

Same name and namespace in other branches
  1. 8 tests/src/Kernel/DevelDumperTestTrait.php \Drupal\Tests\devel\Kernel\DevelDumperTestTrait::assertContainsDumpExport()
  2. 8.2 tests/src/Kernel/DevelDumperTestTrait.php \Drupal\Tests\devel\Kernel\DevelDumperTestTrait::assertContainsDumpExport()
  3. 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, $data, $name = NULL, $message = '') {

  // 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);
}