You are here

private function DevelDumperTestTrait::getDumperDump in Devel 8

Same name and namespace in other branches
  1. 8.3 tests/src/Kernel/DevelDumperTestTrait.php \Drupal\Tests\devel\Kernel\DevelDumperTestTrait::getDumperDump()
  2. 8.2 tests/src/Kernel/DevelDumperTestTrait.php \Drupal\Tests\devel\Kernel\DevelDumperTestTrait::getDumperDump()
  3. 4.x tests/src/Kernel/DevelDumperTestTrait.php \Drupal\Tests\devel\Kernel\DevelDumperTestTrait::getDumperDump()

Returns a string representation of a variable.

Parameters

mixed $input: The variable to dump.

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

Return value

string String representation of a variable.

See also

\Drupal\devel\DevelDumperManager::dump()

2 calls to DevelDumperTestTrait::getDumperDump()
DevelDumperTestTrait::assertContainsDump in tests/src/Kernel/DevelDumperTestTrait.php
Asserts that a haystack contains the dump output.
DevelDumperTestTrait::assertDumpEquals in tests/src/Kernel/DevelDumperTestTrait.php
Asserts that the string passed in input is equals to the string representation of a variable obtained dumping the data.

File

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

Class

DevelDumperTestTrait
Provides a class for checking dumper output.

Namespace

Drupal\Tests\devel\Kernel

Code

private function getDumperDump($input, $name = NULL) {
  ob_start();
  \Drupal::service('devel.dumper')
    ->dump($input, $name);
  $output = ob_get_contents();
  ob_end_clean();
  return rtrim($output);
}