|
|
@@ -540,6 +540,25 @@ class ModelWriteTest extends BaseModelTest {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * test that beforeValidate returning false can abort saves.
|
|
|
+ *
|
|
|
+ * @return void
|
|
|
+ */
|
|
|
+ public function testBeforeValidateNullSaveAbortion() {
|
|
|
+ $this->loadFixtures('Post');
|
|
|
+ $Model = new CallbackPostTestModel();
|
|
|
+ $Model->beforeValidateReturn = null;
|
|
|
+
|
|
|
+ $data = array(
|
|
|
+ 'title' => 'new article',
|
|
|
+ 'body' => 'this is some text.'
|
|
|
+ );
|
|
|
+ $Model->create();
|
|
|
+ $result = $Model->save($data);
|
|
|
+ $this->assertFalse($result);
|
|
|
+ }
|
|
|
+
|
|
|
+/**
|
|
|
* test that beforeSave returning false can abort saves.
|
|
|
*
|
|
|
* @return void
|
|
|
@@ -559,6 +578,26 @@ class ModelWriteTest extends BaseModelTest {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * Test that beforeSave returnning null can abort saves.
|
|
|
+ *
|
|
|
+ * @return void
|
|
|
+ */
|
|
|
+ public function testBeforeSaveNullAbort() {
|
|
|
+ $this->loadFixtures('Post');
|
|
|
+ $Model = new CallbackPostTestModel();
|
|
|
+ $Model->beforeSaveReturn = null;
|
|
|
+
|
|
|
+ $data = array(
|
|
|
+ 'title' => 'new article',
|
|
|
+ 'body' => 'this is some text.'
|
|
|
+ );
|
|
|
+ $Model->create();
|
|
|
+ $result = $Model->save($data);
|
|
|
+ $this->assertFalse($result);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+/**
|
|
|
* testSaveField method
|
|
|
*
|
|
|
* @return void
|