Navigation Menu

Skip to content

Commit

Permalink
default value null makes more sense. add test cases for false.
Browse files Browse the repository at this point in the history
  • Loading branch information
euromark committed Oct 12, 2012
1 parent 57681ff commit 7bf08fd
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
12 changes: 12 additions & 0 deletions lib/Cake/Test/Case/BasicsTest.php
Expand Up @@ -825,6 +825,18 @@ public function testDebug() {
########## DEBUG ##########
'<div>this-is-a-test</div>'
###########################
EXPECTED;
$expected = sprintf($expected, str_replace(CAKE_CORE_INCLUDE_PATH, '', __FILE__), __LINE__ - 8);
$this->assertEquals($expected, $result);

ob_start();
debug(false, false, false);
$result = ob_get_clean();
$expected = <<<EXPECTED
########## DEBUG ##########
false
###########################
EXPECTED;
$expected = sprintf($expected, str_replace(CAKE_CORE_INCLUDE_PATH, '', __FILE__), __LINE__ - 8);
$this->assertEquals($expected, $result);
Expand Down
7 changes: 7 additions & 0 deletions lib/Cake/Test/Case/Utility/DebuggerTest.php
Expand Up @@ -391,6 +391,13 @@ public function testExportVar() {
[maximum depth reached]
)
)
TEXT;
$this->assertTextEquals($expected, $result);

$data = false;
$result = Debugger::exportVar($data);
$expected = <<<TEXT
false
TEXT;
$this->assertTextEquals($expected, $result);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Cake/basics.php
Expand Up @@ -75,7 +75,7 @@ function config() {
* @link http://book.cakephp.org/2.0/en/development/debugging.html#basic-debugging
* @link http://book.cakephp.org/2.0/en/core-libraries/global-constants-and-functions.html#debug
*/
function debug($var = false, $showHtml = null, $showFrom = true) {
function debug($var = null, $showHtml = null, $showFrom = true) {
if (Configure::read('debug') > 0) {
App::uses('Debugger', 'Utility');
$file = '';
Expand Down

0 comments on commit 7bf08fd

Please sign in to comment.