Browse Source

Merge pull request #94 from rinatio/fix-var-dump-for-objects

Fixed VarDumper::dump for objects
tags/2.0.0-beta
Alexander Makarov 12 years ago
parent
commit
62233759b7
  1. 2
      framework/helpers/base/VarDumper.php
  2. 12
      tests/unit/framework/helpers/VarDumperTest.php

2
framework/helpers/base/VarDumper.php

@ -116,7 +116,7 @@ class VarDumper
} elseif (self::$_depth <= $level) {
self::$_output .= get_class($var) . '(...)';
} else {
$id = self::$_objects[] = $var;
$id = array_push(self::$_objects, $var);
$className = get_class($var);
$members = (array)$var;
$spaces = str_repeat(' ', $level * 4);

12
tests/unit/framework/helpers/VarDumperTest.php

@ -0,0 +1,12 @@
<?php
namespace yiiunit\framework\helpers;
use \yii\helpers\VarDumper;
class VarDumperTest extends \yii\test\TestCase
{
public function testDumpObject()
{
$obj = new \StdClass();
VarDumper::dump($obj);
}
}
Loading…
Cancel
Save