mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-19 11:06:15 +00:00
Adding tests for writing falsey values.
This commit is contained in:
parent
6519de3a2e
commit
404e49b37d
1 changed files with 21 additions and 0 deletions
|
@ -1303,6 +1303,27 @@ class CakeRequestTestCase extends CakeTestCase {
|
|||
$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
|
||||
*
|
||||
|
|
Loading…
Add table
Reference in a new issue