Skip to content
Permalink
Browse files

Fixed bug TreeBehavior::beforeSave() SetLevelExistingNode

  • Loading branch information...
slywalker committed Jul 15, 2015
1 parent c4031bf commit 80c5ae63bb56415ed1353a0bb7ce4a9ad02c8c82
Showing with 6 additions and 1 deletion.
  1. +1 −1 src/ORM/Behavior/TreeBehavior.php
  2. +5 −0 tests/TestCase/ORM/Behavior/TreeBehaviorTest.php
@@ -126,7 +126,7 @@ public function beforeSave(Event $event, Entity $entity)
if ($level) {
$parentNode = $this->_getNode($parent);
$entity->set($config[$level], $parentNode[$level] + 1);
$entity->set($level, $parentNode[$level] + 1);
}
return;
}
@@ -1340,6 +1340,11 @@ public function testSetLevelExistingNode()
$entity = $this->table->get(8);
$this->assertEquals(2, $entity->depth);
$entity->parent_id = 6;
$this->table->save($entity);
$entity = $this->table->get(8);
$this->assertEquals(1, $entity->depth);
}
/**

0 comments on commit 80c5ae6

Please sign in to comment.
You can’t perform that action at this time.