Skip to content

Commit

Permalink
Pass depth through for Debugger::dump().
Browse files Browse the repository at this point in the history
  • Loading branch information
euromark committed Oct 30, 2013
1 parent f700ac0 commit fecbef5
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
15 changes: 15 additions & 0 deletions lib/Cake/Test/Case/Utility/DebuggerTest.php
Expand Up @@ -508,6 +508,21 @@ public function testDump() {
)
)
){$close}
TEXT;
$this->assertTextEquals($expected, $result);

ob_start();
Debugger::dump($var, 1);
$result = ob_get_clean();

$open = php_sapi_name() == 'cli' ? "\n" : '<pre>';
$close = php_sapi_name() == 'cli' ? "\n" : '</pre>';
$expected = <<<TEXT
{$open}array(
'People' => array(
[maximum depth reached]
)
){$close}
TEXT;
$this->assertTextEquals($expected, $result);
}
Expand Down
5 changes: 3 additions & 2 deletions lib/Cake/Utility/Debugger.php
Expand Up @@ -172,12 +172,13 @@ public static function getInstance($class = null) {
*
*
* @param mixed $var the variable to dump
* @param int $depth The depth to output to. Defaults to 3.
* @return void
* @see Debugger::exportVar()
* @link http://book.cakephp.org/2.0/en/development/debugging.html#Debugger::dump
*/
public static function dump($var) {
pr(self::exportVar($var));
public static function dump($var, $depth = 3) {
pr(self::exportVar($var, $depth));
}

/**
Expand Down

0 comments on commit fecbef5

Please sign in to comment.