Browse Source

Fix formatting problems and tests.

Mark Story 6 years ago
parent
commit
bb3d4ecb02
3 changed files with 10 additions and 3 deletions
  1. 1 0
      src/Error/Debugger.php
  2. 6 0
      src/Error/DumpContext.php
  3. 3 3
      tests/TestCase/Error/DebuggerTest.php

+ 1 - 0
src/Error/Debugger.php

@@ -496,6 +496,7 @@ class Debugger
     public static function exportVar($var, int $depth = 3): string
     {
         $context = new DumpContext($depth);
+
         return static::_export($var, $context);
     }
 

+ 6 - 0
src/Error/DumpContext.php

@@ -1,5 +1,6 @@
 <?php
 declare(strict_types=1);
+
 /**
  * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
  * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
@@ -48,6 +49,11 @@ class DumpContext
      */
     private $refs;
 
+    /**
+     * Constructor
+     *
+     * @param int $maxDepth The desired depth of dump output.
+     */
     public function __construct(int $maxDepth)
     {
         $this->maxDepth = $maxDepth;

+ 3 - 3
tests/TestCase/Error/DebuggerTest.php

@@ -622,10 +622,10 @@ TEXT;
         $object = new DebuggableThing();
         $result = Debugger::exportVar($object, 2);
         $expected = <<<eos
-object(TestApp\Error\Thing\DebuggableThing) {
+object(TestApp\Error\Thing\DebuggableThing) #0 {
 
 	'foo' => 'bar',
-	'inner' => object(TestApp\Error\Thing\DebuggableThing) {}
+	'inner' => object(TestApp\Error\Thing\DebuggableThing) #1 {}
 
 }
 eos;
@@ -670,7 +670,7 @@ eos;
         Debugger::setOutputMask(['password' => '[**********]']);
         $object = new SecurityThing();
         $result = Debugger::exportVar($object);
-        $expected = 'object(TestApp\\Error\\Thing\\SecurityThing){password=>[**********]}';
+        $expected = 'object(TestApp\\Error\\Thing\\SecurityThing)#0{password=>[**********]}';
         $this->assertEquals($expected, preg_replace('/\s+/', '', $result));
     }