summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/libraries/ORM_MPTT.php6
-rw-r--r--core/models/item.php4
-rw-r--r--core/tests/ORM_MPTT_Test.php12
3 files changed, 15 insertions, 7 deletions
diff --git a/core/libraries/ORM_MPTT.php b/core/libraries/ORM_MPTT.php
index f30b6cc5..b6353cec 100644
--- a/core/libraries/ORM_MPTT.php
+++ b/core/libraries/ORM_MPTT.php
@@ -233,7 +233,7 @@ class ORM_MPTT_Core extends ORM {
* @param boolean $locked The called is already holding the lock
* @return ORM_MTPP
*/
- function moveTo($target, $locked=false) {
+ function move_to($target, $locked=false) {
if ($target->type != "album") {
throw new Exception("@todo '{$target->type}' IS NOT A VALID MOVE TARGET");
}
@@ -242,8 +242,8 @@ class ORM_MPTT_Core extends ORM {
throw new Exception("@todo '{$this->title}' IS NOT A VALID SOURCE");
}
- $numberToMove = (int)(($this->right - $this->left) / 2 + 1);
- $size_of_hole = $numberToMove * 2;
+ $number_to_move = (int)(($this->right - $this->left) / 2 + 1);
+ $size_of_hole = $number_to_move * 2;
$original_parent = $this->parent;
$original_left = $this->left;
$original_right = $this->right;
diff --git a/core/models/item.php b/core/models/item.php
index f1a979ee..bb0adc5a 100644
--- a/core/models/item.php
+++ b/core/models/item.php
@@ -59,14 +59,14 @@ class Item_Model extends ORM_MPTT {
* @param Item_Model $target Target item (must be an album
* @return ORM_MTPP
*/
- function moveTo($target) {
+ function move_to($target) {
$this->lock();
try {
$original_path = $this->file_path();
$original_resize_path = $this->resize_path();
$original_thumbnail_path = $this->thumbnail_path();
- parent::moveTo($target, true);
+ parent::move_to($target, true);
rename($original_path, $this->file_path());
if (file_exists($original_resize_path)) {
diff --git a/core/tests/ORM_MPTT_Test.php b/core/tests/ORM_MPTT_Test.php
index cd6b38eb..03230ad9 100644
--- a/core/tests/ORM_MPTT_Test.php
+++ b/core/tests/ORM_MPTT_Test.php
@@ -65,13 +65,21 @@ class ORM_MPTT_Test extends Unit_Test_Case {
$album1_2->reload();
$album1_1_1->reload();
- $album1_1_1->moveTo($album1_2);
+ $album1_1_1->move_to($album1_2);
$album1_1->reload();
$album1_2->reload();
$this->assert_equal(3, $album1_1->right - $album1_1->left);
- $this->assert_equal(3, $album1_2->right - $album1_2 ->left);
+ $this->assert_equal(3, $album1_2->right - $album1_2->left);
+
+ $this->assert_equal(
+ array($album1_1_2->id => "move_to_test_1_1_2"),
+ $album1_1->children()->select_list());
+
+ $this->assert_equal(
+ array($album1_1_1->id => "move_to_test_1_1_1"),
+ $album1_2->children()->select_list());
}
public function parent_test() {