Skip to content

Commit

Permalink
Adding tests for writing falsey values.
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed Sep 12, 2010
1 parent 6519de3 commit 404e49b
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions cake/tests/cases/libs/cake_request.test.php
Expand Up @@ -1303,6 +1303,27 @@ function testDataWriting() {
$this->assertEquals($request->data['Comment']['1']['author'], 'Mark');
}

/**
* test writing falsey values.
*
* @return void
*/
function testDataWritingFalsey() {
$request = new CakeRequest('posts/index');

$request->data('Post.null', null);
$this->assertNull($request->data['Post']['null']);

$request->data('Post.false', false);
$this->assertFalse($request->data['Post']['false']);

$request->data('Post.zero', 0);
$this->assertSame(0, $request->data['Post']['zero']);

$request->data('Post.empty', '');
$this->assertSame('', $request->data['Post']['empty']);
}

/**
* backupEnvironment method
*
Expand Down

0 comments on commit 404e49b

Please sign in to comment.