diff options
-rw-r--r-- | phpBB/includes/nestedset/base.php | 2 | ||||
-rw-r--r-- | phpBB/includes/nestedset/interface.php | 6 | ||||
-rw-r--r-- | tests/nestedset/set_forum_move_test.php | 24 |
3 files changed, 17 insertions, 15 deletions
diff --git a/phpBB/includes/nestedset/base.php b/phpBB/includes/nestedset/base.php index 1a6b578e79..3817a6d217 100644 --- a/phpBB/includes/nestedset/base.php +++ b/phpBB/includes/nestedset/base.php @@ -388,7 +388,7 @@ abstract class phpbb_nestedset_base implements phpbb_nestedset_interface /** * @inheritdoc */ - public function set_parent($item_id, $new_parent_id) + public function change_parent($item_id, $new_parent_id) { $item_id = (int) $item_id; $new_parent_id = (int) $new_parent_id; diff --git a/phpBB/includes/nestedset/interface.php b/phpBB/includes/nestedset/interface.php index 9a8f9c4eea..a2dbc55c7d 100644 --- a/phpBB/includes/nestedset/interface.php +++ b/phpBB/includes/nestedset/interface.php @@ -95,13 +95,15 @@ interface phpbb_nestedset_interface public function move_children($current_parent_id, $new_parent_id); /** - * Set the parent item + * Change parent item + * + * Moves the item to the bottom of the new parent's list of children * * @param int $item_id The item to be moved * @param int $new_parent_id The new parent item * @return bool True if the parent was set successfully */ - public function set_parent($item, $new_parent_id); + public function change_parent($item, $new_parent_id); /** * Get branch of the item diff --git a/tests/nestedset/set_forum_move_test.php b/tests/nestedset/set_forum_move_test.php index 9a19d18476..166fe666f2 100644 --- a/tests/nestedset/set_forum_move_test.php +++ b/tests/nestedset/set_forum_move_test.php @@ -411,7 +411,7 @@ class phpbb_tests_nestedset_set_forum_move_test extends phpbb_tests_nestedset_se $this->set->move_children($forum_id, $target_id); } - public function set_parent_data() + public function change_parent_data() { return array( array('Move single child up', @@ -516,11 +516,11 @@ class phpbb_tests_nestedset_set_forum_move_test extends phpbb_tests_nestedset_se } /** - * @dataProvider set_parent_data + * @dataProvider change_parent_data */ - public function test_set_parent($explain, $forum_id, $target_id, $expected_moved, $expected) + public function test_change_parent($explain, $forum_id, $target_id, $expected_moved, $expected) { - $this->assertEquals($expected_moved, $this->set->set_parent($forum_id, $target_id)); + $this->assertEquals($expected_moved, $this->set->change_parent($forum_id, $target_id)); $result = $this->db->sql_query("SELECT forum_id, parent_id, left_id, right_id, forum_parents FROM phpbb_forums @@ -528,7 +528,7 @@ class phpbb_tests_nestedset_set_forum_move_test extends phpbb_tests_nestedset_se $this->assertEquals($expected, $this->db->sql_fetchrowset($result)); } - public function set_parent_throws_item_data() + public function change_parent_throws_item_data() { return array( array('Item 0 does not exist', 0, 5), @@ -537,17 +537,17 @@ class phpbb_tests_nestedset_set_forum_move_test extends phpbb_tests_nestedset_se } /** - * @dataProvider set_parent_throws_item_data + * @dataProvider change_parent_throws_item_data * * @expectedException phpbb_nestedset_exception * @expectedExceptionMessage FORUM_NESTEDSET_INVALID_ITEM */ - public function test_set_parent_throws_item($explain, $forum_id, $target_id) + public function test_change_parent_throws_item($explain, $forum_id, $target_id) { - $this->set->set_parent($forum_id, $target_id); + $this->set->change_parent($forum_id, $target_id); } - public function set_parent_throws_parent_data() + public function change_parent_throws_parent_data() { return array( array('New parent is child', 4, 5), @@ -557,13 +557,13 @@ class phpbb_tests_nestedset_set_forum_move_test extends phpbb_tests_nestedset_se } /** - * @dataProvider set_parent_throws_parent_data + * @dataProvider change_parent_throws_parent_data * * @expectedException phpbb_nestedset_exception * @expectedExceptionMessage FORUM_NESTEDSET_INVALID_PARENT */ - public function test_set_parent_throws_parent($explain, $forum_id, $target_id) + public function test_change_parent_throws_parent($explain, $forum_id, $target_id) { - $this->set->set_parent($forum_id, $target_id); + $this->set->change_parent($forum_id, $target_id); } } |