Permalink
Browse files

Add test to prove issue when saving invalid tree data

  • Loading branch information...
rchavik committed Dec 27, 2013
1 parent 1daa27c commit c48afae2dc8a3db3cdf5e600222e9ee39254ef61
Showing with 23 additions and 0 deletions.
  1. +23 −0 lib/Cake/Test/Case/Model/Behavior/TreeBehaviorScopedTest.php
@@ -130,6 +130,29 @@ public function testArrayScope() {
$this->assertEquals(11, $this->Tree->find('count'));
}
/**
* testSaveWithParentAndInvalidScope method
*
* Attempting to save an invalid data should not trigger an `Undefined offset`
* error
*
* @return void
*/
public function testSaveWithParentAndInvalidScope() {
$this->Tree = new FlagTree();
$this->Tree->order = null;
$data = $this->Tree->create(array(
'name' => 'Flag',
));
$tree = $this->Tree->save($data);
$this->Tree->Behaviors->load('Tree', array(
'scope' => array('FlagTree.flag' => 100)
));
$tree['FlagTree']['parent_id'] = 1;
$result = $this->Tree->save($tree);
$this->assertFalse($result);
}
/**
* testMoveUpWithScope method
*

0 comments on commit c48afae

Please sign in to comment.