Merge pull request #2244 from dereuromark/2.5-debugger

Pass depth through for Debugger::dump().
This commit is contained in:
Mark Story 2013-10-30 11:26:28 -07:00
commit d6f5f2f0bb
2 changed files with 18 additions and 2 deletions

View file

@ -508,6 +508,21 @@ TEXT;
)
)
){$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);
}

View file

@ -172,12 +172,13 @@ class Debugger {
*
*
* @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));
}
/**