|
|
@@ -887,6 +887,35 @@ class TreeBehaviorTest extends TestCase
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * Tests making a node its own parent as an existing entity
|
|
|
+ *
|
|
|
+ * @expectedException RuntimeException
|
|
|
+ * @expectedExceptionMessage Cannot set a node's parent as itself
|
|
|
+ * @return void
|
|
|
+ */
|
|
|
+ public function testReParentSelf()
|
|
|
+ {
|
|
|
+ $entity = $this->table->get(1);
|
|
|
+ $entity->parent_id = $entity->id;
|
|
|
+ $this->table->save($entity);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Tests making a node its own parent as a new entity.
|
|
|
+ *
|
|
|
+ * @expectedException RuntimeException
|
|
|
+ * @expectedExceptionMessage Cannot set a node's parent as itself
|
|
|
+ * @return void
|
|
|
+ */
|
|
|
+ public function testReParentSelfNewEntity()
|
|
|
+ {
|
|
|
+ $entity = $this->table->newEntity(['name' => 'root']);
|
|
|
+ $entity->id = 1;
|
|
|
+ $entity->parent_id = $entity->id;
|
|
|
+ $this->table->save($entity);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
* Tests moving a subtree to the right
|
|
|
*
|
|
|
* @return void
|