mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 06:08:52 +00:00
[ticket/11495] Rename set_parent to change_parent()
PHPBB3-11495
This commit is contained in:
parent
3efae6d8af
commit
ab7054445f
3 changed files with 17 additions and 15 deletions
|
@ -388,7 +388,7 @@ abstract class phpbb_nestedset_base implements phpbb_nestedset_interface
|
||||||
/**
|
/**
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
*/
|
*/
|
||||||
public function set_parent($item_id, $new_parent_id)
|
public function change_parent($item_id, $new_parent_id)
|
||||||
{
|
{
|
||||||
$item_id = (int) $item_id;
|
$item_id = (int) $item_id;
|
||||||
$new_parent_id = (int) $new_parent_id;
|
$new_parent_id = (int) $new_parent_id;
|
||||||
|
|
|
@ -95,13 +95,15 @@ interface phpbb_nestedset_interface
|
||||||
public function move_children($current_parent_id, $new_parent_id);
|
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 $item_id The item to be moved
|
||||||
* @param int $new_parent_id The new parent item
|
* @param int $new_parent_id The new parent item
|
||||||
* @return bool True if the parent was set successfully
|
* @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
|
* Get branch of the item
|
||||||
|
|
|
@ -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);
|
$this->set->move_children($forum_id, $target_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function set_parent_data()
|
public function change_parent_data()
|
||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
array('Move single child up',
|
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
|
$result = $this->db->sql_query("SELECT forum_id, parent_id, left_id, right_id, forum_parents
|
||||||
FROM phpbb_forums
|
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));
|
$this->assertEquals($expected, $this->db->sql_fetchrowset($result));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function set_parent_throws_item_data()
|
public function change_parent_throws_item_data()
|
||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
array('Item 0 does not exist', 0, 5),
|
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
|
* @expectedException phpbb_nestedset_exception
|
||||||
* @expectedExceptionMessage FORUM_NESTEDSET_INVALID_ITEM
|
* @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(
|
return array(
|
||||||
array('New parent is child', 4, 5),
|
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
|
* @expectedException phpbb_nestedset_exception
|
||||||
* @expectedExceptionMessage FORUM_NESTEDSET_INVALID_PARENT
|
* @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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue