| @@ 672-684 (lines=13) @@ | ||
| 669 | * |
|
| 670 | * @return void |
|
| 671 | */ |
|
| 672 | public function testBeforeValidateSaveAbortion() { |
|
| 673 | $this->loadFixtures('Post'); |
|
| 674 | $Model = new CallbackPostTestModel(); |
|
| 675 | $Model->beforeValidateReturn = false; |
|
| 676 | ||
| 677 | $data = array( |
|
| 678 | 'title' => 'new article', |
|
| 679 | 'body' => 'this is some text.' |
|
| 680 | ); |
|
| 681 | $Model->create(); |
|
| 682 | $result = $Model->save($data); |
|
| 683 | $this->assertFalse($result); |
|
| 684 | } |
|
| 685 | ||
| 686 | /** |
|
| 687 | * test that beforeSave returning false can abort saves. |
|
| @@ 691-703 (lines=13) @@ | ||
| 688 | * |
|
| 689 | * @return void |
|
| 690 | */ |
|
| 691 | public function testBeforeSaveSaveAbortion() { |
|
| 692 | $this->loadFixtures('Post'); |
|
| 693 | $Model = new CallbackPostTestModel(); |
|
| 694 | $Model->beforeSaveReturn = false; |
|
| 695 | ||
| 696 | $data = array( |
|
| 697 | 'title' => 'new article', |
|
| 698 | 'body' => 'this is some text.' |
|
| 699 | ); |
|
| 700 | $Model->create(); |
|
| 701 | $result = $Model->save($data); |
|
| 702 | $this->assertFalse($result); |
|
| 703 | } |
|
| 704 | ||
| 705 | /** |
|
| 706 | * testSaveField method |
|