[ticket/11495] Remove get_parent_data from interface and rename it

The method is implementation specific and has no use, apart from cache, that is
not covered by get_path_data().

PHPBB3-11495
This commit is contained in:
Joas Schilling 2013-04-30 10:37:59 +02:00
parent 8a4260703f
commit 4810c61fd7
3 changed files with 10 additions and 16 deletions

View file

@ -119,13 +119,4 @@ interface phpbb_tree_interface
* ID => Item data * ID => Item data
*/ */
public function get_subtree_data($item_id, $order_desc, $include_item); public function get_subtree_data($item_id, $order_desc, $include_item);
/**
* Get base information of parent items
*
* @param array $item The item to get the branch from
* @return array Array of items (containing basic columns from the item table)
* ID => Item data
*/
public function get_parent_data(array $item);
} }

View file

@ -595,13 +595,16 @@ abstract class phpbb_tree_nestedset implements phpbb_tree_interface
} }
/** /**
* Get base information of parent items * Get basic data of all parent items
* *
* Basic data is defined in the $item_basic_data property.
* Data is cached in the item_parents column in the item table * Data is cached in the item_parents column in the item table
* *
* @inheritdoc * @param array $item The item to get the path from
* @return array Array of items (containing basic columns from the item table)
* ID => Item data
*/ */
public function get_parent_data(array $item) public function get_path_basic_data(array $item)
{ {
$parents = array(); $parents = array();
if ((int) $item[$this->column_parent_id]) if ((int) $item[$this->column_parent_id])

View file

@ -95,7 +95,7 @@ class phpbb_tests_tree_nestedset_forum_get_data_test extends phpbb_tests_tree_ne
$this->assertEquals($expected, array_keys($this->set->get_subtree_data($forum_id, $order_desc, $include_item))); $this->assertEquals($expected, array_keys($this->set->get_subtree_data($forum_id, $order_desc, $include_item)));
} }
public function get_parent_data_data() public function get_path_basic_data_data()
{ {
return array( return array(
array(1, array(), array()), array(1, array(), array()),
@ -108,10 +108,10 @@ class phpbb_tests_tree_nestedset_forum_get_data_test extends phpbb_tests_tree_ne
} }
/** /**
* @dataProvider get_parent_data_data * @dataProvider get_path_basic_data_data
*/ */
public function test_get_parent_data($forum_id, $forum_data, $expected) public function test_get_path_basic_data($forum_id, $forum_data, $expected)
{ {
$this->assertEquals($expected, array_keys($this->set->get_parent_data(array_merge($this->forum_data[$forum_id], $forum_data)))); $this->assertEquals($expected, array_keys($this->set->get_path_basic_data(array_merge($this->forum_data[$forum_id], $forum_data))));
} }
} }