Adding a test for saving blank fields on a model. Closes #1243.

This commit is contained in:
mark_story 2010-10-29 00:13:09 -04:00
parent f5fd069583
commit f29bb562cb

View file

@ -2245,6 +2245,27 @@ class ModelWriteTest extends BaseModelTest {
$this->assertTrue($result);
}
/**
* test updating records and saving blank values.
*
* @return void
*/
function testUpdateSavingBlankValues() {
$this->loadFixtures('Article');
$Article =& new Article();
$Article->validate = array();
$Article->create();
$result = $Article->save(array(
'id' => 1,
'title' => '',
'body' => ''
));
$this->assertTrue($result);
$result = $Article->find('first', array('conditions' => array('Article.id' => 1)));
$this->assertEqual('', $result['Article']['title'], 'Title is not blank');
$this->assertEqual('', $result['Article']['body'], 'Body is not blank');
}
/**
* testUpdateMultiple method
*