You are here

public function DevelDumperTestTrait::assertContainsDump in Devel 8

Same name and namespace in other branches
  1. 8.3 tests/src/Kernel/DevelDumperTestTrait.php \Drupal\Tests\devel\Kernel\DevelDumperTestTrait::assertContainsDump()
  2. 8.2 tests/src/Kernel/DevelDumperTestTrait.php \Drupal\Tests\devel\Kernel\DevelDumperTestTrait::assertContainsDump()
  3. 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

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

$data: The variable to dump.

null $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 83

Class

DevelDumperTestTrait
Provides a class for checking dumper output.

Namespace

Drupal\Tests\devel\Kernel

Code

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