function UnitTestCaseTest::testVarDumpSameProcess

Same name and namespace in other branches
  1. 11.x core/tests/Drupal/Tests/UnitTestCaseTest.php \Drupal\Tests\UnitTestCaseTest::testVarDumpSameProcess()
  2. 10 core/tests/Drupal/Tests/UnitTestCaseTest.php \Drupal\Tests\UnitTestCaseTest::testVarDumpSameProcess()
  3. 9 core/tests/Drupal/Tests/UnitTestCaseTest.php \Drupal\Tests\UnitTestCaseTest::testVarDumpSameProcess()

Tests the dump() function in a test run in the same process.

File

core/tests/Drupal/Tests/UnitTestCaseTest.php, line 22

Class

UnitTestCaseTest
Tests for the UnitTestCase class.

Namespace

Drupal\Tests

Code

public function testVarDumpSameProcess() : void {
  // Dump some variables.
  $object = (object) [
    'Aldebaran' => 'Betelgeuse',
  ];
  dump($object);
  dump('Alpheratz');
  $dumpString = json_encode(DebugDump::getDumps());
  $this->assertStringContainsString('Aldebaran', $dumpString);
  $this->assertStringContainsString('Betelgeuse', $dumpString);
  $this->assertStringContainsString('Alpheratz', $dumpString);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.