Permalink
Browse files

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

  • Loading branch information...
1 parent f5fd069 commit f29bb562cb2ef87bc1aa08a0a10ba3384c2f7a05 @markstory markstory committed Oct 29, 2010
Showing with 21 additions and 0 deletions.
  1. +21 −0 cake/tests/cases/libs/model/model_write.test.php
@@ -2246,6 +2246,27 @@ function testUpdateExisting() {
}
/**
+ * 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
*
* @access public

0 comments on commit f29bb56

Please sign in to comment.